So I hear some people (ag, warmist) have been working on powered workshops.
I've been doing some experimentation myself (using lua scripts) and I've managed to come up with a system that can read power levels of nearby buildings and operate based on them. Currently, they do not have any effect on the power train itself, neither shutting it down if the power required isn't sufficient nor serving as a power source. Instead, each machine system determines how many custom machine-using buildings are attached to it, and then allocates its surplus power among them. (Some machines operate more efficiently if provided with more power - the drilling rig, for instance, can pump liquids up more z-levels if it has more power available).
Now, interacting with power systems directly would be possible, but since DF never seems to actually check if its machines are outputting or requiring the correct amount of power (they only add or subtract from the power level or required power when a new machine component is added or removed) the only way to do this would be to have the plugin script handle the power calculations by itself - by counting up the machine components directly, and adding/subtracting any custom components along with it. (The update script runs whenever a building is created or destroyed, or when the total power level of a machine system changes.)
The problem with this is that since the script is doing all the calculations, it would have to be able to determine whether or not a building is a machine component or not. For custom powered workshops, or power-providing workshops such as the steam engine, that means they would need to follow a convention, or the script would not allow them to update properly.
Since there are other people working on machines right now, it would probably be best if we all worked together on this.
I will start off with the following suggestions:
Have all workshops that constantly consume/require power be called DFHACK_MACHINA_MIN_POWER_(number)_(actual workshop name).
Have all workshops that constantly output power be called DFHACK_MACHINA_OUT_POWER_(number)_(actual workshop name).
Have all reactions that require a workshop with a minimum power level be called DFHACK_MACHINA_MIN_POWER_(number)_(actual reaction name).
Have all reactions that produce power be called DFHACK_MACHINA_OUT_POWER_(number)_FOR_(number of ticks)_(actual reaction name).
Yeah, using long workshop/reaction names to store data is kind of messy, but it's simpler than linking them to inorganics.
So... any thoughts on this?