Oolite Bulletins

For information and discussion about Oolite.
It is currently Sun Sep 24, 2017 6:54 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Jan 03, 2016 9:10 pm 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1711
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
I'm not sure if this is by-design, but when the Shield Boosters (EQ_SHIELD_BOOSTER) are damaged and the player's energy level is less than the maximum energy level (player.ship.energy < player.ship.maxEnergy), then their energy level is returns to the maximum amount.

I tested this with no OXP's installed (via the AddOns folder or via the in-built download manager) by hitting the ECM multiple times to reduce my energy level to about half. I then executed this snippet of code:
Code:
player.ship.setEquipmentStatus("EQ_SHIELD_BOOSTER", "EQUIPMENT_DAMAGED");
My tests were all performed with EQ_NAVAL_SHIELD_BOOSTER, EQ_ENERGY_UNIT and EQ_NAVAL_ENERGY_UNIT installed as well. Not sure if those are related. I'll test without them later today.

So, not sure if this is a bug or not, but if someone else can test out the scenarios that would be helpful!

_________________
My OXP's


Top
   
PostPosted: Sun Jan 03, 2016 11:24 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon Jul 03, 2006 12:33 pm
Posts: 317
Location: Currently floating round Eninre
It could be circuit feedback - the power is no longer going to the broken boosters so you get feedback from the dedicated capacitors back to the energy banks...

_________________
The act of talking b*ll*cks whilst waving one's arms about wildly is referred to as testiculation.

Image


Top
   
PostPosted: Mon Jan 04, 2016 1:55 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1711
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
More information: the scenario also applies to the Military Shield Enhancement (EQ_NAVAL_SHIELD_BOOSTER). If that item is damaged when your energy is down, you get a full energy recharge.

I have also tested with all shield and extra energy items removed and confirmed it still happens. So, if all you have is the shield booster, the scenario will kick in.

I have also confirmed that the scenario doesn't kick in when the extra energy unit or Naval energy unit are damaged.

_________________
My OXP's


Top
   
PostPosted: Mon Jan 04, 2016 7:13 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 4923
It's a bug (well done spotting that, by the way). The problem is here in Resources/Scripts/oolite-equipment-control.js, this.$equipmentDisable["EQ_SHIELD_BOOSTER"] = this.$equipmentDisable["EQ_NAVAL_SHIELD_BOOSTER"] function:
Code:
player.ship.maxForwardShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
player.ship.maxAftShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
When the boosters are damaged, the script will set the maximum shield levels to what they would have been without the boosters, but it forgets to check what the actual value of the shields is at the moment of disabling the equipment. So, for a split second, the ship finds itself having forward and/or aft shields higher than what the current post-damage maximum is. This leads to negative energy drain (i.e. energy gain) in the core code, which results in the energy banks instantly filling up. To fix:
Code:
player.ship.maxForwardShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
if (player.ship.forwardShield > player.ship.maxForwardShield)  player.ship.forwardShield = player.ship.maxForwardShield;
player.ship.maxAftShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
if (player.ship.aftShield > player.ship.maxAftShield)  player.ship.aftShield = player.ship.maxAftShield;
The heart of the problem is in the core itself, which allows for negative enrergy drains to occur. However, since the behaviour is easily fixable in the script and there could be OXPs that rely on negative energy drain behaviour in the future, for now I think I'll leave the core alone and just ensure that the maximum shield values are not exceeded via the boosters script.


Top
   
PostPosted: Mon Jan 04, 2016 7:27 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon Jul 03, 2006 12:33 pm
Posts: 317
Location: Currently floating round Eninre
Quote:
It's a bug.
Keep it in!
Seeing as it only does it with shield boosters I think my explanation fits nicely within the Ooniverse.

_________________
The act of talking b*ll*cks whilst waving one's arms about wildly is referred to as testiculation.

Image


Top
   
PostPosted: Mon Jan 04, 2016 8:02 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 4923
The core is unchanged, but the fix in the script has already gone in (commit 623f9ef). If you prefer the way it was before, you can just remove the two check lines added in oolite-equipment-control.js and Shift-restart the game.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited