New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for IO modes in MjAPI #1781
Conversation
I think this one is going one notch too far. I'm assuming that you're developing your own energy specialization and that you would like to have additional properties in the annotation, right? In the current state of things, only the interface-based model will give that level of flexibility, |
I'm not developing my own energy system, but I want to provide necessary things which available in other power systems in BC's MjAPI. I think that basic input/output configuring should be available in the bc api. |
I don't know exactly what SpaceToad is planning for the Power API, but it was never meant to be a framework for new power systems. BuildCraft power is a distinct power type and the API is there so other mods can use and produce BuildCraft power. |
I did not create a new power system. I want to use BC's MJ, but with using some expected behavior, e.g. bottom side of block receive power, or up side emit power. |
@SandGrainOne it actually initially was - there was even two power systems provided in the 3.x version of BuildCraft. @Prototik ok - I understand where you're coming from. At this stage though, MjBattery is only used for tiles receiving energy. Do you have an example of the "send" mode to share? |
@SpaceToad for example engines (which has an internal buffer for energy), capactior banks, converters /etc... |
@Prototik ok - could you show what would be the new implementation of the engine if using this mechanism? |
@SpaceToad implementation should not changes (at least now), iomode only for meta-information to other parts of energy framework (eg power extraction pipes could extract energy from battery which marked for send support) |
@Prototik is the idea behind that to implement a pull power model as well as a push one? That is, for now, power is pushed to machines, but with this features, machines could look around and pull power for themselves? |
@SpaceToad Nope, real behavior should be controlled by transport system (in BC - pipes), iomodes for support handling this. |
So pipes would pull power from tiles with "out" mode and push to tiles with "in" mode? |
@SpaceToad yes, almost ideal solution. |
@Prototik I like this. It simplifies a lot third-party implementation of power production system. Are you working on an update of the wooden kinesis pipe for that? |
@SpaceToad yep, but following the principle "one PR - one feature" this PR for IO modes :) |
@Prototik that's good policy. Carrying on the review, I noticed that you introduced a lot of local variables
But they're not read most of the time
They seem to be only used for the PowerAPI compatibility. How about keeping the main BatteryObject with the minimal fields and the annotation, and sub-classing just for usage in PowerAPI? |
@SpaceToad it's using for overriding an MjBattery annotation.
They reading in overrideBattery() |
@Prototik oh, I seen. In this case, it's a bit of a bummer to store extra data if they don't have anything to do with the state of the object. They should really be passed as parameters of overrideBattery. |
Is that better? |
@Prototik definitely. One last comment, but I'll take care of this upon merge. Receive mode feels like a more natural default than Both. Default scenario is somebody using the annotation to receive power, not changing anything, and allowing the default to operate as a battery is a bit too much. |
Also, I'd really like to try an API freeze sometime today, with a 6.0.12. Except if there's any surprise left with that part of the builder framework. Let me know if you see any substantial hole left in the Energy API. |
PR updated. I have only one problem - if i connect multiple engines to one block from different sides - total mj/t ratio can be more then maxReceivedPerCycle (up to 6). But it's transport (or BatteryObject implementation) issue, not the API. I even have a solution for this. |
BatteryObject implementation is part of the API, so changing it will break the freeze. The attempt at freezing is that we don't change a line of code in the API packages. I see the problem you're pointing out though. We don't control max received per cycle but only per input side. Anyway, merging in your change, and thinking further on that one. |
Support for IO modes in MjAPI
No description provided.