55static JSBool
ShipGetProperty(JSContext* context, JSObject*
this, jsid propID, jsval* value);
56static JSBool
ShipSetProperty(JSContext* context, JSObject*
this, jsid propID, JSBool strict, jsval* value);
58static JSBool
ShipSetScript(JSContext* context, uintN argc, jsval* vp);
59static JSBool
ShipSetAI(JSContext* context, uintN argc, jsval* vp);
60static JSBool
ShipSwitchAI(JSContext* context, uintN argc, jsval* vp);
61static JSBool
ShipExitAI(JSContext* context, uintN argc, jsval* vp);
65static JSBool
ShipDockEscorts(JSContext* context, uintN argc, jsval* vp);
66static JSBool
ShipHasRole(JSContext* context, uintN argc, jsval* vp);
67static JSBool
ShipEjectItem(JSContext* context, uintN argc, jsval* vp);
69static JSBool
ShipDumpCargo(JSContext* context, uintN argc, jsval* vp);
71static JSBool
ShipSpawn(JSContext* context, uintN argc, jsval* vp);
73static JSBool
ShipExplode(JSContext* context, uintN argc, jsval* vp);
74static JSBool
ShipRemove(JSContext* context, uintN argc, jsval* vp);
77static JSBool
ShipFireECM(JSContext* context, uintN argc, jsval* vp);
78static JSBool
ShipAbandonShip(JSContext* context, uintN argc, jsval* vp);
81static JSBool
ShipAdjustCargo(JSContext* context, uintN argc, jsval* vp);
91static JSBool
ShipFireMissile(JSContext* context, uintN argc, jsval* vp);
93static JSBool
ShipSetBounty(JSContext* context, uintN argc, jsval* vp);
94static JSBool
ShipSetCargo(JSContext* context, uintN argc, jsval* vp);
96static JSBool
ShipSetShaders(JSContext* context, uintN argc, jsval* vp);
97static JSBool
ShipExitSystem(JSContext* context, uintN argc, jsval* vp);
105static JSBool
ShipGetShaders(JSContext* context, uintN argc, jsval* vp);
113static JSBool
ShipThrowSpark(JSContext* context, uintN argc, jsval* vp);
119static JSBool
ShipPerformFlee(JSContext* context, uintN argc, jsval* vp);
121static JSBool
ShipPerformHold(JSContext* context, uintN argc, jsval* vp);
122static JSBool
ShipPerformIdle(JSContext* context, uintN argc, jsval* vp);
128static JSBool
ShipPerformStop(JSContext* context, uintN argc, jsval* vp);
141static JSBool
ShipSetCrew(JSContext* context, uintN argc, jsval* vp);
147static JSBool
ShipStaticKeys(JSContext* context, uintN argc, jsval* vp);
148static JSBool
ShipStaticRoles(JSContext* context, uintN argc, jsval* vp);
165 JSCLASS_NO_OPTIONAL_MEMBERS
592static JSBool
ShipGetProperty(JSContext* context, JSObject*
this, jsid propID, jsval* value)
594 if (!JSID_IS_INT(propID))
602 if (
EXPECT_NOT(!JSShipGetShipEntity(context,
this, &entity)))
609 switch (JSID_TO_INT(propID)) {
611 result = [entity
name];
659 return JS_NewNumberValue(context, [entity realAlertCondition], value);
670 return JS_NewNumberValue(context, [entity accuracy], value);
673 return JS_NewNumberValue(context, [entity fuel] * 0.1, value);
676 return JS_NewNumberValue(context, [entity fuelChargeRate], value);
679 return JS_NewNumberValue(context, [entity bounty], value);
695 return JS_NewNumberValue(context, [entity maxShipSubEntities], value);
714 while ((target = [[defTargets nextObject] weakRefUnderlyingObject])) {
715 [result addObject:target];
729 result = [entity
group];
740 return JS_NewNumberValue(context, [entity heatInsulation], value);
746 return JS_NewNumberValue(context, [entity energyRechargeRate], value);
749 *value = INT_TO_JSVAL([entity entityPersonalityInt]);
793 return JS_NewNumberValue(context, [entity hyperspaceSpinTime], value);
796 return JS_NewNumberValue(context, [entity weaponRange], value);
799 if ([entity isPlayer]) {
801 return JS_NewNumberValue(context, [pent availableFacings], value);
803 return JS_NewNumberValue(context, [entity weaponFacings], value);
823 return JS_NewNumberValue(context, [entity scannerRange], value);
826 return JS_NewNumberValue(context, [entity reactionTime], value);
837 *value = INT_TO_JSVAL([entity maxAvailableCargoSpace]);
841 *value = INT_TO_JSVAL([entity maxAvailableCargoSpace] - [entity availableCargoSpace]);
845 *value = INT_TO_JSVAL([entity availableCargoSpace]);
853 return JS_NewNumberValue(context, [entity extraCargo], value);
857 if ([entity commodityAmount] > 0) {
863 *value = INT_TO_JSVAL([entity commodityAmount]);
871 return JS_NewNumberValue(context, [entity flightSpeed], value);
874 return JS_NewNumberValue(context, [entity cruiseSpeed], value);
881 return JS_NewNumberValue(context, [entity desiredRange], value);
884 return JS_NewNumberValue(context, [entity desiredSpeed], value);
894 return JS_NewNumberValue(context, [entity maxEscortCount], value);
897 return JS_NewNumberValue(context, [entity maxFlightPitch], value);
900 return JS_NewNumberValue(context, [entity maxFlightSpeed], value);
903 return JS_NewNumberValue(context, [entity maxFlightRoll], value);
906 return JS_NewNumberValue(context, [entity maxFlightYaw], value);
909 return JS_NewNumberValue(context, [entity afterburnerRate], value);
912 return JS_NewNumberValue(context, [entity afterburnerFactor], value);
923 return JS_NewNumberValue(context, [entity shipAIScriptWakeTime], value);
927 return JS_NewNumberValue(context, [entity destinationSystem], value);
931 return JS_NewNumberValue(context, [entity homeSystem], value);
983 if ([entity isPlayer]) {
986 *value =
OOJSValueFromBOOL([entity behaviour] == BEHAVIOUR_FLEE_TARGET || [entity behaviour] == BEHAVIOUR_FLEE_EVASIVE_ACTION);
991 *value =
OOJSValueFromBOOL([entity scanClass] == CLASS_CARGO && [entity commodityAmount] > 0);
1007 return JS_NewNumberValue(context, [entity scriptedMisjumpRange], value);
1012 result = [NSDictionary dictionary];
1016 return JS_NewNumberValue(context, [entity sunGlareFilter], value);
1023 return JS_NewNumberValue(context, [entity passengerCount], value);
1026 return JS_NewNumberValue(context, [entity parcelCount], value);
1029 return JS_NewNumberValue(context, [entity passengerCapacity], value);
1032 return JS_NewNumberValue(context, [entity missileCapacity], value);
1035 return JS_NewNumberValue(context, [entity missileLoadTime], value);
1065 return JS_NewNumberValue(context, [entity laserHeatLevel], value);
1068 return JS_NewNumberValue(context, [entity laserHeatLevelAft], value);
1071 return JS_NewNumberValue(context, [entity laserHeatLevelForward], value);
1074 return JS_NewNumberValue(context, [entity laserHeatLevelPort], value);
1077 return JS_NewNumberValue(context, [entity laserHeatLevelStarboard], value);
1120 return JS_NewNumberValue(context, [entity maxThrust], value);
1123 return JS_NewNumberValue(context, [entity thrust], value);
1145 return JS_NewNumberValue(context, [entity flightPitch], value);
1148 return JS_NewNumberValue(context, [entity flightRoll], value);
1151 return JS_NewNumberValue(context, [entity flightYaw], value);
1157 if ([entity isSubEntity]) {
1177static JSBool
ShipSetProperty(JSContext* context, JSObject*
this, jsid propID, JSBool strict, jsval* value)
1179 if (!JSID_IS_INT(propID))
1186 NSString* sValue =
nil;
1197 if (
EXPECT_NOT(!JSShipGetShipEntity(context,
this, &entity)))
1202 NSCAssert(![entity isTemplateCargoPod],
@"-OOJSShip: a template cargo pod has become accessible to Javascript");
1204 switch (JSID_TO_INT(propID)) {
1207 goto playerReadOnly;
1210 if (sValue !=
nil) {
1218 goto playerReadOnly;
1221 if (sValue !=
nil) {
1229 if (sValue !=
nil) {
1237 if (sValue !=
nil) {
1251 goto playerReadOnly;
1254 if (sValue !=
nil) {
1262 goto playerReadOnly;
1265 if (sValue !=
nil) {
1273 goto playerReadOnly;
1276 if ([sValue length] == 0) {
1277 if ([entity isBeacon]) {
1278 [UNIVERSE clearBeacon:entity];
1279 if ([
PLAYER nextBeacon] == entity) {
1280 [PLAYER setCompassMode:COMPASS_MODE_PLANET];
1284 if ([entity isBeacon]) {
1289 [UNIVERSE setNextBeacon:entity];
1297 goto playerReadOnly;
1299 if (sValue !=
nil) {
1307 goto playerReadOnly;
1309 if (JS_ValueToNumber(context, *value, &fValue)) {
1316 if (JS_ValueToNumber(context, *value, &fValue)) {
1318 [entity
setFuel:lround(fValue * 10.0)];
1324 if (JS_ValueToInt32(context, *value, &iValue)) {
1334 if (JS_ValueToNumber(context, *value, &fValue)) {
1341 if (JS_ValueToInt32(context, *value, &iValue)) {
1350 if (JS_ValueToInt32(context, *value, &iValue)) {
1355 if ([entity maxAvailableCargoSpace] < [entity availableCargoSpace]) {
1357 }
else if ((
OOCargoQuantity)iValue < [entity maxAvailableCargoSpace] - [entity availableCargoSpace]) {
1366 if (JS_ValueToInt32(context, *value, &iValue)) {
1375 if (JS_ValueToInt32(context, *value, &iValue)) {
1384 if (JSVAL_IS_NULL(*value)) {
1395 goto playerReadOnly;
1397 if (JSVAL_IS_NULL(*value)) {
1408 goto playerReadOnly;
1410 if (JSVAL_IS_NULL(*value)) {
1421 if (group !=
nil || JSVAL_IS_NULL(*value)) {
1428 if (JS_ValueToNumber(context, *value, &fValue)) {
1435 if (JS_ValueToNumber(context, *value, &fValue)) {
1436 fValue = fmax(fValue, 0.0);
1443 if (JS_ValueToNumber(context, *value, &fValue)) {
1444 fValue = fmax(fValue, 0.125);
1451 if (JS_ValueToBoolean(context, *value, &bValue)) {
1458 if (JS_ValueToBoolean(context, *value, &bValue)) {
1465 if (JS_ValueToNumber(context, *value, &fValue)) {
1473 goto playerReadOnly;
1475 if (JS_ValueToNumber(context, *value, &fValue)) {
1482 if (JS_ValueToBoolean(context, *value, &bValue)) {
1489 if (JS_ValueToBoolean(context, *value, &bValue)) {
1497 goto playerReadOnly;
1499 if (JS_ValueToBoolean(context, *value, &bValue)) {
1507 goto playerReadOnly;
1519 goto playerReadOnly;
1521 if (JS_ValueToNumber(context, *value, &fValue)) {
1529 goto playerReadOnly;
1531 if (JS_ValueToNumber(context, *value, &fValue)) {
1546 if (colorForScript !=
nil || JSVAL_IS_NULL(*value)) {
1554 if (colorForScript !=
nil || JSVAL_IS_NULL(*value)) {
1562 if (colorForScript !=
nil || JSVAL_IS_NULL(*value)) {
1570 if (colorForScript !=
nil || JSVAL_IS_NULL(*value)) {
1578 if (colorForScript !=
nil || JSVAL_IS_NULL(*value)) {
1585 if (JS_ValueToBoolean(context, *value, &bValue)) {
1592 if (JS_ValueToNumber(context, *value, &fValue)) {
1593 if (fValue > 0.0 && fValue < 1.0) {
1611 if (JS_ValueToNumber(context, *value, &fValue)) {
1612 if (fValue >= 0.0f && fValue <= 1.0f) {
1625 if (JS_ValueToNumber(context, *value, &fValue)) {
1632 if (JS_ValueToNumber(context, *value, &fValue)) {
1643 if (JS_ValueToNumber(context, *value, &fValue)) {
1654 if (JS_ValueToNumber(context, *value, &fValue)) {
1665 if (JS_ValueToNumber(context, *value, &fValue)) {
1676 if (JS_ValueToNumber(context, *value, &fValue)) {
1678 OOJSReportError(context,
@"ship.injectorBurnRate cannot be negative.");
1687 if (JS_ValueToNumber(context, *value, &fValue)) {
1689 OOJSReportError(context,
@"ship.injectorSpeedFactor cannot be less than 1.0.");
1692#if OO_VARIABLE_TORUS_SPEED
1707 if (JS_ValueToNumber(context, *value, &fValue)) {
1718 if (JS_ValueToNumber(context, *value, &fValue)) {
1720 OOJSReportError(context,
@"ship.energyRechargeRate cannot be negative.");
1729 if (JS_ValueToBoolean(context, *value, &bValue)) {
1751 if (sValue ==
nil) {
1752 sValue =
@"EQ_WEAPON_NONE";
1755 switch (JSID_TO_INT(propID)) {
1772 if ([entity isPlayer]) {
1782 goto playerReadOnly;
1784 if (JS_ValueToInt32(context, *value, &iValue)) {
1785 if ((NSInteger)iValue < (NSInteger)[[entity escortGroup]
count] - 1) {
1823#define GET_THIS_SHIP(THISENT) \
1825 if (EXPECT_NOT(!JSShipGetShipEntity(context, OOJS_THIS, &THISENT))) \
1827 if (OOIsStaleEntity(THISENT)) \
1837 NSString* name =
nil;
1858static JSBool
ShipSetAI(JSContext* context, uintN argc, jsval* vp)
1863 NSString* name =
nil;
1889 NSString* name =
nil;
1910static JSBool
ShipExitAI(JSContext* context, uintN argc, jsval* vp)
1916 NSString* message =
nil;
1923 thisAI = [thisEnt
getAI];
1925 if ([thisAI hasSuspendedStateMachines]) {
1933 OOJSReportWarningForCaller(context,
@"Ship",
@"exitAI()",
@"Cannot exit current AI state machine because there are no suspended state machines.");
1946 NSString* message =
nil;
1972 NSString* message =
nil;
2028 NSString* equipment =
nil;
2050 NSString* role =
nil;
2072 NSString* role =
nil;
2094 JSBool procEvents = NO;
2095 JSBool procMessages = NO;
2107 if ([target scanClass] != CLASS_CARGO) {
2111 if ([target status] != STATUS_IN_FLIGHT) {
2140 NSString* itemKey =
nil;
2178 BOOL gotCount = YES;
2186 for (i = 1; i <
count; i++) {
2187 [thisEnt performSelector:@selector(dumpCargo) withObject:nil afterDelay:0.75 * i];
2197static JSBool
ShipSpawn(JSContext* context, uintN argc, jsval* vp)
2202 NSString* role =
nil;
2204 BOOL gotCount = YES;
2205 NSArray* result =
nil;
2233 jsdouble baseDamage;
2235 jsdouble velocityBias = 0.0;
2246 gotDamage = JS_ValueToNumber(context,
OOJS_ARGV[0], &baseDamage);
2247 if (
EXPECT_NOT(!gotDamage || baseDamage < 0)) {
2251 gotRange = JS_ValueToNumber(context,
OOJS_ARGV[1], &range);
2257 gotVBias = JS_ValueToNumber(context,
OOJS_ARGV[2], &velocityBias);
2282static JSBool
ShipRemove(JSContext* context, uintN argc, jsval* vp)
2287 JSBool suppressDeathEvent = NO;
2291 if ([thisEnt isPlayer]) {
2296 if (argc > 0 &&
EXPECT_NOT(!JS_ValueToBoolean(context,
OOJS_ARGV[0], &suppressDeathEvent))) {
2303 if (suppressDeathEvent) {
2319 NSArray* actions =
nil;
2326 if (
EXPECT_NOT(argc != 2 || !JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &target) || ![actions isKindOfClass:[NSArray
class]])) {
2336 withContextName:[NSString stringWithFormat:@"<ship \"%@\" legacy actions>", [thisEnt
name]]
2351 NSString* message =
nil;
2365 }
else if (target !=
nil)
2386 OOJSReportWarning(context,
@"Ship %@ was requested to fire ECM burst but does not carry ECM equipment.", [thisEnt oo_jsDescription]);
2413 NSString* key =
nil;
2414 NSString* ctx =
@"scripted";
2430 if (![ctx isEqualToString:
@"scripted"] && ![ctx isEqualToString:
@"purchase"] && ![ctx isEqualToString:
@"newShip"] && ![ctx isEqualToString:
@"npc"]) {
2438 if ([key isEqualToString:
@"EQ_FUEL"])
2460 NSString* identifier =
nil;
2476 berth = [identifier isEqualToString:@"EQ_PASSENGER_BERTH"];
2479 }
else if ([identifier isEqualToString:
@"EQ_FUEL"]) {
2486 if ([thisEnt isPlayer]) {
2489 if ([identifier isEqualToString:
@"EQ_MISSILE_REMOVAL"]) {
2491 }
else if ([eqType isMissileOrMine]) {
2495 }
else if ([identifier isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"]) {
2498 isRepair = [thisEnt
hasEquipmentItem:[identifier stringByAppendingString:@"_DAMAGED"]];
2500 if (OK && isRepair) {
2505 if ([identifier isEqualToString:
@"EQ_MISSILE_REMOVAL"]) {
2509 else if (!berth && ![identifier isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"]) {
2528 NSString* key =
nil;
2543 key = [key stringByAppendingString:@"_DAMAGED"];
2548 if ([key isEqualToString:
@"EQ_PASSENGER_BERTH"] || [key isEqualToString:
@"EQ_CARGO_BAY"]) {
2549 if ([key isEqualToString:
@"EQ_PASSENGER_BERTH"]) {
2550 if ([thisEnt passengerCapacity] > [thisEnt passengerCount]) {
2552 if ([thisEnt isPlayer])
2559 if ([thisEnt isPlayer] || [thisEnt extraCargo] <= [thisEnt availableCargoSpace]) {
2579 NSUInteger numSubEntitiesRestored = 0U;
2588 if ([[thisEnt subEntitiesForScript]
count] - subCount > 0)
2592 if ([thisEnt isPlayer]) {
2611 NSString* key =
nil;
2612 NSString* damagedKey =
nil;
2613 NSString* status =
nil;
2614 BOOL hasOK = NO, hasDamaged = NO;
2636 if (![status isEqualToString:
@"EQUIPMENT_OK"] && ![status isEqualToString:
@"EQUIPMENT_DAMAGED"]) {
2637 OOJSReportErrorForCaller(context,
@"Ship",
@"setEquipmentStatus",
@"Second parameter for setEquipmentStatus must be either \"EQUIPMENT_OK\
" or \"EQUIPMENT_DAMAGED\".");
2643 BOOL setOK = [status isEqualToString:@"EQUIPMENT_OK"];
2644 BOOL setDamaged = [status isEqualToString:@"EQUIPMENT_DAMAGED"];
2645 if ([eqType canBeDamaged]) {
2646 damagedKey = [key stringByAppendingString:@"_DAMAGED"];
2649 if ((setOK && hasDamaged) || (setDamaged && hasOK)) {
2652 if ([thisEnt isPlayer]) {
2671 if (hasOK && ![status isEqualToString:
@"EQUIPMENT_OK"]) {
2692 static jsval strOK, strDamaged, strUnavailable, strUnknown;
2693 static BOOL inited = NO;
2696 strOK = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_OK"));
2697 strDamaged = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_DAMAGED"));
2698 strUnavailable = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_UNAVAILABLE"));
2699 strUnknown = STRING_TO_JSVAL(JS_InternString(context,
"EQUIPMENT_UNKNOWN"));
2703 NSString* key =
nil;
2705 NSDictionary* dict =
nil;
2712 JS_ValueToBoolean(context,
OOJS_ARGV[1], &asDict);
2714 if (argc > 0 && JSVAL_IS_STRING(
OOJS_ARGV[0])) {
2716 dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:1], @"EQUIPMENT_UNKNOWN", nil];
2728 dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:[thisEnt
countEquipmentItem:key]], @"EQUIPMENT_OK", [NSNumber numberWithUnsignedInteger:[thisEnt
countEquipmentItem:[key stringByAppendingString:@"_DAMAGED"]]], @"EQUIPMENT_DAMAGED", nil];
2731 if ([thisEnt hasEquipmentItem:key includeWeapons:YES whileLoading:NO])
2733 else if ([thisEnt hasEquipmentItem:[key stringByAppendingString:
@"_DAMAGED"]])
2753 result =
@"EQ_MISSILE";
2793 foreach (se, [
UNIVERSE stations]) {
2794 sdist =
HPdistance2([thisEnt position], [se position]);
2813 NSString* reason =
nil;
2814 int32 newbounty = 0;
2815 BOOL gotBounty = YES;
2820 gotBounty = JS_ValueToInt32(context,
OOJS_ARGV[0], &newbounty);
2823 if (
EXPECT_NOT(reason ==
nil || !gotBounty || newbounty < 0)) {
2843 BOOL gotCount = YES;
2856 if ([[
UNIVERSE commodities] goodDefined:commodity]) {
2873 NSDictionary* crewDefinition =
nil;
2874 JSObject* params = NULL;
2878 if (argc < 1 || (!JSVAL_IS_NULL(
OOJS_ARGV[0]) && !JS_ValueToObject(context,
OOJS_ARGV[0], ¶ms))) {
2884 if (![thisEnt isExplicitlyUnpiloted]) {
2890 [thisEnt
setCrew:[NSArray arrayWithObject:crew]];
2907 NSString* cargoType =
nil;
2918 OOJSReportBadArguments(context,
@"Ship",
@"setCargoType", argc,
OOJS_ARGV,
nil, [NSString stringWithFormat:
@"Can only be used on cargo pod carriers, not cargo pods (%@)", [thisEnt shipDataKey]]);
2922 if ([cargoType isEqualToString:
@"SCARCE_GOODS"]) {
2924 }
else if ([cargoType isEqualToString:
@"PLENTIFUL_GOODS"]) {
2926 }
else if ([cargoType isEqualToString:
@"MEDICAL_GOODS"]) {
2928 }
else if ([cargoType isEqualToString:
@"ILLEGAL_GOODS"]) {
2930 }
else if ([cargoType isEqualToString:
@"PIRATE_GOODS"]) {
2989 JSObject* params = NULL;
2990 NSDictionary* materials;
2991 NSDictionary* shaders;
2992 BOOL withShaders = NO;
3033 smooth:[shipDict oo_boolForKey:@"smooth" defaultValue:NO]
3054 int32 systemID = -1;
3064 if (!JS_ValueToInt32(context,
OOJS_ARGV[0], &systemID) || systemID < 0 || 255 < systemID) {
3083 [thisEnt updateEscortFormation];
3099 NSCAssert(explode,
@"RemoveOrExplodeShip(): shouldn't be called for player with !explode.");
3102 if ([player isDocked]) {
3103 OOJSReportError(context,
@"Cannot explode() player's ship while docked.");
3110 [UNIVERSE unMagicMainStation];
3113 if (
EXPECT_NOT([thisEnt status] == STATUS_DOCKED)) {
3117 [thisEnt setStatus:STATUS_DEAD];
3123 [thisEnt setSuppressExplosion:!explode];
3124 [thisEnt setEnergy:1];
3125 [thisEnt takeEnergyDamage:500000000.0 from:nil becauseOf:nil weaponIdentifier:@""];
3139 [thisEnt removeAllDefenseTargets];
3154 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))))) {
3159 [thisEnt addDefenseTarget:target];
3174 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))))) {
3179 [thisEnt removeDefenseTarget:target];
3194 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))))) {
3202 [thisEnt addCollisionException:target];
3218 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))))) {
3224 [thisEnt removeCollisionException:target];
3238 NSObject* result =
nil;
3242 result = [[thisEnt mesh] materials];
3244 result = [NSDictionary dictionary];
3256 NSObject* result =
nil;
3260 result = [[thisEnt mesh] shaders];
3262 result = [NSDictionary dictionary];
3274 [thisEnt broadcastEnergyBlastImminent];
3287 [thisEnt becomeEnergyBlast];
3302 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))))) {
3307 BOOL result = [thisEnt suggestEscortTo:mother];
3322 [thisEnt groupAttackTarget];
3337 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))))) {
3341 if ([target isStation]) {
3361 if ((ship !=
nil) && ([ship status] != STATUS_DEAD) && ([ship status] != STATUS_DOCKED)) {
3377 if ([
PLAYER status] != STATUS_ENTERING_WITCHSPACE) {
3378 OOJSReportError(context,
@"Cannot use this function while player's ship not entering witchspace.");
3383 if (
EXPECT_NOT(argc == 0 || (argc > 0 && !JSVAL_IS_NULL(
OOJS_ARGV[0]) && (!JSVAL_IS_OBJECT(
OOJS_ARGV[0]) || !OOJSEntityGetEntity(context, JSVAL_TO_OBJECT(
OOJS_ARGV[0]), &hole))))) {
3384 [thisEnt enterPlayerWormhole];
3386 if (![hole isWormhole]) {
3391 [thisEnt enterWormhole:(WormholeEntity*)hole];
3406 [thisEnt wormholeEntireGroup];
3419 [thisEnt setThrowSparks:YES];
3432 [thisEnt performAttack];
3445 [thisEnt performCollect];
3458 [thisEnt performEscort];
3471 [thisEnt performFaceDestination];
3484 [thisEnt performFlee];
3497 [thisEnt performFlyToRangeFromDestination];
3510 [thisEnt performHold];
3523 [thisEnt performIdle];
3536 [thisEnt performIntercept];
3549 [thisEnt performLandOnPlanet];
3562 [thisEnt performMining];
3575 [thisEnt performScriptedAI];
3588 [thisEnt performScriptedAttackAI];
3601 [thisEnt performStop];
3614 [thisEnt performTumble];
3627 [thisEnt requestDockingCoordinates];
3629 NSDictionary* dockingInstructions = [thisEnt dockingInstructions];
3630 if (dockingInstructions !=
nil) {
3645 [thisEnt recallDockingInstructions];
3647 NSDictionary* dockingInstructions = [thisEnt dockingInstructions];
3648 if (dockingInstructions !=
nil) {
3663 [thisEnt broadcastDistressMessageWithDumping:NO];
3677 Entity* hazard = [UNIVERSE hazardOnRouteFromEntity:thisEnt toDistance:[thisEnt desiredRange] fromPoint:[thisEnt destination]];
3691 HPVector waypoint = [UNIVERSE getSafeVectorFromEntity:thisEnt toDistance:[thisEnt desiredRange] fromPoint:[thisEnt destination]];
3703 JSBool onlyCheckPowered = NO;
3707 if (argc > 0 &&
EXPECT_NOT(!JS_ValueToBoolean(context,
OOJS_ARGV[0], &onlyCheckPowered))) {
3712 if (onlyCheckPowered) {
3713 [thisEnt checkScannerIgnoringUnpowered];
3715 [thisEnt checkScanner];
3717 ShipEntity** scannedShips = [thisEnt scannedShips];
3718 unsigned num = [thisEnt numberOfScannedShips];
3719 NSMutableArray* scanResult = [NSMutableArray array];
3720 for (
unsigned i = 0; i < num; i++) {
3721 [scanResult addObject:scannedShips[i]];
3733 NSString* commodity =
@"";
3734 int32 adjustment = 0;
3744 if (!JS_ValueToInt32(context,
OOJS_ARGV[1], &adjustment)) {
3750 OOJSReportError(context,
@"ship.adjustCargo may only be used on NPC cargo carriers");
3756 if (adjustment > 0) {
3757 NSArray* cargo = [UNIVERSE getContainersOfCommodity:commodity how_much:adjustment];
3758 ok = [thisEnt addCargo:cargo];
3759 }
else if (adjustment < 0) {
3761 ok = [thisEnt removeCargo:commodity amount:r];
3780 if ([thisEnt missileCapacity] > 0 && [[thisEnt missilesList]
count] == 0) {
3785 if ([thisEnt hasFuelInjection] && [thisEnt fuel] < 35) {
3802 JSBool fullCheck = NO;
3811 double assessment = 2.5;
3813 GLfloat maxspeed = [thisEnt maxFlightSpeed];
3814 assessment += (maxspeed - 300) / 1000;
3815 if (maxspeed < 200) {
3816 assessment += (maxspeed - 200) / 500;
3821 assessment += ([thisEnt maxEnergy] - 200) / 1000;
3826 if ([thisEnt missileCapacity] > 2) {
3829 assessment += ((double)[thisEnt missileCapacity]) / 5.0;
3836 assessment += [thisEnt turretCount];
3840 if ([thisEnt isPlayer]) {
3841 double score = (double)[
PLAYER score];
3845 assessment += pow(score, 0.33) / 10;
3848 assessment += [thisEnt accuracy] / 5;
3852 OOWeaponType wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_FORWARD strict:NO];
3861 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_AFT strict:NO];
3866 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_PORT strict:NO];
3870 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_STARBOARD strict:NO];
3876 if ([thisEnt hasECM]) {
3879 if ([thisEnt hasFuelInjection]) {
3885 if ([thisEnt isThargoid]) {
3887 if ([thisEnt hasRole:
@"thargoid-mothership"]) {
3892 if ([thisEnt weaponFacings] == 1) {
3902 if ([thisEnt behaviour] == BEHAVIOUR_FLEE_TARGET || [thisEnt behaviour] == BEHAVIOUR_FLEE_EVASIVE_ACTION) {
3909 if (assessment < 0.1) {
3933 NSArray* keys = [registry
shipKeys];
OOINLINE void bounding_box_get_dimensions(BoundingBox bb, GLfloat *xSize, GLfloat *ySize, GLfloat *zSize) ALWAYS_INLINE_FUNC
OOINLINE double OOClamp_0_max_d(double value, double max) INLINE_CONST_FUNC
OOINLINE OOHPScalar HPdistance2(HPVector v1, HPVector v2) INLINE_CONST_FUNC
#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
void InitOOJSShip(JSContext *context, JSObject *global)
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)
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)
@ 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
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
OOINLINE OOScalar distance(Vector v1, Vector v2) INLINE_CONST_FUNC
#define PLAYER_SHIP_SUBENTITY_TRADE_IN_VALUE
#define HYPERSPEED_FACTOR
#define MIN_HYPERSPEED_FACTOR
OOEquipmentType * OOWeaponType
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)
void adjustTradeInFactorBy:(int value)
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 doScriptEvent:withArgument:(OOJSPropID message,[withArgument] id argument)
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 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