Re: How to check an entity's altitude?
Posted: Fri May 31, 2019 3:39 pm
View this functions from Stealth Raiders OXP(deep_stealth_raiders.js):
also in the
Its like templates and examples for development.
Final code for
- part above examples for priority JS AI. Its should be edited from sun to common celestial object.
- i not know how long and speed need for the escorts flee perpendicularly away from the celestial object?
Oops, the celestial object not can set as ship target. Then need edit first simple version and renamed from
So, based on above examples, may be suggested this ships script function, as example solution.
Part
So, for AI.plist is simple solution:
@ UK_Eliter: If this code not worked, report me.
Code: Select all
this.$configurationSetDestinationToLeaveSun = function() {...}
this.$configurationSetDestinationToSafeSun = function() {...}
this.$configurationSetDestinationToAwaySun = function() {...}
this.$behaviourFleeHeat = function() {...}
this.$behaviourFleeOverHeat = function() {...}
this.$behaviourFleeHeatInCombat = function() {...}
sunSkimExitAI.plist
from oolite folder Resources/AIs
Code: Select all
"LEAVE_SUN" = {...}
Final code for
setTargetToCelestialObject
and setPerpendicularlyCoordinatesToCelestialObject
not developed, because:- part above examples for priority JS AI. Its should be edited from sun to common celestial object.
- i not know how long and speed need for the escorts flee perpendicularly away from the celestial object?
Oops, the celestial object not can set as ship target. Then need edit first simple version and renamed from
setTargetToCelestialObject
to fleeFromCelestialObject
.So, based on above examples, may be suggested this ships script function, as example solution.
Code: Select all
this.fleeFromCelestialObject = function() {
this.ship.target = null;
var range = this.ship.scannerRange; // this range is correctly ?
var body = this.$calcAltitudeForShip();
this.ship.destination = body;
this.ship.desiredRange = body.radius + body.altitude + range;
this.ship.desiredSpeed = this.ship.maxSpeed * 7; // 7 is optimal ?
this.ship.performFlee();
}
"setStateTo: FLEE"
was deleted, because its exist into ship script function.So, for AI.plist is simple solution:
Code: Select all
FLEEING = ("sendScriptMessage: fleeFromCelestialObject");