Energy Harvesting Module
Vars | |
PN | cached powernet, assigned when attached to a wirenet with a powernet |
---|---|
accumulated_power | amount of power consumed by the harvester, incremented every tick and reset every budget cycle |
input_energy | energy inputted into machine |
last_accumulated_power | last amount of energy transmitted before being reset by budget cycle, so CE can check if his engine modifications are making more power |
last_payout | last payout recieved, so CE can gleefully rub his hands every time the paycheck comes in |
last_tick | stores last REALTIMEOFDAY tick. SSEconomy runs off of that, don't see why this one shouldn't too |
manual_power_setting | manual power setting to limit the maximum draw of the machine |
manual_switch | manual on/off switch |
Procs | |
attackby | Standard checks for connecting a machine to an open cable node |
calculateMoney | |
connect_to_network | links this to SSeconomy so it can be added to the budget cycle calculations for when a mapper connects it to the power room roundstart |
disconnect_from_network | |
payout | |
process |
Var Details
PN
cached powernet, assigned when attached to a wirenet with a powernet
accumulated_power
amount of power consumed by the harvester, incremented every tick and reset every budget cycle
input_energy
energy inputted into machine
last_accumulated_power
last amount of energy transmitted before being reset by budget cycle, so CE can check if his engine modifications are making more power
last_payout
last payout recieved, so CE can gleefully rub his hands every time the paycheck comes in
last_tick
stores last REALTIMEOFDAY tick. SSEconomy runs off of that, don't see why this one shouldn't too
manual_power_setting
manual power setting to limit the maximum draw of the machine
manual_switch
manual on/off switch
Proc Details
attackby
Standard checks for connecting a machine to an open cable node
calculateMoney
- Computes money reward for power transmitted. Balancing goes here.
- Uses a piecewise function with three defined thresholds and three separate formulas. First linear formula instead of logarithmic so that you don't make
- a not insignificant amount of money by charging it with 300W. The other two formulas scale logarithmically and are designed to be balanced against extreme
- engine setups such as rad-dupe SMs and fusion TEGs.
connect_to_network
links this to SSeconomy so it can be added to the budget cycle calculations for when a mapper connects it to the power room roundstart
- Locates a power node on the turf the harvester is on, then caches a reference to its powernet and queues up in processing
- Taken from obj/machinery/power which has it natively, but this is an obj/item
disconnect_from_network
- Disconnects from the powernet and sets cached powernet reference to null, then takes it out of processing queue
- Taken from obj/machinery/power which has it natively, but this is an obj/item
payout
- Actually sends money to the engineering budget. Called exclusively by the SSEconomy subsystem in [economy.dm][/code/controllers/subsystem/economy.dm].
- Resets accumulated power to 0 and archives payout received and power generated.
process
- Checks if machine works or is still attached to a power node, shuts itself down if nonfunctional and takes itself out of processing queue
- If functional, sucks up all the excess power from the powernet and adds it to the accumulated_power var
- Uses REALTIMEOFDAY since that's what SSEconomy runs off. If using regular tick time, a lag spike will slow down the rate of power absorption and thus the money output.