Page 1 of 2

Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 9:52 am
by Shipbuilder
One thing that I have noticed is that if you carry out a hyperspace jump to escape a particularly difficult situation i.e shields are low or down, energy levels are low and lasers are overheating when you emerge in the target system the shield and energy levels are still low and the laser temperature high despite some degree of time having passed.

Generally this is not too much of a problem as you can wait until all have recovered however if you are unlucky enough to jump into an ambush with little fuel for your injectors, (if you have any), this can be an issue.

Would it be possible to have shield and energy levels fully restored and lasers fully cooled upon exiting witchspace ?

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 10:58 am
by Commander McLane
Shipbuilder wrote:
One thing that I have noticed is that if you carry out a hyperspace jump to escape a particularly difficult situation i.e shields are low or down, energy levels are low and lasers are overheating when you emerge in the target system the shield and energy levels are still low and the laser temperature high despite some degree of time having passed.
How much time has passed is a much debated issue. Basically there are two conflicting theories:

One school of thought is that the jump actually takes as much time as is indicated by the adjusting clock. To you as the pilot it only looks instantly because you spend the time in witchspace in some sort of suspended animation.

The other school of thought is that from your perspective the jump is indeed instantly, only in the surrounding Ooniverse time has passed, which is why your clock has to be adjusted. Obviously, that would be the same for your ship: no time has passed for it during the jump, therefore the shield and energy status would be exactly the same before and after the jump.

The latter school of thought seems to be reflected in how the game actually works.
Shipbuilder wrote:
Would it be possible to have shield and energy levels fully restored and lasers fully cooled upon exiting witchspace ?
If you're asking for an OXP way of doing it, the answers are yes, yes and no. Energy and shield levels can be set by script. The same goes for cabin temperature, which is another indicator that one would expect to be back to normal after a jump. Laser temperature is off-limits for scripts. So this would require you to re-write a part of the game code. The consensus among the developers has been to not do that, because it would pave the way for the frowned-upon laser cooling booster.

But the rest is only a few lines of code. Just copy the following into a text file named "script.js", and put it either directly into "AddOns", or into "AddOns/Config", which you may need to create.

Code: Select all

"use strict";

this.name           = "restoreEnergyLevels";
this.description    = "Script for restoring the player ship's energy levels after each jump";
this.author         = "Commander McLane";
this.copyright      = "© 2012 Commander McLane";
this.license        = "CC-by-nc-sa 3.0";
this.version        = "1.0";

this.shipWillExitWitchspace = function()
{
    player.ship.energy = player.ship.maxEnergy;
    player.ship.forwardShield = player.ship.maxForwardShield;
    player.ship.aftShield = player.ship.maxAftShield;
    player.ship.temperature = 0.234375;
}

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 11:07 am
by Shipbuilder
The other school of thought is that from your perspective the jump is indeed instantly, only in the surrounding Ooniverse time has passed, which is why your clock has to be adjusted. Obviously, that would be the same for your ship: no time has passed for it during the jump, therefore the shield and energy status would be exactly the same before and after the jump. The latter school of thought seems to be reflected in how the game actually works.
No problems – Thinking about it this way this makes sense.
The consensus among the developers has been to not do that, because it would pave the way for the frowned-upon laser cooling booster.
I wholeheartedly agree as the development of laser cooling equipment would unbalance the game way too much, making combat very much more risk free which of course it shouldn't be.

To be you should always be weighing up whether or not you get involved in a skirmish or try to avoid it (especially if you happen you be carrying a large hold of valuable cargo).

Thanks for your feedback and the code :wink:

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 11:34 am
by Cody
Commander McLane wrote:

Code: Select all

"use strict";

this.name           = "restoreEnergyLevels";
this.description    = "Script for restoring the player ship's energy levels after each jump";
this.author         = "Commander McLane";
this.copyright      = "© 2012 Commander McLane";
this.license        = "CC-by-nc-sa 3.0";
this.version        = "1.0";

this.shipWillExitWitchspace = function()
{
    player.ship.energy = player.ship.maxEnergy;
    player.ship.forwardShield = player.ship.maxForwardShield;
    player.ship.aftShield = player.ship.maxAftShield;
    player.ship.temperature = 0.234375;
}
That's quite a tempting code snippet, McLane... but it would give me a possibly unfair advantage over any bandits following through my wormhole.
Still... very tempting indeed! <ponders the passage of time in witchspace>

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 11:54 am
by Thargoid
NPC ships could be scripted with it too, via this.shipExitedWormhole.

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 12:08 pm
by Disembodied
Shipbuilder wrote:
One thing that I have noticed is that if you carry out a hyperspace jump to escape a particularly difficult situation i.e shields are low or down, energy levels are low and lasers are overheating when you emerge in the target system the shield and energy levels are still low and the laser temperature high despite some degree of time having passed.
All will be explained, to nobody's satisfaction, in a new piece of Oolite fiction:

Stranglehold
a Captain Hesperus adventure


coming soon to a forum near you ...

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 3:25 pm
by Commander McLane
El Viejo wrote:
That's quite a tempting code snippet, McLane... but it would give me a possibly unfair advantage over any bandits following through my wormhole.
Still... very tempting indeed! <ponders the passage of time in witchspace>
I could make it still more tempting by adding

Code: Select all

    player.ship.fuel = 7;
:P

(There is of course absolutely no justification whatsoever for this, and I want to make it abundantly clear that I wholeheartedly distance myself from any misguided attempt to create or insert such a shameful piece of code! :twisted: )

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 3:28 pm
by Cody
Commander McLane wrote:

Code: Select all

    player.ship.fuel = 7;
Yes, that had occured to me too! I'll resist that temptation in its entirety!

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 5:04 pm
by Commander McLane
For myself it's actually no temptation at all. I don't jump out of combat situations, so I usually have full shields and energy when I arrive in a new system.

Re: Status of shields, energy and laser temp after a jump

Posted: Sat Sep 15, 2012 9:28 pm
by Smivs
Commander McLane wrote:

Code: Select all

    player.ship.fuel = 7;
My 'Testing' ship has magic fuel tanks - very useful for that business. My player ships, never, ever!

Re: Status of shields, energy and laser temp after a jump

Posted: Sun Sep 16, 2012 5:05 pm
by Amah
just wondering, if one can set a different value player.ship.maxEnergy; as well, without too many sideeffects. Pondering on the idea to make an extra energy bank equipment.

Re: Status of shields, energy and laser temp after a jump

Posted: Sun Sep 16, 2012 5:10 pm
by Thargoid
Amah wrote:
just wondering, if one can set a different value player.ship.maxEnergy; as well, without too many sideeffects. Pondering on the idea to make an extra energy bank equipment.
You can't - maxEnergy is read-only

Re: Status of shields, energy and laser temp after a jump

Posted: Sun Sep 16, 2012 5:49 pm
by Amah
Thargoid wrote:
Amah wrote:
just wondering, if one can set a different value player.ship.maxEnergy; as well, without too many sideeffects. Pondering on the idea to make an extra energy bank equipment.
You can't - maxEnergy is read-only
too bad.. oh well...;-)

Re: Status of shields, energy and laser temp after a jump

Posted: Sun Sep 16, 2012 6:01 pm
by Commander McLane
Amah wrote:
Thargoid wrote:
Amah wrote:
just wondering, if one can set a different value player.ship.maxEnergy; as well, without too many sideeffects. Pondering on the idea to make an extra energy bank equipment.
You can't - maxEnergy is read-only
too bad.. oh well...:wink:
Hi Amah!

Instead of just wondering by yourself you could get absolute certainty by simply looking it up. Everything about Oolite scripting is well documented and just one click away, in the Image Oolite JavaScript Reference of the Elite Wiki. Here's all you need to know for instance about the properties an Image entity (a ship is one of several possible types of entities) can have, and what you can do to them. Scroll down to "energy", and you'll see that it is a "Number (read/write)". Scroll down to "maxEnergy", and you'll see easily that it is a "Number (read-only)".

Voilà. No need to wonder. You can just look it up, and in less time than it takes you to submit a post here on the boards. :wink:

Re: Status of shields, energy and laser temp after a jump

Posted: Sun Sep 16, 2012 6:08 pm
by Kaks
However, if all you want is extra energy bars, you can specifically set the n_bars parameter inside the drawEnergyGauge definition. You'll need a custom HUD.plist for that, though...

Not quite as helpful as increasing max energy itself, I know...