Trying to mod nuclear reactors

  • I've been playing around with the ic2 api recently, specifically with an interest in adding more functions to nuclear reactors (and learning the api). I have several ideas for what I would like to try, including new components (which is easy) and new chambers (which is really hard) but the reactors and reactor chambers do not supply the necessary functions/behaviours.


    For example: an idea to add a reactor chamber with heat capacity plating built in - this chamber will add more heat capacity than normal when attached to a reactor (with possible negative effects as well). However, the reactor code never asks the chambers for their heat capacity, it uses a single preset value depending only on the presence of a chamber. I would like it to instead query the chamber for its heat capacity. This is a minor change that doesn't affect the reactor's interface so it could be done without any collateral damage.



    So I figure there are a couple possible ways to do this:
    1) I could *try* to replace the base classes with my new custom ones (the interfaces will be the same - only internals will be changed).
    **If that's even possible**
    2) I could create brand new classes for my custom reactor+chambers that perform the necessary calculations (but that could get confusing as old reactors wouldn't know how to use the new chambers).
    3) ??? there might be an easier way that I'm missing.


    If anyone has any suggestions or can provide any useful information, I would much appreciate it (even if the answer is "this is beyond the capabilities of the api").

    • Official Post

    The increased Heat capacity is easy, just make your Block pulling up to X Heat from the Reactor, and let it store that in the Block. As soon as the Reactor goes under 1000 Heat, your Block adds Heat to the Reactor until it has exactly 1000 Heat. That way you have an additional Heat Storage for your Reactor. But the Heat capacity Chamber "might" not be able to increase the amount of stored Items inside the Reactor, it could probably work if your Block implements IReactorChamber or something similar.

  • That sounds like a bit of a sneaky solution, in that case if you were to use say thermometers from nuclear control they would never tell you the actual heat of the reactor since you're hiding some of it. But it does sound like a valid solution - worth a try.


    So for another component, what about making a containment reactor chamber that absorbs some of an explosion? I'm using a de-obfuscated ic2 for reference and I don't see any hooks to allow the chambers affect explosions (unless maybe I just have to crank their blast resistances).

  • So I guess if I want to go all out with this reactor mod, it sounds like I should just disable the regular reactor and replace them entirely. Then I can base my new reactor off of the old one and add all the hooks I need.

    • Official Post

    So I guess if I want to go all out with this reactor mod, it sounds like I should just disable the regular reactor and replace them entirely. Then I can base my new reactor off of the old one and add all the hooks I need.

    Yes, and the best thing is: The API makes that entirely possible! No Mod is accessing the Reactor directly (and one should not do that), there are enough interfaces to simulate and/or copy Reactors, or create new kinds of Reactors. I did that already with my Ingame Reactor Planner.