More JS equivalents for AI commands and messages
methods ship.requestHelpFromGroup() <= groupAttackTarget ship.markTargetForFines() ship.perform...(): Attack, Collect, Escort, FaceDestination, Flee, FlyToRangeFromDestination, Hold, Idle, Intercept, LandOnPlanet, Mining, ScriptedAI, ScriptedAttackAI, Stop, Tumble and event this.helpRequestReceived(ally,enemy) <= GROUP_ATTACK_TARGET
This commit is contained in:
parent
321249c2e5
commit
db4158a483
@ -49,4 +49,23 @@ MA 02110-1301, USA.
|
||||
|
||||
- (BOOL) suggestEscortTo:(ShipEntity *)mother;
|
||||
|
||||
- (void) groupAttackTarget;
|
||||
|
||||
- (void) performFlyToRangeFromDestination;
|
||||
- (void) performIdle;
|
||||
- (void) performHold;
|
||||
- (void) performAttack;
|
||||
- (void) performCollect;
|
||||
|
||||
- (void) performIntercept;
|
||||
|
||||
- (void) performFlee;
|
||||
|
||||
- (void) performScriptedAI;
|
||||
- (void) performScriptedAttackAI;
|
||||
- (void) performFaceDestination;
|
||||
- (void) performLandOnPlanet;
|
||||
- (void) performEscort;
|
||||
- (void) performMining;
|
||||
|
||||
@end
|
||||
|
@ -97,16 +97,9 @@
|
||||
|
||||
- (void) setThrustFactorTo:(NSString *)thrustFactorString;
|
||||
|
||||
- (void) performFlyToRangeFromDestination;
|
||||
|
||||
- (void) performIdle;
|
||||
|
||||
- (void) performHold;
|
||||
|
||||
- (void) setTargetToPrimaryAggressor;
|
||||
|
||||
- (void) performAttack;
|
||||
|
||||
- (void) scanForNearestMerchantman;
|
||||
- (void) scanForRandomMerchantman;
|
||||
|
||||
@ -118,15 +111,6 @@
|
||||
|
||||
- (void) checkForFullHold;
|
||||
|
||||
- (void) performCollect;
|
||||
|
||||
- (void) performIntercept;
|
||||
|
||||
- (void) performFlee;
|
||||
|
||||
- (void) performScriptedAI;
|
||||
- (void) performScriptedAttackAI;
|
||||
|
||||
- (void) requestDockingCoordinates;
|
||||
|
||||
- (void) getWitchspaceEntryCoordinates;
|
||||
@ -134,12 +118,9 @@
|
||||
- (void) setDestinationFromCoordinates;
|
||||
- (void) setCoordinatesFromPosition;
|
||||
|
||||
- (void) performFaceDestination;
|
||||
|
||||
- (void) fightOrFleeMissile;
|
||||
|
||||
- (void) setCourseToPlanet;
|
||||
- (void) performLandOnPlanet;
|
||||
- (void) setTakeOffFromPlanet;
|
||||
- (void) landOnPlanet;
|
||||
|
||||
@ -189,12 +170,8 @@
|
||||
|
||||
- (void) escortCheckMother;
|
||||
|
||||
- (void) performEscort;
|
||||
|
||||
- (void) checkGroupOddsVersusTarget;
|
||||
|
||||
- (void) groupAttackTarget;
|
||||
|
||||
- (void) scanForFormationLeader;
|
||||
|
||||
- (void) messageMother:(NSString *)msgString;
|
||||
@ -222,8 +199,6 @@
|
||||
|
||||
- (void) scanForRocks;
|
||||
|
||||
- (void) performMining;
|
||||
|
||||
- (void) setDestinationToDockingAbort;
|
||||
|
||||
- (void) requestNewTarget;
|
||||
@ -317,11 +292,163 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performTumble
|
||||
- (void) groupAttackTarget
|
||||
{
|
||||
stick_roll = max_flight_roll*2.0*(randf() - 0.5);
|
||||
stick_pitch = max_flight_pitch*2.0*(randf() - 0.5);
|
||||
behaviour = BEHAVIOUR_TUMBLE;
|
||||
NSEnumerator *shipEnum = nil;
|
||||
ShipEntity *target = nil, *ship = nil;
|
||||
|
||||
target = [self primaryTarget];
|
||||
|
||||
if (target == nil) return;
|
||||
|
||||
if ([self group] == nil) // ship is alone!
|
||||
{
|
||||
[self setFoundTarget:target];
|
||||
[shipAI reactToMessage:@"GROUP_ATTACK_TARGET" context:@"groupAttackTarget"];
|
||||
[self doScriptEvent:OOJSID("helpRequestReceived") withArgument:self andArgument:target];
|
||||
return;
|
||||
}
|
||||
|
||||
// -memberArray creates a new collection, which is needed because the group might be mutated by the members' AIs.
|
||||
NSArray *groupMembers = [[self group] memberArray];
|
||||
for (shipEnum = [groupMembers objectEnumerator]; (ship = [shipEnum nextObject]); )
|
||||
{
|
||||
[ship setFoundTarget:target];
|
||||
[ship reactToAIMessage:@"GROUP_ATTACK_TARGET" context:@"groupAttackTarget"];
|
||||
[ship doScriptEvent:OOJSID("helpRequestReceived") withArgument:self andArgument:target];
|
||||
|
||||
if ([ship escortGroup] != [ship group] && [[ship escortGroup] count] > 1) // Ship has a seperate escort group.
|
||||
{
|
||||
ShipEntity *escort = nil;
|
||||
NSEnumerator *shipEnum = nil;
|
||||
NSArray *escortMembers = [[ship escortGroup] memberArrayExcludingLeader];
|
||||
for (shipEnum = [escortMembers objectEnumerator]; (escort = [shipEnum nextObject]); )
|
||||
{
|
||||
[escort setFoundTarget:target];
|
||||
[escort reactToAIMessage:@"GROUP_ATTACK_TARGET" context:@"groupAttackTarget"];
|
||||
[escort doScriptEvent:OOJSID("helpRequestReceived") withArgument:self andArgument:target];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) performAttack
|
||||
{
|
||||
behaviour = BEHAVIOUR_ATTACK_TARGET;
|
||||
desired_range = 1250 * randf() + 750; // 750 til 2000
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performCollect
|
||||
{
|
||||
behaviour = BEHAVIOUR_COLLECT_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performEscort
|
||||
{
|
||||
if(behaviour != BEHAVIOUR_FORMATION_FORM_UP)
|
||||
{
|
||||
behaviour = BEHAVIOUR_FORMATION_FORM_UP;
|
||||
frustration = 0.0; // behavior changed, reset frustration.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) performFaceDestination
|
||||
{
|
||||
behaviour = BEHAVIOUR_FACE_DESTINATION;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performFlee
|
||||
{
|
||||
behaviour = BEHAVIOUR_FLEE_TARGET;
|
||||
|
||||
[self setEvasiveJink:400.0];
|
||||
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performFlyToRangeFromDestination
|
||||
{
|
||||
behaviour = BEHAVIOUR_FLY_RANGE_FROM_DESTINATION;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performHold
|
||||
{
|
||||
desired_speed = 0.0;
|
||||
behaviour = BEHAVIOUR_TRACK_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performIdle
|
||||
{
|
||||
behaviour = BEHAVIOUR_IDLE;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performIntercept
|
||||
{
|
||||
behaviour = BEHAVIOUR_INTERCEPT_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performLandOnPlanet
|
||||
{
|
||||
OOPlanetEntity *nearest = [self findNearestPlanet];
|
||||
if (isNearPlanetSurface)
|
||||
{
|
||||
destination = [nearest position];
|
||||
behaviour = BEHAVIOUR_LAND_ON_PLANET;
|
||||
planetForLanding = [nearest universalID];
|
||||
}
|
||||
else
|
||||
{
|
||||
behaviour = BEHAVIOUR_IDLE;
|
||||
[shipAI message:@"NO_PLANET_NEARBY"];
|
||||
}
|
||||
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performMining
|
||||
{
|
||||
Entity *target = [self primaryTarget];
|
||||
// mining is not seen as hostile behaviour, so ensure it is only used against rocks.
|
||||
if (target && [target scanClass] == CLASS_ROCK)
|
||||
{
|
||||
behaviour = BEHAVIOUR_ATTACK_MINING_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self noteLostTargetAndGoIdle];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) performScriptedAI
|
||||
{
|
||||
behaviour = BEHAVIOUR_SCRIPTED_AI;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performScriptedAttackAI
|
||||
{
|
||||
behaviour = BEHAVIOUR_SCRIPTED_ATTACK_AI;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
@ -334,6 +461,15 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performTumble
|
||||
{
|
||||
stick_roll = max_flight_roll*2.0*(randf() - 0.5);
|
||||
stick_pitch = max_flight_pitch*2.0*(randf() - 0.5);
|
||||
behaviour = BEHAVIOUR_TUMBLE;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) performHyperSpaceToSpecificSystem:(OOSystemID)systemID
|
||||
{
|
||||
return [self performHyperSpaceExitReplace:NO toSystem:systemID];
|
||||
@ -552,13 +688,6 @@
|
||||
desired_range = fmax(maxFlightSpeed / max_flight_pitch / 6, 50.0); // some ships need a longer range to reach a waypoint.
|
||||
}
|
||||
|
||||
- (void) performFlyToRangeFromDestination
|
||||
{
|
||||
behaviour = BEHAVIOUR_FLY_RANGE_FROM_DESTINATION;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) setSpeedTo:(NSString *)speedString
|
||||
{
|
||||
desired_speed = [speedString doubleValue];
|
||||
@ -581,21 +710,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performIdle
|
||||
{
|
||||
behaviour = BEHAVIOUR_IDLE;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performHold
|
||||
{
|
||||
desired_speed = 0.0;
|
||||
behaviour = BEHAVIOUR_TRACK_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) setTargetToPrimaryAggressor
|
||||
{
|
||||
Entity *primeAggressor = [self primaryAggressor];
|
||||
@ -646,14 +760,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performAttack
|
||||
{
|
||||
behaviour = BEHAVIOUR_ATTACK_TARGET;
|
||||
desired_range = 1250 * randf() + 750; // 750 til 2000
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performBroadside
|
||||
{
|
||||
behaviour = BEHAVIOUR_ATTACK_BROADSIDE;
|
||||
@ -852,43 +958,8 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performCollect
|
||||
{
|
||||
behaviour = BEHAVIOUR_COLLECT_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performIntercept
|
||||
{
|
||||
behaviour = BEHAVIOUR_INTERCEPT_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performFlee
|
||||
{
|
||||
behaviour = BEHAVIOUR_FLEE_TARGET;
|
||||
|
||||
[self setEvasiveJink:400.0];
|
||||
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performScriptedAI
|
||||
{
|
||||
behaviour = BEHAVIOUR_SCRIPTED_AI;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) performScriptedAttackAI
|
||||
{
|
||||
behaviour = BEHAVIOUR_SCRIPTED_ATTACK_AI;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) getWitchspaceEntryCoordinates
|
||||
{
|
||||
@ -934,13 +1005,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performFaceDestination
|
||||
{
|
||||
behaviour = BEHAVIOUR_FACE_DESTINATION;
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) fightOrFleeMissile
|
||||
{
|
||||
// find an incoming missile...
|
||||
@ -1063,25 +1127,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performLandOnPlanet
|
||||
{
|
||||
OOPlanetEntity *nearest = [self findNearestPlanet];
|
||||
if (isNearPlanetSurface)
|
||||
{
|
||||
destination = [nearest position];
|
||||
behaviour = BEHAVIOUR_LAND_ON_PLANET;
|
||||
planetForLanding = [nearest universalID];
|
||||
}
|
||||
else
|
||||
{
|
||||
behaviour = BEHAVIOUR_IDLE;
|
||||
[shipAI message:@"NO_PLANET_NEARBY"];
|
||||
}
|
||||
|
||||
frustration = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (void) landOnPlanet
|
||||
{
|
||||
// Selects the nearest planet it can find.
|
||||
@ -1671,16 +1716,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performEscort
|
||||
{
|
||||
if(behaviour != BEHAVIOUR_FORMATION_FORM_UP)
|
||||
{
|
||||
behaviour = BEHAVIOUR_FORMATION_FORM_UP;
|
||||
frustration = 0.0; // behavior changed, reset frustration.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) checkGroupOddsVersusTarget
|
||||
{
|
||||
NSUInteger ownGroupCount = [[self group] count] + (ranrot_rand() & 3); // add a random fudge factor
|
||||
@ -1701,41 +1736,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) groupAttackTarget
|
||||
{
|
||||
NSEnumerator *shipEnum = nil;
|
||||
ShipEntity *target = nil, *ship = nil;
|
||||
|
||||
if ([self primaryTarget] == nil) return;
|
||||
|
||||
if ([self group] == nil) // ship is alone!
|
||||
{
|
||||
[self setFoundTarget:[self primaryTarget]];
|
||||
[shipAI reactToMessage:@"GROUP_ATTACK_TARGET" context:@"groupAttackTarget"];
|
||||
return;
|
||||
}
|
||||
|
||||
target = [self primaryTarget];
|
||||
|
||||
// -memberArray creates a new collection, which is needed because the group might be mutated by the members' AIs.
|
||||
NSArray *groupMembers = [[self group] memberArray];
|
||||
for (shipEnum = [groupMembers objectEnumerator]; (ship = [shipEnum nextObject]); )
|
||||
{
|
||||
[ship setFoundTarget:target];
|
||||
[ship reactToAIMessage:@"GROUP_ATTACK_TARGET" context:@"groupAttackTarget"];
|
||||
if ([ship escortGroup] != [ship group] && [[ship escortGroup] count] > 1) // Ship has a seperate escort group.
|
||||
{
|
||||
ShipEntity *escort = nil;
|
||||
NSEnumerator *shipEnum = nil;
|
||||
NSArray *escortMembers = [[ship escortGroup] memberArrayExcludingLeader];
|
||||
for (shipEnum = [escortMembers objectEnumerator]; (escort = [shipEnum nextObject]); )
|
||||
{
|
||||
[escort setFoundTarget:target];
|
||||
[escort reactToAIMessage:@"GROUP_ATTACK_TARGET" context:@"groupAttackTarget"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) scanForFormationLeader
|
||||
@ -2069,22 +2069,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (void) performMining
|
||||
{
|
||||
Entity *target = [self primaryTarget];
|
||||
// mining is not seen as hostile behaviour, so ensure it is only used against rocks.
|
||||
if (target && [target scanClass] == CLASS_ROCK)
|
||||
{
|
||||
behaviour = BEHAVIOUR_ATTACK_MINING_TARGET;
|
||||
frustration = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self noteLostTargetAndGoIdle];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void) setDestinationToDockingAbort
|
||||
{
|
||||
Entity *the_target = [self targetStation];
|
||||
|
@ -74,6 +74,7 @@ static JSBool ShipFireECM(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipAbandonShip(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipCanAwardEquipment(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipAwardEquipment(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipRequestHelpFromGroup(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipRemoveEquipment(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipRestoreSubEntities(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipEquipmentStatus(JSContext *context, uintN argc, jsval *vp);
|
||||
@ -93,9 +94,26 @@ static JSBool ShipGetShaders(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipBecomeCascadeExplosion(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipBroadcastCascadeImminent(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipOfferToEscort(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipMarkTargetForFines(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipEnterWormhole(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipThrowSpark(JSContext *context, uintN argc, jsval *vp);
|
||||
|
||||
static JSBool ShipPerformAttack(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformCollect(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformEscort(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformFaceDestination(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformFlee(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformFlyToRangeFromDestination(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformHold(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformIdle(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformIntercept(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformLandOnPlanet(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformMining(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformScriptedAI(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformScriptedAttackAI(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformStop(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipPerformTumble(JSContext *context, uintN argc, jsval *vp);
|
||||
|
||||
static BOOL RemoveOrExplodeShip(JSContext *context, uintN argc, jsval *vp, BOOL explode);
|
||||
static JSBool ShipSetMaterialsInternal(JSContext *context, uintN argc, jsval *vp, ShipEntity *thisEnt, BOOL fromShaders);
|
||||
|
||||
@ -391,10 +409,28 @@ static JSFunctionSpec sShipMethods[] =
|
||||
{ "getMaterials", ShipGetMaterials, 0 },
|
||||
{ "getShaders", ShipGetShaders, 0 },
|
||||
{ "hasRole", ShipHasRole, 1 },
|
||||
{ "markTargetForFines", ShipMarkTargetForFines, 0 },
|
||||
{ "offerToEscort", ShipOfferToEscort, 1 },
|
||||
{ "performAttack", ShipPerformAttack, 0 },
|
||||
{ "performCollect", ShipPerformCollect, 0 },
|
||||
{ "performEscort", ShipPerformEscort, 0 },
|
||||
{ "performFaceDestination", ShipPerformFaceDestination, 0 },
|
||||
{ "performFlee", ShipPerformFlee, 0 },
|
||||
{ "performFlyToRangeFromDestination", ShipPerformFlyToRangeFromDestination, 0 },
|
||||
{ "performHold", ShipPerformHold, 0 },
|
||||
{ "performIdle", ShipPerformIdle, 0 },
|
||||
{ "performIntercept", ShipPerformIntercept, 0 },
|
||||
{ "performLandOnPlanet", ShipPerformLandOnPlanet, 0 },
|
||||
{ "performMining", ShipPerformMining, 0 },
|
||||
{ "performScriptedAI", ShipPerformScriptedAI, 0 },
|
||||
{ "performScriptedAttackAI", ShipPerformScriptedAttackAI, 0 },
|
||||
{ "performStop", ShipPerformStop, 0 },
|
||||
{ "performTumble", ShipPerformTumble, 0 },
|
||||
|
||||
{ "reactToAIMessage", ShipReactToAIMessage, 1 },
|
||||
{ "remove", ShipRemove, 0 },
|
||||
{ "removeEquipment", ShipRemoveEquipment, 1 },
|
||||
{ "requestHelpFromGroup", ShipRequestHelpFromGroup, 1},
|
||||
{ "restoreSubEntities", ShipRestoreSubEntities, 0 },
|
||||
{ "__runLegacyScriptActions", ShipRunLegacyScriptActions, 2 }, // Deliberately not documented
|
||||
{ "selectNewMissile", ShipSelectNewMissile, 0 },
|
||||
@ -2668,6 +2704,44 @@ static JSBool ShipOfferToEscort(JSContext *context, uintN argc, jsval *vp)
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipRequestHelpFromGroup(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
|
||||
[thisEnt groupAttackTarget];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipMarkTargetForFines(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
|
||||
ShipEntity *ship = [thisEnt primaryTarget];
|
||||
BOOL ok = NO;
|
||||
if ((ship != nil) && ([ship status] != STATUS_DEAD) && ([ship status] != STATUS_DOCKED))
|
||||
{
|
||||
ok = [ship markForFines];
|
||||
}
|
||||
|
||||
OOJS_RETURN_BOOL(ok);
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipEnterWormhole(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
@ -2717,6 +2791,217 @@ static JSBool ShipThrowSpark(JSContext *context, uintN argc, jsval *vp)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static JSBool ShipPerformAttack(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performAttack];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformCollect(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performCollect];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformEscort(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performEscort];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformFaceDestination(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performFaceDestination];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformFlee(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performFlee];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformFlyToRangeFromDestination(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performFlyToRangeFromDestination];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformHold(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performHold];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformIdle(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performIdle];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformIntercept(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performIntercept];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformLandOnPlanet(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performLandOnPlanet];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformMining(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performMining];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformScriptedAI(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performScriptedAI];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformScriptedAttackAI(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performScriptedAttackAI];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformStop(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performStop];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
static JSBool ShipPerformTumble(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_PROFILE_ENTER
|
||||
|
||||
ShipEntity *thisEnt = nil;
|
||||
GET_THIS_SHIP(thisEnt);
|
||||
[thisEnt performTumble];
|
||||
|
||||
OOJS_RETURN_VOID;
|
||||
|
||||
OOJS_PROFILE_EXIT
|
||||
}
|
||||
|
||||
|
||||
/** Static methods */
|
||||
|
||||
static JSBool ShipStaticKeys(JSContext *context, uintN argc, jsval *vp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user