Status of shields, energy and laser temp after a jump

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Status of shields, energy and laser temp after a jump

Post 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 ?
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

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

Post 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;
}
Last edited by Commander McLane on Sat Sep 15, 2012 11:07 am, edited 1 time in total.
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

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

Post 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:
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

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

Post 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>
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

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

Post by Thargoid »

NPC ships could be scripted with it too, via this.shipExitedWormhole.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

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

Post 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 ...
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

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

Post 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: )
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

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

Post 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!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

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

Post 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.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

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

Post 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!
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Amah
---- E L I T E ----
---- E L I T E ----
Posts: 486
Joined: Tue Aug 28, 2012 8:05 pm
Location: aboard the Laenina Crowne - Yasen-N class space freighter
Contact:

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

Post 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.
Amah
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

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

Post 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
User avatar
Amah
---- E L I T E ----
---- E L I T E ----
Posts: 486
Joined: Tue Aug 28, 2012 8:05 pm
Location: aboard the Laenina Crowne - Yasen-N class space freighter
Contact:

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

Post 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...;-)
Amah
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

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

Post 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:
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

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

Post 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...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply