58static JSBool
ShipGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value);
59static JSBool
ShipSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value);
61static JSBool
ShipSetScript(JSContext *context, uintN argc, jsval *vp);
62static JSBool
ShipSetAI(JSContext *context, uintN argc, jsval *vp);
63static JSBool
ShipSwitchAI(JSContext *context, uintN argc, jsval *vp);
64static JSBool
ShipExitAI(JSContext *context, uintN argc, jsval *vp);
68static JSBool
ShipDockEscorts(JSContext *context, uintN argc, jsval *vp);
69static JSBool
ShipHasRole(JSContext *context, uintN argc, jsval *vp);
70static JSBool
ShipEjectItem(JSContext *context, uintN argc, jsval *vp);
72static JSBool
ShipDumpCargo(JSContext *context, uintN argc, jsval *vp);
74static JSBool
ShipSpawn(JSContext *context, uintN argc, jsval *vp);
76static JSBool
ShipExplode(JSContext *context, uintN argc, jsval *vp);
77static JSBool
ShipRemove(JSContext *context, uintN argc, jsval *vp);
80static JSBool
ShipFireECM(JSContext *context, uintN argc, jsval *vp);
81static JSBool
ShipAbandonShip(JSContext *context, uintN argc, jsval *vp);
84static JSBool
ShipAdjustCargo(JSContext *context, uintN argc, jsval *vp);
94static JSBool
ShipFireMissile(JSContext *context, uintN argc, jsval *vp);
96static JSBool
ShipSetBounty(JSContext *context, uintN argc, jsval *vp);
97static JSBool
ShipSetCargo(JSContext *context, uintN argc, jsval *vp);
99static JSBool
ShipSetShaders(JSContext *context, uintN argc, jsval *vp);
100static JSBool
ShipExitSystem(JSContext *context, uintN argc, jsval *vp);
108static JSBool
ShipGetShaders(JSContext *context, uintN argc, jsval *vp);
116static JSBool
ShipThrowSpark(JSContext *context, uintN argc, jsval *vp);
122static JSBool
ShipPerformFlee(JSContext *context, uintN argc, jsval *vp);
124static JSBool
ShipPerformHold(JSContext *context, uintN argc, jsval *vp);
125static JSBool
ShipPerformIdle(JSContext *context, uintN argc, jsval *vp);
131static JSBool
ShipPerformStop(JSContext *context, uintN argc, jsval *vp);
144static JSBool
ShipSetCrew(JSContext *context, uintN argc, jsval *vp);
150static JSBool
ShipStaticKeys(JSContext *context, uintN argc, jsval *vp);
151static JSBool
ShipStaticRoles(JSContext *context, uintN argc, jsval *vp);
169 JSCLASS_NO_OPTIONAL_MEMBERS
607static JSBool
ShipGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value)
609 if (!JSID_IS_INT(propID))
return YES;
616 if (
EXPECT_NOT(!JSShipGetShipEntity(context,
this, &entity)))
return NO;
619 switch (JSID_TO_INT(propID))
622 result = [entity
name];
670 return JS_NewNumberValue(context, [entity realAlertCondition], value);
681 return JS_NewNumberValue(context, [entity accuracy], value);
684 return JS_NewNumberValue(context, [entity fuel] * 0.1, value);
687 return JS_NewNumberValue(context, [entity fuelChargeRate], value);
690 return JS_NewNumberValue(context, [entity bounty], value);
706 return JS_NewNumberValue(context, [entity maxShipSubEntities], value);
726 while ((target = [[defTargets nextObject] weakRefUnderlyingObject]))
728 [result addObject:target];
742 result = [entity
group];
753 return JS_NewNumberValue(context, [entity heatInsulation], value);
759 return JS_NewNumberValue(context, [entity energyRechargeRate], value);
762 *value = INT_TO_JSVAL([entity entityPersonalityInt]);
806 return JS_NewNumberValue(context, [entity hyperspaceSpinTime], value);
809 return JS_NewNumberValue(context, [entity weaponRange], value);
812 if ([entity isPlayer])
815 return JS_NewNumberValue(context, [pent availableFacings], value);
817 return JS_NewNumberValue(context, [entity weaponFacings], value);
837 return JS_NewNumberValue(context, [entity scannerRange], value);
840 return JS_NewNumberValue(context, [entity reactionTime], value);
851 *value = INT_TO_JSVAL([entity maxAvailableCargoSpace]);
855 *value = INT_TO_JSVAL([entity maxAvailableCargoSpace] - [entity availableCargoSpace]);
859 *value = INT_TO_JSVAL([entity availableCargoSpace]);
867 return JS_NewNumberValue(context, [entity extraCargo], value);
871 if ([entity commodityAmount] > 0)
878 *value = INT_TO_JSVAL([entity commodityAmount]);
887 return JS_NewNumberValue(context, [entity flightSpeed], value);
890 return JS_NewNumberValue(context, [entity cruiseSpeed], value);
897 return JS_NewNumberValue(context, [entity desiredRange], value);
900 return JS_NewNumberValue(context, [entity desiredSpeed], value);
910 return JS_NewNumberValue(context, [entity maxEscortCount], value);
913 return JS_NewNumberValue(context, [entity maxFlightPitch], value);
916 return JS_NewNumberValue(context, [entity maxFlightSpeed], value);
919 return JS_NewNumberValue(context, [entity maxFlightRoll], value);
922 return JS_NewNumberValue(context, [entity maxFlightYaw], value);
925 return JS_NewNumberValue(context, [entity afterburnerRate], value);
928 return JS_NewNumberValue(context, [entity afterburnerFactor], value);
939 return JS_NewNumberValue(context, [entity shipAIScriptWakeTime], value);
943 return JS_NewNumberValue(context, [entity destinationSystem], value);
947 return JS_NewNumberValue(context, [entity homeSystem], value);
999 if ([entity isPlayer])
1005 *value =
OOJSValueFromBOOL([entity behaviour] == BEHAVIOUR_FLEE_TARGET || [entity behaviour] == BEHAVIOUR_FLEE_EVASIVE_ACTION);
1010 *value =
OOJSValueFromBOOL([entity scanClass] == CLASS_CARGO && [entity commodityAmount] > 0);
1026 return JS_NewNumberValue(context, [entity scriptedMisjumpRange], value);
1030 if (result ==
nil) result = [NSDictionary dictionary];
1034 return JS_NewNumberValue(context, [entity sunGlareFilter], value);
1041 return JS_NewNumberValue(context, [entity passengerCount], value);
1044 return JS_NewNumberValue(context, [entity parcelCount], value);
1047 return JS_NewNumberValue(context, [entity passengerCapacity], value);
1050 return JS_NewNumberValue(context, [entity missileCapacity], value);
1053 return JS_NewNumberValue(context, [entity missileLoadTime], value);
1083 return JS_NewNumberValue(context, [entity laserHeatLevel], value);
1086 return JS_NewNumberValue(context, [entity laserHeatLevelAft], value);
1089 return JS_NewNumberValue(context, [entity laserHeatLevelForward], value);
1092 return JS_NewNumberValue(context, [entity laserHeatLevelPort], value);
1095 return JS_NewNumberValue(context, [entity laserHeatLevelStarboard], value);
1138 return JS_NewNumberValue(context, [entity maxThrust], value);
1141 return JS_NewNumberValue(context, [entity thrust], value);
1163 return JS_NewNumberValue(context, [entity flightPitch], value);
1166 return JS_NewNumberValue(context, [entity flightRoll], value);
1169 return JS_NewNumberValue(context, [entity flightYaw], value);
1176 if ([entity isSubEntity])
1184 bounding_box_get_dimensions(box,&bbvect.x,&bbvect.y,&bbvect.z);
1200static JSBool
ShipSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value)
1202 if (!JSID_IS_INT(propID))
return YES;
1208 NSString *sValue =
nil;
1219 if (
EXPECT_NOT(!JSShipGetShipEntity(context,
this, &entity)))
return NO;
1222 NSCAssert(![entity isTemplateCargoPod],
@"-OOJSShip: a template cargo pod has become accessible to Javascript");
1224 switch (JSID_TO_INT(propID))
1227 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1238 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1274 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1285 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1296 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1299 if ([sValue length] == 0)
1301 if ([entity isBeacon])
1303 [UNIVERSE clearBeacon:entity];
1304 if ([
PLAYER nextBeacon] == entity)
1306 [PLAYER setCompassMode:COMPASS_MODE_PLANET];
1312 if ([entity isBeacon])
1319 [UNIVERSE setNextBeacon:entity];
1326 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1336 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1338 if (JS_ValueToNumber(context, *value, &fValue))
1346 if (JS_ValueToNumber(context, *value, &fValue))
1349 [entity
setFuel:lround(fValue * 10.0)];
1355 if (JS_ValueToInt32(context, *value, &iValue))
1367 if (JS_ValueToNumber(context, *value, &fValue))
1375 if (JS_ValueToInt32(context, *value, &iValue))
1377 if (iValue < 0) iValue = 0;
1384 if (JS_ValueToInt32(context, *value, &iValue))
1386 if (iValue < 0) iValue = 0;
1389 if ([entity maxAvailableCargoSpace] < [entity availableCargoSpace])
1393 else if ((
OOCargoQuantity)iValue < [entity maxAvailableCargoSpace] - [entity availableCargoSpace])
1404 if (JS_ValueToInt32(context, *value, &iValue))
1406 if (iValue < 0) iValue = 0;
1413 if (JS_ValueToInt32(context, *value, &iValue))
1415 if (iValue < 0) iValue = 0;
1422 if (JSVAL_IS_NULL(*value))
1435 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1437 if (JSVAL_IS_NULL(*value))
1450 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1452 if (JSVAL_IS_NULL(*value))
1466 if (group !=
nil || JSVAL_IS_NULL(*value))
1474 if (JS_ValueToNumber(context, *value, &fValue))
1482 if (JS_ValueToNumber(context, *value, &fValue))
1484 fValue = fmax(fValue, 0.0);
1491 if (JS_ValueToNumber(context, *value, &fValue))
1493 fValue = fmax(fValue, 0.125);
1500 if (JS_ValueToBoolean(context, *value, &bValue))
1508 if (JS_ValueToBoolean(context, *value, &bValue))
1516 if (JS_ValueToNumber(context, *value, &fValue))
1524 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1526 if (JS_ValueToNumber(context, *value, &fValue))
1534 if (JS_ValueToBoolean(context, *value, &bValue))
1542 if (JS_ValueToBoolean(context, *value, &bValue))
1550 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1552 if (JS_ValueToBoolean(context, *value, &bValue))
1560 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1572 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1574 if (JS_ValueToNumber(context, *value, &fValue))
1582 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1584 if (JS_ValueToNumber(context, *value, &fValue))
1601 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
1610 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
1619 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
1628 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
1637 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
1645 if (JS_ValueToBoolean(context, *value, &bValue))
1653 if (JS_ValueToNumber(context, *value, &fValue))
1655 if (fValue > 0.0 && fValue < 1.0)
1678 if (JS_ValueToNumber(context, *value, &fValue))
1680 if (fValue >= 0.0f && fValue <= 1.0f)
1696 if (JS_ValueToNumber(context, *value, &fValue))
1704 if (JS_ValueToNumber(context, *value, &fValue))
1718 if (JS_ValueToNumber(context, *value, &fValue))
1731 if (JS_ValueToNumber(context, *value, &fValue))
1744 if (JS_ValueToNumber(context, *value, &fValue))
1757 if (JS_ValueToNumber(context, *value, &fValue))
1761 OOJSReportError(context,
@"ship.injectorBurnRate cannot be negative.");
1770 if (JS_ValueToNumber(context, *value, &fValue))
1774 OOJSReportError(context,
@"ship.injectorSpeedFactor cannot be less than 1.0.");
1777#if OO_VARIABLE_TORUS_SPEED
1795 if (JS_ValueToNumber(context, *value, &fValue))
1808 if (JS_ValueToNumber(context, *value, &fValue))
1812 OOJSReportError(context,
@"ship.energyRechargeRate cannot be negative.");
1822 if (JS_ValueToBoolean(context, *value, &bValue))
1846 sValue =
@"EQ_WEAPON_NONE";
1849 switch (JSID_TO_INT(propID))
1867 if ([entity isPlayer])
1879 if (
EXPECT_NOT([entity isPlayer]))
goto playerReadOnly;
1881 if (JS_ValueToInt32(context, *value, &iValue))
1883 if ((NSInteger)iValue < (NSInteger)[[entity escortGroup]
count] - 1)
1925#define GET_THIS_SHIP(THISENT) do { \
1926 if (EXPECT_NOT(!JSShipGetShipEntity(context, OOJS_THIS, &THISENT))) return NO; \
1927 if (OOIsStaleEntity(THISENT)) OOJS_RETURN_VOID; \
1937 NSString *name =
nil;
1960static JSBool
ShipSetAI(JSContext *context, uintN argc, jsval *vp)
1965 NSString *name =
nil;
1993 NSString *name =
nil;
2016static JSBool
ShipExitAI(JSContext *context, uintN argc, jsval *vp)
2022 NSString *message =
nil;
2030 thisAI = [thisEnt
getAI];
2032 if ([thisAI hasSuspendedStateMachines])
2044 OOJSReportWarningForCaller(context,
@"Ship",
@"exitAI()",
@"Cannot exit current AI state machine because there are no suspended state machines.");
2058 NSString *message =
nil;
2086 NSString *message =
nil;
2146 NSString *equipment =
nil;
2169 NSString *role =
nil;
2192 NSString *role =
nil;
2215 JSBool procEvents = NO;
2216 JSBool procMessages = NO;
2228 !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target)))
2233 if ([target scanClass] != CLASS_CARGO)
2238 if ([target status] != STATUS_IN_FLIGHT)
2271 NSString *itemKey =
nil;
2313 BOOL gotCount = YES;
2314 if (argc > 0) gotCount = JS_ValueToInt32(context,
OOJS_ARGV[0], &
count);
2321 for (i = 1; i <
count; i++)
2323 [thisEnt performSelector:@selector(dumpCargo) withObject:nil afterDelay:0.75 * i];
2334static JSBool
ShipSpawn(JSContext *context, uintN argc, jsval *vp)
2339 NSString *role =
nil;
2341 BOOL gotCount = YES;
2342 NSArray *result =
nil;
2347 if (argc > 1) gotCount = JS_ValueToInt32(context,
OOJS_ARGV[1], &
count);
2370 jsdouble baseDamage;
2372 jsdouble velocityBias = 0.0;
2384 gotDamage = JS_ValueToNumber(context,
OOJS_ARGV[0], &baseDamage);
2385 if (
EXPECT_NOT(!gotDamage || baseDamage < 0))
2390 gotRange = JS_ValueToNumber(context,
OOJS_ARGV[1], &range);
2398 gotVBias = JS_ValueToNumber(context,
OOJS_ARGV[2], &velocityBias);
2426static JSBool
ShipRemove(JSContext *context, uintN argc, jsval *vp)
2431 JSBool suppressDeathEvent = NO;
2435 if ([thisEnt isPlayer])
2441 if (argc > 0 &&
EXPECT_NOT(!JS_ValueToBoolean(context,
OOJS_ARGV[0], &suppressDeathEvent)))
2449 if (suppressDeathEvent)
2467 NSArray *actions =
nil;
2475 !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target) ||
2476 ![actions isKindOfClass:[NSArray
class]]))
2487 withContextName:[NSString stringWithFormat:@"<ship \"%@\" legacy actions>", [thisEnt
name]]
2503 NSString *message =
nil;
2519 else if (target !=
nil)
2542 OOJSReportWarning(context,
@"Ship %@ was requested to fire ECM burst but does not carry ECM equipment.", [thisEnt oo_jsDescription]);
2571 NSString *key =
nil;
2572 NSString *ctx =
@"scripted";
2590 if (![ctx isEqualToString:
@"scripted"] && ![ctx isEqualToString:
@"purchase"] && ![ctx isEqualToString:
@"newShip"] && ![ctx isEqualToString:
@"npc"])
2599 if ([key isEqualToString:
@"EQ_FUEL"]) result = NO;
2622 NSString *identifier =
nil;
2638 berth = [identifier isEqualToString:@"EQ_PASSENGER_BERTH"];
2643 else if ([identifier isEqualToString:
@"EQ_FUEL"])
2654 if ([thisEnt isPlayer])
2658 if ([identifier isEqualToString:
@"EQ_MISSILE_REMOVAL"])
2662 else if ([eqType isMissileOrMine])
2670 else if ([identifier isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"])
2676 isRepair = [thisEnt
hasEquipmentItem:[identifier stringByAppendingString:@"_DAMAGED"]];
2686 if ([identifier isEqualToString:
@"EQ_MISSILE_REMOVAL"])
2691 else if (!berth && ![identifier isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"])
2714 NSString *key =
nil;
2730 key = [key stringByAppendingString:@"_DAMAGED"];
2736 if ([key isEqualToString:
@"EQ_PASSENGER_BERTH"] || [key isEqualToString:
@"EQ_CARGO_BAY"])
2738 if ([key isEqualToString:
@"EQ_PASSENGER_BERTH"])
2740 if ([thisEnt passengerCapacity] > [thisEnt passengerCount])
2750 if ([thisEnt isPlayer] || [thisEnt extraCargo] <= [thisEnt availableCargoSpace])
2773 NSUInteger numSubEntitiesRestored = 0U;
2782 if ([[thisEnt subEntitiesForScript]
count] - subCount > 0) numSubEntitiesRestored = [[thisEnt
subEntitiesForScript] count] - subCount;
2785 if ([thisEnt isPlayer])
2807 NSString *key =
nil;
2808 NSString *damagedKey =
nil;
2809 NSString *status =
nil;
2810 BOOL hasOK = NO, hasDamaged = NO;
2835 if (![status isEqualToString:
@"EQUIPMENT_OK"] && ![status isEqualToString:
@"EQUIPMENT_DAMAGED"])
2837 OOJSReportErrorForCaller(context,
@"Ship",
@"setEquipmentStatus",
@"Second parameter for setEquipmentStatus must be either \"EQUIPMENT_OK\
" or \"EQUIPMENT_DAMAGED\".");
2843 BOOL setOK = [status isEqualToString:@"EQUIPMENT_OK"];
2844 BOOL setDamaged = [status isEqualToString:@"EQUIPMENT_DAMAGED"];
2845 if ([eqType canBeDamaged])
2847 damagedKey = [key stringByAppendingString:@"_DAMAGED"];
2850 if ((setOK && hasDamaged) || (setDamaged && hasOK))
2854 if ([thisEnt isPlayer])
2880 if (hasOK && ![status isEqualToString:
@"EQUIPMENT_OK"])
2903 static jsval strOK, strDamaged, strUnavailable, strUnknown;
2904 static BOOL inited = NO;
2908 strOK = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_OK"));
2909 strDamaged = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_DAMAGED"));
2910 strUnavailable = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_UNAVAILABLE"));
2911 strUnknown = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_UNKNOWN"));
2915 NSString *key =
nil;
2917 NSDictionary *dict =
nil;
2922 if (argc > 1) JS_ValueToBoolean(context,
OOJS_ARGV[1], &asDict);
2925 if (argc > 0 && JSVAL_IS_STRING(
OOJS_ARGV[0]))
2929 dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:1],@"EQUIPMENT_UNKNOWN",nil];
2945 dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:[thisEnt
countEquipmentItem:key]],@"EQUIPMENT_OK",[NSNumber numberWithUnsignedInteger:[thisEnt
countEquipmentItem:[key stringByAppendingString:@"_DAMAGED"]]],@"EQUIPMENT_DAMAGED",nil];
2950 if ([thisEnt hasEquipmentItem:key includeWeapons:YES whileLoading:NO])
OOJS_RETURN(strOK);
2951 else if ([thisEnt hasEquipmentItem:[key stringByAppendingString:
@"_DAMAGED"]])
OOJS_RETURN(strDamaged);
2970 if (result ==
nil) result =
@"EQ_MISSILE";
3007 double sdist, distance = 1E32;
3009 NSEnumerator *statEnum = [[UNIVERSE stations] objectEnumerator];
3011 while ((se = [statEnum nextObject]))
3013 sdist = HPdistance2([thisEnt position],[se position]);
3015 if (sdist < distance)
3034 NSString *reason =
nil;
3035 int32 newbounty = 0;
3036 BOOL gotBounty = YES;
3040 if (argc > 0) gotBounty = JS_ValueToInt32(context,
OOJS_ARGV[0], &newbounty);
3042 if (
EXPECT_NOT(reason ==
nil || !gotBounty || newbounty < 0))
3064 BOOL gotCount = YES;
3069 if (argc > 1) gotCount = JS_ValueToInt32(context,
OOJS_ARGV[1], &
count);
3076 if ([[
UNIVERSE commodities] goodDefined:commodity])
3095 NSDictionary *crewDefinition =
nil;
3096 JSObject *params = NULL;
3100 if (argc < 1 || (!JSVAL_IS_NULL(
OOJS_ARGV[0]) && !JS_ValueToObject(context,
OOJS_ARGV[0], ¶ms)))
3107 if (![thisEnt isExplicitlyUnpiloted])
3117 [thisEnt
setCrew:[NSArray arrayWithObject:crew]];
3137 NSString *cargoType =
nil;
3149 OOJSReportBadArguments(context,
@"Ship",
@"setCargoType", argc,
OOJS_ARGV,
nil, [NSString stringWithFormat:
@"Can only be used on cargo pod carriers, not cargo pods (%@)",[thisEnt shipDataKey]]);
3153 if ([cargoType isEqualToString:
@"SCARCE_GOODS"])
3157 else if ([cargoType isEqualToString:
@"PLENTIFUL_GOODS"])
3161 else if ([cargoType isEqualToString:
@"MEDICAL_GOODS"])
3165 else if ([cargoType isEqualToString:
@"ILLEGAL_GOODS"])
3169 else if ([cargoType isEqualToString:
@"PIRATE_GOODS"])
3236 JSObject *params = NULL;
3237 NSDictionary *materials;
3238 NSDictionary *shaders;
3239 BOOL withShaders = NO;
3289 smooth:[shipDict oo_boolForKey:@"smooth" defaultValue:NO]
3312 int32 systemID = -1;
3324 if (!JS_ValueToInt32(context,
OOJS_ARGV[0], &systemID) || systemID < 0 || 255 < systemID)
3345 [thisEnt updateEscortFormation];
3362 NSCAssert(explode,
@"RemoveOrExplodeShip(): shouldn't be called for player with !explode.");
3365 if ([player isDocked])
3367 OOJSReportError(context,
@"Cannot explode() player's ship while docked.");
3375 [UNIVERSE unMagicMainStation];
3378 if (
EXPECT_NOT([thisEnt status] == STATUS_DOCKED))
3383 [thisEnt setStatus:STATUS_DEAD];
3391 [thisEnt setSuppressExplosion:!explode];
3392 [thisEnt setEnergy:1];
3393 [thisEnt takeEnergyDamage:500000000.0 from:nil becauseOf:nil weaponIdentifier:@""];
3407 [thisEnt removeAllDefenseTargets];
3423 if (
EXPECT_NOT(argc == 0 || (argc > 0 && (JSVAL_IS_NULL(
OOJS_ARGV[0]) || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target)))))
3429 [thisEnt addDefenseTarget:target];
3445 if (
EXPECT_NOT(argc == 0 || (argc > 0 && (JSVAL_IS_NULL(
OOJS_ARGV[0]) || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target)))))
3451 [thisEnt removeDefenseTarget:target];
3467 if (
EXPECT_NOT(argc == 0 || (argc > 0 && (JSVAL_IS_NULL(
OOJS_ARGV[0]) || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target)))))
3476 [thisEnt addCollisionException:target];
3493 if (
EXPECT_NOT(argc == 0 || (argc > 0 && (JSVAL_IS_NULL(
OOJS_ARGV[0]) || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target)))))
3500 [thisEnt removeCollisionException:target];
3515 NSObject *result =
nil;
3519 result = [[thisEnt mesh] materials];
3520 if (result ==
nil) result = [NSDictionary dictionary];
3532 NSObject *result =
nil;
3536 result = [[thisEnt mesh] shaders];
3537 if (result ==
nil) result = [NSDictionary dictionary];
3549 [thisEnt broadcastEnergyBlastImminent];
3562 [thisEnt becomeEnergyBlast];
3578 if (
EXPECT_NOT(argc == 0 || (argc > 0 && (JSVAL_IS_NULL(
OOJS_ARGV[0]) || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &mother)))))
3584 BOOL result = [thisEnt suggestEscortTo:mother];
3600 [thisEnt groupAttackTarget];
3616 if (
EXPECT_NOT(argc == 0 || (argc > 0 && (JSVAL_IS_NULL(
OOJS_ARGV[0]) || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target)))))
3621 if ([target isStation])
3643 if ((ship !=
nil) && ([ship status] != STATUS_DEAD) && ([ship status] != STATUS_DOCKED))
3661 if ([
PLAYER status] != STATUS_ENTERING_WITCHSPACE)
3663 OOJSReportError(context,
@"Cannot use this function while player's ship not entering witchspace.");
3670 [thisEnt enterPlayerWormhole];
3674 if (![hole isWormhole])
3680 [thisEnt enterWormhole:(WormholeEntity*)hole];
3696 [thisEnt wormholeEntireGroup];
3710 [thisEnt setThrowSparks:YES];
3725 [thisEnt performAttack];
3739 [thisEnt performCollect];
3753 [thisEnt performEscort];
3767 [thisEnt performFaceDestination];
3781 [thisEnt performFlee];
3795 [thisEnt performFlyToRangeFromDestination];
3809 [thisEnt performHold];
3823 [thisEnt performIdle];
3837 [thisEnt performIntercept];
3851 [thisEnt performLandOnPlanet];
3865 [thisEnt performMining];
3879 [thisEnt performScriptedAI];
3893 [thisEnt performScriptedAttackAI];
3907 [thisEnt performStop];
3921 [thisEnt performTumble];
3935 [thisEnt requestDockingCoordinates];
3937 NSDictionary *dockingInstructions = [thisEnt dockingInstructions];
3938 if (dockingInstructions !=
nil)
3957 [thisEnt recallDockingInstructions];
3959 NSDictionary *dockingInstructions = [thisEnt dockingInstructions];
3960 if (dockingInstructions !=
nil)
3979 [thisEnt broadcastDistressMessageWithDumping:NO];
3994 Entity *hazard = [UNIVERSE hazardOnRouteFromEntity:thisEnt toDistance:[thisEnt desiredRange] fromPoint:[thisEnt destination]];
4009 HPVector waypoint = [UNIVERSE getSafeVectorFromEntity:thisEnt toDistance:[thisEnt desiredRange] fromPoint:[thisEnt destination]];
4023 JSBool onlyCheckPowered = NO;
4033 if (onlyCheckPowered)
4035 [thisEnt checkScannerIgnoringUnpowered];
4039 [thisEnt checkScanner];
4041 ShipEntity **scannedShips = [thisEnt scannedShips];
4042 unsigned num = [thisEnt numberOfScannedShips];
4043 NSMutableArray *scanResult = [NSMutableArray array];
4044 for (
unsigned i = 0; i < num ; i++)
4046 [scanResult addObject:scannedShips[i]];
4059 NSString *commodity =
@"";
4060 int32 adjustment = 0;
4071 if (!JS_ValueToInt32(context,
OOJS_ARGV[1], &adjustment))
4079 OOJSReportError(context,
@"ship.adjustCargo may only be used on NPC cargo carriers");
4087 NSArray *cargo = [UNIVERSE getContainersOfCommodity:commodity :adjustment];
4088 ok = [thisEnt addCargo:cargo];
4090 else if (adjustment < 0)
4093 ok = [thisEnt removeCargo:commodity amount:r];
4114 if ([thisEnt missileCapacity] > 0 && [[thisEnt missilesList]
count] == 0)
4120 if ([thisEnt hasFuelInjection] && [thisEnt fuel] < 35)
4140 JSBool fullCheck = NO;
4150 double assessment = 2.5;
4152 GLfloat maxspeed = [thisEnt maxFlightSpeed];
4153 assessment += (maxspeed-300)/1000;
4156 assessment += (maxspeed-200)/500;
4161 assessment += ([thisEnt maxEnergy]-200)/1000;
4166 if ([thisEnt missileCapacity] > 2)
4172 assessment += ((double)[thisEnt missileCapacity])/5.0;
4179 assessment += [thisEnt turretCount];
4184 if ([thisEnt isPlayer])
4186 double score = (double)[
PLAYER score];
4191 assessment += pow(score,0.33)/10;
4196 assessment += [thisEnt accuracy]/5;
4200 OOWeaponType wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_FORWARD strict:NO];
4210 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_AFT strict:NO];
4216 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_PORT strict:NO];
4221 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_STARBOARD strict:NO];
4228 if ([thisEnt hasECM])
4232 if ([thisEnt hasFuelInjection])
4241 if ([thisEnt isThargoid])
4244 if ([thisEnt hasRole:
@"thargoid-mothership"])
4252 if ([thisEnt weaponFacings] == 1)
4265 if ([thisEnt behaviour] == BEHAVIOUR_FLEE_TARGET || [thisEnt behaviour] == BEHAVIOUR_FLEE_EVASIVE_ACTION)
4275 if (assessment < 0.1)
4302 NSArray *keys = [registry
shipKeys];
#define OOJS_PROFILE_EXIT
#define OOJS_END_FULL_NATIVE
#define OOJS_BEGIN_FULL_NATIVE(context)
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_PROFILE_ENTER
BOOL JSValueToEntity(JSContext *context, jsval value, Entity **outEntity)
OOINLINE BOOL OOIsStaleEntity(Entity *entity)
OOINLINE JSClass * JSEntityClass(void)
OOINLINE JSObject * JSEntityPrototype(void)
OOEquipmentType * JSValueToEquipmentType(JSContext *context, jsval value)
NSString * JSValueToEquipmentKeyRelaxed(JSContext *context, jsval value, BOOL *outExists)
NSString * JSValueToEquipmentKey(JSContext *context, jsval value)
PlayerEntity * OOPlayerForScripting(void)
BOOL JSValueToQuaternion(JSContext *context, jsval value, Quaternion *outQuaternion) NONNULL_FUNC
BOOL QuaternionToJSValue(JSContext *context, Quaternion quaternion, jsval *outValue) NONNULL_FUNC
static JSBool ShipPerformCollect(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRemoveDefenseTarget(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPatrolReportIn(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipCheckCourseToDestination(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipExitSystem(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformFlyToRangeFromDestination(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformEscort(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSwitchAI(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipThreatAssessment(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipHasRole(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipAbandonShip(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRestoreSubEntities(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipExitAI(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformMining(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSelectNewMissile(JSContext *context, uintN argc, jsval *vp)
@ kShip_weaponPositionPort
@ kShip_hyperspaceSpinTime
@ kShip_collisionExceptions
@ kShip_subEntityCapacity
@ kShip_potentialCollider
@ kShip_exhaustEmissiveColor
@ kShip_injectorSpeedFactor
@ kShip_laserHeatLevelAft
@ kShip_AIPrimaryAggressor
@ kShip_weaponPositionForward
@ kShip_scannerDisplayColor2
@ kShip_laserHeatLevelPort
@ kShip_weaponPositionAft
@ kShip_scannerDisplayColor1
@ kShip_hasHyperspaceMotor
@ kShip_cargoSpaceCapacity
@ kShip_scannerHostileDisplayColor2
@ kShip_weaponPositionStarboard
@ kShip_scriptedMisjumpRange
@ kShip_laserHeatLevelStarboard
@ kShip_withinStationAegis
@ kShip_cargoSpaceAvailable
@ kShip_laserHeatLevelForward
@ kShip_passengerCapacity
@ kShip_scannerHostileDisplayColor1
@ kShip_energyRechargeRate
@ kShip_trackCloseContacts
@ kShip_destinationSystem
@ kShip_entityPersonality
@ kShip_dockingInstructions
@ kShip_subEntityRotation
void InitOOJSShip(JSContext *context, JSObject *global)
static JSBool ShipThrowSpark(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipUpdateEscortFormation(JSContext *context, uintN argc, jsval *vp)
JSObject * JSShipPrototype(void)
static JSBool ShipSetCargo(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformFaceDestination(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetShaders(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetMaterials(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSendAIMessage(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipBroadcastCascadeImminent(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipFindNearestStation(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSpawn(JSContext *context, uintN argc, jsval *vp)
#define GET_THIS_SHIP(THISENT)
static JSBool ShipGetShaders(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformScriptedAttackAI(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipHasEquipmentProviding(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipExplode(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipCommsMessage(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipDamageAssessment(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRemove(JSContext *context, uintN argc, jsval *vp)
static JSFunctionSpec sShipStaticMethods[]
static JSBool ShipClearDefenseTargets(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipDealEnergyDamage(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipEquipmentStatus(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformHold(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipFireMissile(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipAddCargoEntity(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRequestHelpFromGroup(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipBecomeCascadeExplosion(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipCanAwardEquipment(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipStaticKeysForRole(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipNotifyGroupOfWormhole(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetCargoType(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipDockEscorts(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformFlee(JSContext *context, uintN argc, jsval *vp)
static JSFunctionSpec sShipMethods[]
static JSClass sShipClass
static JSBool ShipStaticKeys(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipDumpCargo(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSBool ShipSetMaterialsInternal(JSContext *context, uintN argc, jsval *vp, ShipEntity *thisEnt, BOOL fromShaders)
static JSBool ShipMarkTargetForFines(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipReactToAIMessage(JSContext *context, uintN argc, jsval *vp)
static JSPropertySpec sShipProperties[]
static JSBool ShipSetEquipmentStatus(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetScript(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformLandOnPlanet(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipStaticShipDataForKey(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformIdle(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipFireECM(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipCheckScanner(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipStaticRoleIsInCategory(JSContext *context, uintN argc, jsval *vp)
static JSObject * sShipPrototype
static JSBool ShipPerformIntercept(JSContext *context, uintN argc, jsval *vp)
static double ShipThreatAssessmentWeapon(OOWeaponType wt)
static JSBool ShipStaticRoles(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipEjectSpecificItem(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetCrew(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRemoveCollisionException(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipAddDefenseTarget(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipAddCollisionException(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipAwardEquipment(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipDeployEscorts(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformStop(JSContext *context, uintN argc, jsval *vp)
static BOOL RemoveOrExplodeShip(JSContext *context, uintN argc, jsval *vp, BOOL explode)
static JSBool ShipGetMaterials(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRequestDockingInstructions(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipSetBounty(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipGetSafeCourseToDestination(JSContext *context, uintN argc, jsval *vp)
JSClass * JSShipClass(void)
static JSBool ShipSetAI(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipEnterWormhole(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipEjectItem(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformScriptedAI(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipStaticSetShipDataForKey(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformAttack(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRemoveEquipment(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipBroadcastDistressMessage(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRunLegacyScriptActions(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool ShipOfferToEscort(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipRecallDockingInstructions(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipPerformTumble(JSContext *context, uintN argc, jsval *vp)
static JSBool ShipAdjustCargo(JSContext *context, uintN argc, jsval *vp)
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
BOOL HPVectorToJSValue(JSContext *context, HPVector vector, jsval *outValue) NONNULL_FUNC
BOOL JSValueToHPVector(JSContext *context, jsval value, HPVector *outVector) NONNULL_FUNC
BOOL VectorToJSValue(JSContext *context, Vector vector, jsval *outValue) NONNULL_FUNC
id OOJSNativeObjectFromJSValue(JSContext *context, jsval value)
void OOJSReportWarning(JSContext *context, NSString *format,...)
NSString * OOStringFromJSPropertyIDAndSpec(JSContext *context, jsid propID, JSPropertySpec *propertySpec)
#define OOJS_PROP_READWRITE_CB
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
#define OOJS_RETURN_DOUBLE(value)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
id OOJSNativeObjectFromJSObject(JSContext *context, JSObject *object)
#define DEFINE_JS_OBJECT_GETTER(NAME, JSCLASS, JSPROTO, OBJCCLASSNAME)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
#define OOJS_RETURN_OBJECT(o)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
void OOJSReportWarningForCaller(JSContext *context, NSString *scriptClass, NSString *function, NSString *format,...)
#define OOJS_RETURN_BOOL(v)
void OOJSReportErrorForCaller(JSContext *context, NSString *scriptClass, NSString *function, NSString *format,...)
id OOJSNativeObjectOfClassFromJSValue(JSContext *context, jsval value, Class requiredClass)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
void OOJSRegisterSubclass(JSClass *subclass, JSClass *superclass)
void OOJSReportError(JSContext *context, NSString *format,...)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC
NSString * OOStringFromJSValueEvenIfNull(JSContext *context, jsval value)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define OOJS_RETURN_HPVECTOR(value)
#define OOJS_PROP_READONLY_CB
#define OOJS_RETURN_INT(v)
NSString * OOCommodityType
@ WEAPON_FACING_STARBOARD
#define PLAYER_SHIP_SUBENTITY_TRADE_IN_VALUE
#define HYPERSPEED_FACTOR
#define MIN_HYPERSPEED_FACTOR
BOOL isWeaponNone(OOWeaponType weapon)
#define ENTITY_PERSONALITY_MAX
#define SHIP_MAX_CABIN_TEMP
void exitStateMachineWithMessage:(NSString *message)
void setState:(NSString *stateName)
OOCharacter * characterWithDictionary:(NSDictionary *c_dict)
OOColor * colorWithDescription:(id description)
NSArray * normalizedArray()
GLfloat weaponThreatAssessment()
OOCargoQuantity requiredCargoSpace()
OOMaterial * materials[kOOMeshMaxMaterials]
instancetype meshWithName:cacheKey:materialDictionary:shadersDictionary:smooth:shaderMacros:shaderBindingTarget:(NSString *name,[cacheKey] NSString *cacheKey,[materialDictionary] NSDictionary *materialDict,[shadersDictionary] NSDictionary *shadersDict,[smooth] BOOL smooth,[shaderMacros] NSDictionary *macros,[shaderBindingTarget] id< OOWeakReferenceSupport > object)
NSDictionary * rolesAndProbabilities()
NSArray * memberArrayExcludingLeader()
NSArray * shipKeysWithRole:(NSString *role)
OOShipRegistry * sharedRegistry()
NSDictionary * shipInfoForKey:(NSString *key)
void setShipInfoForKey:with:(NSString *key,[with] NSDictionary *newShipData)
BOOL addEquipmentItem:withValidation:inContext:(NSString *equipmentKey, [withValidation] BOOL validateAddition, [inContext] NSString *context)
BOOL changePassengerBerths:(int addRemove)
OOCreditsQuantity removeMissiles()
BOOL setWeaponMount:toWeapon:inContext:(OOWeaponFacing facing,[toWeapon] NSString *eqKey,[inContext] NSString *context)
void runUnsanitizedScriptActions:allowingAIMethods:withContextName:forTarget:(NSArray *unsanitizedActions,[allowingAIMethods] BOOL allowAIMethods,[withContextName] NSString *contextName,[forTarget] ShipEntity *target)
void setScriptTarget:(ShipEntity *ship)
BOOL mountMissileWithRole:(NSString *role)
NSDictionary * materialDefaults()
void setMaxFlightYaw:(GLfloat new)
void setBounty:withReasonAsString:(OOCreditsQuantity amount,[withReasonAsString] NSString *reason)
void setMesh:(OOMesh *mesh)
void setScannerDisplayColor1:(OOColor *color1)
void setExhaustEmissiveColor:(OOColor *color)
void setAfterburnerFactor:(GLfloat new)
void dealEnergyDamage:atRange:withBias:(GLfloat baseDamage,[atRange] GLfloat range,[withBias] GLfloat velocityBias)
OOEquipmentType * selectMissile()
NSArray * spawnShipsWithRole:count:(NSString *role,[count] NSUInteger count)
void setBounty:withReason:(OOCreditsQuantity amount,[withReason] OOLegalStatusReason reason)
void setPrimaryAggressor:(Entity *targetEntity)
void setDesiredSpeed:(double amount)
NSUInteger defenseTargetCount()
NSArray * subEntitiesForScript()
void setEnergyRechargeRate:(GLfloat new)
NSDictionary * shipInfoDictionary()
void removeEquipmentItem:(NSString *equipmentKey)
NSUInteger passengerCapacity()
NSDictionary * scriptInfo
void setFuel:(OOFuelQuantity amount)
NSArray * contractListForScripting()
OOWeaponFacing currentWeaponFacing
void setCoordinate:(HPVector coord)
NSDictionary * dockingInstructions
void setMaxFlightRoll:(GLfloat new)
void setCargoFlag:(OOCargoFlag flag)
BOOL addEquipmentItem:withValidation:inContext:(NSString *equipmentKey,[withValidation] BOOL validateAddition,[inContext] NSString *context)
void setThrust:(double amount)
void setDestinationSystem:(OOSystemID s)
void setMaxAvailableCargoSpace:(OOCargoQuantity new)
OOShipGroup * escortGroup()
void setScannerDisplayColorHostile1:(OOColor *color1)
void setAIScriptWakeTime:(OOTimeAbsolute t)
void setGroup:(OOShipGroup *group)
void setEscortDestination:(HPVector dest)
OOCargoQuantity availableCargoSpace()
void setDisplayName:(NSString *inName)
OOColor * scannerDisplayColor2()
void setAccuracy:(GLfloat new_accuracy)
void setAutoCloak:(BOOL automatic)
void setAfterburnerRate:(GLfloat new)
NSArray * portWeaponOffset
Entity * primaryAggressor()
void setPrimaryRole:(NSString *role)
void validateDefenseTargets()
NSArray * equipmentListForScripting()
BoundingBox totalBoundingBox
OOCreditsQuantity removeMissiles()
void setShipScript:(NSString *script_name)
BOOL hasEquipmentItem:(id equipmentKeys)
NSEnumerator * defenseTargetEnumerator()
BOOL performHyperSpaceToSpecificSystem:(OOSystemID systemID)
NSArray * starboardWeaponOffset
void setHeatInsulation:(GLfloat value)
void setScannerDisplayColor2:(OOColor *color2)
NSArray * parcelListForScripting()
BOOL setWeaponMount:toWeapon:(OOWeaponFacing facing,[toWeapon] NSString *eqKey)
NSArray * cargoListForScripting()
NSEnumerator * flasherEnumerator()
Entity * proximityAlert()
void scoopUpProcess:processEvents:processMessages:(ShipEntity *other,[processEvents] BOOL proc_events,[processMessages] BOOL proc_messages)
void setTargetForScript:(ShipEntity *target)
ShipEntity * fireMissile()
void setName:(NSString *inName)
NSString * shipUniqueName
NSString * scanDescriptionForScripting()
void setBeaconCode:(NSString *bcode)
void setScanDescription:(NSString *inName)
void setAITo:(NSString *aiString)
void sendMessage:toShip:withUnpilotedOverride:(NSString *message_text,[toShip] ShipEntity *other_ship,[withUnpilotedOverride] BOOL unpilotedOverride)
BOOL canAddEquipment:inContext:(NSString *equipmentKey,[inContext] NSString *context)
void commsMessage:withUnpilotedOverride:(NSString *valueString,[withUnpilotedOverride] BOOL unpilotedOverride)
OOColor * scannerDisplayColorHostile2()
NSEnumerator * exhaustEnumerator()
void removeCollisionException:(ShipEntity *ship)
void setMaxFlightPitch:(GLfloat new)
NSArray * aftWeaponOffset
void addCollisionException:(ShipEntity *ship)
void setReactionTime:(float newReactionTime)
NSArray * forwardWeaponOffset
NSArray * passengerListForScripting()
NSArray * collisionExceptions()
void setScriptedMisjumpRange:(GLfloat newValue)
OOColor * scannerDisplayColorHostile1()
void setEntityPersonalityInt:(uint16_t value)
void setReportAIMessages:(BOOL yn)
OOColor * exhaustEmissiveColor()
void setTrackCloseContacts:(BOOL value)
void setSubEntityRotationalVelocity:(Quaternion rv)
void setMaxFlightSpeed:(GLfloat new)
OOCargoQuantity maxAvailableCargoSpace()
void setTemperature:(GLfloat value)
void setScriptedMisjump:(BOOL newValue)
ShipEntity * fireMissileWithIdentifier:andTarget:(NSString *identifier,[andTarget] Entity *target)
void setTotalVelocity:(Vector vel)
void setSunGlareFilter:(GLfloat newValue)
void setCloaked:(BOOL cloak)
void setIsBoulder:(BOOL flag)
OOEquipmentType * weaponTypeForFacing:strict:(OOWeaponFacing facing,[strict] BOOL strict)
NSArray * crewForScripting()
void setCrew:(NSArray *crewArray)
void setCommodityForPod:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)
void setMaxEscortCount:(uint8_t newCount)
void doScriptEvent:withArgument:(jsid message,[withArgument] id argument)
void switchAITo:(NSString *aiString)
void setBeaconLabel:(NSString *blabel)
void reactToAIMessage:context:(NSString *message,[context] NSString *debugContext)
void setFoundTarget:(Entity *targetEntity)
void setScannerDisplayColorHostile2:(OOColor *color2)
void sendAIMessage:(NSString *message)
void setMissileLoadTime:(OOTimeDelta newMissileLoadTime)
OOCommodityType commodityType()
NSUInteger countEquipmentItem:(NSString *eqkey)
void setDesiredRange:(double amount)
BOOL hasOneEquipmentItem:includeMissiles:whileLoading:(NSString *itemKey,[includeMissiles] BOOL includeMissiles,[whileLoading] BOOL loading)
OOColor * scannerDisplayColor1()
OOScript * shipAIScript()
void setHomeSystem:(OOSystemID s)
void setHyperspaceSpinTime:(float new)
void setShipUniqueName:(NSString *inName)
void setMaxThrust:(GLfloat new)
void setShipClassName:(NSString *inName)
void acceptPatrolReportFrom:(ShipEntity *patrol_ship)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque