Page 1 of 1
Posted: Thu Dec 23, 2010 8:43 am
by Eric Walch
Mauiby de Fug wrote:.....when I managed to self-destruct by using my ECM. Needless to say, I pay a bit more attention to how much energy I have these days!
That sounds as an Oolite but to me. And now you mention it, I remember it happening to me long ago also.
Looking in the code I see there is no break-off for ECM use when energy is dropping below zero, although it looks that it was intended to not crash the player:
Code: Select all
if (energy > 0.0)
energy -= (float)(ECM_ENERGY_DRAIN_FACTOR * delta_t); // drain energy because of the ECM
else
{
ecm_in_operation = NO;
[UNIVERSE addMessage:DESC(@"ecm-out-of-juice") forCount:3.0];
}
Ill add an explicit check for energy dropping below zero as result of the energy drain:
Code: Select all
if (energy > 0.0)
energy -= (float)(ECM_ENERGY_DRAIN_FACTOR * delta_t); // drain energy because of the ECM
if (energy <= 0)
{
energy = 0;
ecm_in_operation = NO;
[UNIVERSE addMessage:DESC(@"ecm-out-of-juice") forCount:3.0];
}
Posted: Thu Dec 23, 2010 9:48 am
by Commander McLane
I seem to remember that there used to be a mechanism to prevent you from killing yourself via ECM. Something like it doesn't fire anymore if you're on your last energy bar.
But I could be wrong.
Posted: Thu Dec 23, 2010 10:01 am
by another_commander
The ECM will continue drinking energy until there is no more left. At that point, it will stop working. The ship is not destroyed, but it relies on shields for survival. What happened to Mauiby de Fug, in my opinion, was probably that he got energy damage with low shields just at the same time as the last energy bar was reaching zero.
Given that the code already acts on the case of energy dropping below 0, I am not entirely sure that the additional check proposed by Eric is going to improve anything, unless we want to revise how far we want to allow energy drops as a result of using ECM.
Posted: Thu Dec 23, 2010 10:02 am
by Mauiby de Fug
If you try to kill yourself by using just ECM, so that you're not taking damage, it will use up all your energy, and then say "ECM deactivated - no more energy" (or something along those lines). This does however keep you with full shields, and still alive.
It might have a different effect if you have no shields. Especially if you fire a Mil laser as well. The combination of all those things and still be taking fire when you have no energy means you are pretty much dead. The use of an ECM could be a last straw.
I remember my death occurring immediately after I pressed the ECM, so either it has a self-destructive effect when you have no shields, or it simply took my energy down so far that a single shot right after blew me to bits.
Edit: beaten to it by another_commander!
Posted: Thu Dec 23, 2010 10:14 am
by another_commander
Split from the JeffBTX's HUD discussion thread.
Posted: Thu Dec 23, 2010 10:40 am
by Eric Walch
another_commander wrote:Given that the code already acts on the case of energy dropping below 0, I am not entirely sure that the additional check proposed by Eric is going to improve anything, unless we want to revise how far we want to allow energy drops as a result of using ECM.
Not fully true. The current code only reacts on energy dropping below zero on the NEXT update. In the current update it COULD drop below zero. If you get killed depend fully on the line that is a bit further in the code for the energy recharge:
Code: Select all
energy += (float)(energy_recharge_rate * energy_multiplier * delta_t);
When (ECM_ENERGY_DRAIN_FACTOR > energy_recharge_rate * energy_multiplier) the total could end up negative.
ECM_ENERGY_DRAIN_FACTOR = 20, and for an Cobra MKIII without extra energy unit is "energy_recharge_rate * energy_multiplier" = 6.4. So there is a chance of staying below zero. (Unless I missed another safety mechanism). Ill try it later on with an Adder without energy unit to see if I can crash it by using ECM.
When after recharging only a very small positive value results, the remaining is used to fill up the shields and you end with exactly zero energy, giving you the "ecm-out-of-juice" message on the next update. And this is probably what happens most of the cases.
EDIT: I cant crash it with an Adder, so the current code seems okay than.
Posted: Thu Dec 23, 2010 2:19 pm
by JeffBTX
Mauiby de Fug wrote:I remember my death occurring immediately after I pressed the ECM, so either it has a self-destructive effect when you have no shields, or it simply took my energy down so far that a single shot right after blew me to bits.
(For what it's worth) this has never happened to me, in particular. I'm guessing that it was a case of timing... shields were down (probably very down), and /or you had a lot of damage.