(BUG) Reactors ignore disabled energy tanks

Started by TECHNO 1, July 25, 2017, 10:56:41 AM

Previous topic - Next topic

TECHNO 1

(Unnecessary bit) How i found the problem
When i was trying to find the EXACT power generated by the Reactor module, i decided i would do this
1 - Go to the Mission editor and make a new map, then enter that map
2 - Make 2 ships with energy tanks, give 1 ship a reactor and the other an energy mine with 1.495 energy production
3 - Get the ship with energy mine down to 50 energy (by damaging it) and turn off its tanks, wait for other ship to get to 50 energy aswell
4 - They should increase at the same rate
And that's how this bug was discovered

The glitch
It's simple, even if a ship has energy tanks disabled, reactors still generate power. Not too much of a problem because who turns off energy tanks, but still, it's there.
I make CRPL because coding is my newest hobby

Keeper Decagon

I guess this goes hand in hand with the fact that disabled energy tanks can still expend energy to power the ship. I would say, to regard an energy tank "disabled" is to regard it "cut off from energy mines", yet within the ship it still functions normally.
"For me, there is no honour or glory. No praise to be had for what I do. I fulfill my purpose for the protection of all... neither of us are going to make it out of here alive." - ?? ??, 145th CE

Dark Ambition

Perhaps it would be best with two settings. I often turn off my energy tanks to stop them from receiving energy, but if they still have energy in them (and are on a ship with a relay) i use it to give what's left to other ships so as to not dig myself into more of an energy problem.

One setting to cut off from energy mines, but still function normally.
One setting to completely turn it off.

TECHNO 1

Quote from: Dark Ambition on July 25, 2017, 12:20:30 PM
Perhaps it would be best with two settings. I often turn off my energy tanks to stop them from receiving energy, but if they still have energy in them (and are on a ship with a relay) i use it to give what's left to other ships so as to not dig myself into more of an energy problem.

One setting to cut off from energy mines, but still function normally.
One setting to completely turn it off.
That's actually a pretty good idea, but i wish there was an option to turn off energy from mines, even if there is no energy tanks
I make CRPL because coding is my newest hobby

GoodMorning

As far as I can tell, this is intended behaviour.

Turning off tanks prevents the ship from requesting energy to fill them. There is no vanilla case in which having more energy is bad, however, so the free energy from reactors is continually applied.

ship.energy += CONST_REACTORAMOUNT*reactors; //1.5eps, give or take rounding.
ship.energy = min(ship.energy, ship.energycap);

A ship-wide disconnect or "charge" and "fixed" modes for tanks would be nice, but it would complicate the request algorithm and UI further. Unlikely to happen.

Essentially, tanks just raise the cap for energy that can be stored in the ship. A lot. Turning them off just stops the ship from requesting external power.

For a more genuine bug, reactors seem to start operating before they are entirely built. Whether or not at reduced efficiency, I can't tell. But the "hull building" effect plays constantly when a ship with only a reactor module ghost and a CM (plus the aforementioned unbuilt hull) sits without a packet supply, and the ship eventually completes.
A narrative is a lightly-marked path to another reality.