Page 2 of 2

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

Posted: Sun Sep 16, 2012 6:17 pm
by Amah
thanks for the hints, folks.

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

Posted: Sun Sep 16, 2012 6:19 pm
by Commander McLane
A follow-up question to my last post: I was actually astonished to discover that energy and maxEnergy are properties of Entity rather than Ship. Do non-ship entities, like sun and planets, actually use their energy for anything?

I also was astonished to discover that

Code: Select all

> S.sun.energy
1000000
> S.sun.maxEnergy
0
> S.mainPlanet.energy
1000000
> S.mainPlanet.maxEnergy
0
A little odd, I thought.

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

Posted: Sun Sep 16, 2012 7:12 pm
by cim
Suns and planets, no, not really. Quirium cascades and plasma turret shots do use the energy value, though, and are not ships, so that's why it's on Entity internally, and thus on that part of the JS representation.

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

Posted: Mon Sep 17, 2012 4:23 am
by Wildeblood
Commander McLane wrote:
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.
And unkind people say you don't have a sense of humour, Commander McLane. You're just too subtle for them. :D

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

Posted: Mon Sep 17, 2012 7:30 am
by Eric Walch
Commander McLane wrote:
Do non-ship entities, like sun and planets, actually use their energy for anything?
I don't think that planets use energy anywhere in the code but they have a value set on initialisation:

Code: Select all

energy = collision_radius * 1000.0;
Probably because it felt wrong that it was left at 0. Now it is visible in JS it feels wrong that maxEnergy = 0 while energy itself has a value. Easiest would be to also give maxEnergy a value. Or let the JS return a null when trying to access these values. :evil:

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

Posted: Mon Sep 17, 2012 10:32 am
by Kaks
I'd go with either returning null or NaN, myself!