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
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 »

thanks for the hints, folks.
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 »

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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

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

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

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

Post 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
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

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

Post 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:
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 »

I'd go with either returning null or NaN, myself!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply