[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 3781: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression'
Oolite Bulletins • How to check an entity's altitude? - Page 2
Page 2 of 2

Re: How to check an entity's altitude?

Posted: Fri May 31, 2019 3:39 pm
by Rustem
View this functions from Stealth Raiders OXP(deep_stealth_raiders.js):

Code: Select all

this.$configurationSetDestinationToLeaveSun = function() {...}
this.$configurationSetDestinationToSafeSun = function() {...}
this.$configurationSetDestinationToAwaySun = function() {...}

this.$behaviourFleeHeat = function() {...}
this.$behaviourFleeOverHeat = function() {...}
this.$behaviourFleeHeatInCombat = function() {...}
also in the sunSkimExitAI.plist from oolite folder Resources/AIs

Code: Select all

"LEAVE_SUN" = {...}
Its like templates and examples for development.

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();
}
Part "setStateTo: FLEE" was deleted, because its exist into ship script function.

So, for AI.plist is simple solution:

Code: Select all

FLEEING = ("sendScriptMessage: fleeFromCelestialObject");
@ UK_Eliter: If this code not worked, report me.

Re: How to check an entity's altitude?

Posted: Mon Jun 03, 2019 2:59 am
by UK_Eliter
Thanks very much Rustem. I'm seeing what I can get working . .