154 .class_name =
"Ship",
566 JSValue entityPrototype = JS_GetClassProto(context,
JSEntityClassID());
570 JS_FreeValue(context, entityPrototype);
589 if (
EXPECT_NOT(!JSShipGetShipEntity(context,
this, &entity)))
597 result = [entity
name];
645 return JS_NewNumber(context, [entity realAlertCondition]);
654 return JS_NewNumber(context, [entity accuracy]);
657 return JS_NewNumber(context, [entity fuel] * 0.1);
660 return JS_NewNumber(context, [entity fuelChargeRate]);
663 return JS_NewNumber(context, [entity bounty]);
678 return JS_NewNumber(context, [entity maxShipSubEntities]);
695 while ((target = [[defTargets nextObject] weakRefUnderlyingObject])) {
696 [result addObject:target];
710 result = [entity
group];
721 return JS_NewNumber(context, [entity heatInsulation]);
727 return JS_NewNumber(context, [entity energyRechargeRate]);
730 return JS_NewInt32(context, [entity entityPersonalityInt]);
766 return JS_NewNumber(context, [entity hyperspaceSpinTime]);
769 return JS_NewNumber(context, [entity weaponRange]);
772 if ([entity isPlayer]) {
774 return JS_NewNumber(context, [pent availableFacings]);
776 return JS_NewNumber(context, [entity weaponFacings]);
796 return JS_NewNumber(context, [entity scannerRange]);
799 return JS_NewNumber(context, [entity reactionTime]);
808 return JS_NewInt32(context, [entity maxAvailableCargoSpace]);
811 return JS_NewInt32(context, [entity maxAvailableCargoSpace] - [entity availableCargoSpace]);
814 return JS_NewInt32(context, [entity availableCargoSpace]);
821 return JS_NewNumber(context, [entity extraCargo]);
824 if ([entity commodityAmount] > 0) {
830 return JS_NewInt32(context, [entity commodityAmount]);
837 return JS_NewNumber(context, [entity flightSpeed]);
840 return JS_NewNumber(context, [entity cruiseSpeed]);
847 return JS_NewNumber(context, [entity desiredRange]);
850 return JS_NewNumber(context, [entity desiredSpeed]);
859 return JS_NewNumber(context, [entity maxEscortCount]);
862 return JS_NewNumber(context, [entity maxFlightPitch]);
865 return JS_NewNumber(context, [entity maxFlightSpeed]);
868 return JS_NewNumber(context, [entity maxFlightRoll]);
871 return JS_NewNumber(context, [entity maxFlightYaw]);
874 return JS_NewNumber(context, [entity afterburnerRate]);
877 return JS_NewNumber(context, [entity afterburnerFactor]);
888 return JS_NewNumber(context, [entity shipAIScriptWakeTime]);
892 return JS_NewNumber(context, [entity destinationSystem]);
896 return JS_NewNumber(context, [entity homeSystem]);
936 if ([entity isPlayer]) {
939 return OOJSValueFromBOOL([entity behaviour] == BEHAVIOUR_FLEE_TARGET || [entity behaviour] == BEHAVIOUR_FLEE_EVASIVE_ACTION);
943 return OOJSValueFromBOOL([entity scanClass] == CLASS_CARGO && [entity commodityAmount] > 0);
955 return JS_NewNumber(context, [entity scriptedMisjumpRange]);
960 result = [NSDictionary dictionary];
964 return JS_NewNumber(context, [entity sunGlareFilter]);
970 return JS_NewNumber(context, [entity passengerCount]);
973 return JS_NewNumber(context, [entity parcelCount]);
976 return JS_NewNumber(context, [entity passengerCapacity]);
979 return JS_NewNumber(context, [entity missileCapacity]);
982 return JS_NewNumber(context, [entity missileLoadTime]);
1012 return JS_NewNumber(context, [entity laserHeatLevel]);
1015 return JS_NewNumber(context, [entity laserHeatLevelAft]);
1018 return JS_NewNumber(context, [entity laserHeatLevelForward]);
1021 return JS_NewNumber(context, [entity laserHeatLevelPort]);
1024 return JS_NewNumber(context, [entity laserHeatLevelStarboard]);
1067 return JS_NewNumber(context, [entity maxThrust]);
1070 return JS_NewNumber(context, [entity thrust]);
1091 return JS_NewNumber(context, [entity flightPitch]);
1094 return JS_NewNumber(context, [entity flightRoll]);
1097 return JS_NewNumber(context, [entity flightYaw]);
1103 if ([entity isSubEntity]) {
1129 NSString* sValue =
nil;
1140 if (
EXPECT_NOT(!JSShipGetShipEntity(context,
this, &entity)))
1143 return JS_UNDEFINED;
1145 NSCAssert(![entity isTemplateCargoPod],
@"-OOJSShip: a template cargo pod has become accessible to Javascript");
1150 goto playerReadOnly;
1153 if (sValue !=
nil) {
1155 return JS_UNDEFINED;
1161 goto playerReadOnly;
1164 if (sValue !=
nil) {
1166 return JS_UNDEFINED;
1172 if (sValue !=
nil) {
1174 return JS_UNDEFINED;
1180 if (sValue !=
nil) {
1182 return JS_UNDEFINED;
1190 return JS_UNDEFINED;
1194 goto playerReadOnly;
1197 if (sValue !=
nil) {
1199 return JS_UNDEFINED;
1205 goto playerReadOnly;
1208 if (sValue !=
nil) {
1210 return JS_UNDEFINED;
1216 goto playerReadOnly;
1219 if ([sValue length] == 0) {
1220 if ([entity isBeacon]) {
1221 [UNIVERSE clearBeacon:entity];
1222 if ([
PLAYER nextBeacon] == entity) {
1223 [PLAYER setCompassMode:COMPASS_MODE_PLANET];
1227 if ([entity isBeacon]) {
1232 [UNIVERSE setNextBeacon:entity];
1235 return JS_UNDEFINED;
1240 goto playerReadOnly;
1242 if (sValue !=
nil) {
1244 return JS_UNDEFINED;
1250 goto playerReadOnly;
1252 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1254 return JS_UNDEFINED;
1259 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1261 [entity
setFuel:lround(fValue * 10.0)];
1262 return JS_UNDEFINED;
1273 return JS_UNDEFINED;
1277 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1279 return JS_UNDEFINED;
1288 return JS_UNDEFINED;
1298 if ([entity maxAvailableCargoSpace] < [entity availableCargoSpace]) {
1300 }
else if ((
OOCargoQuantity)iValue < [entity maxAvailableCargoSpace] - [entity availableCargoSpace]) {
1304 return JS_UNDEFINED;
1313 return JS_UNDEFINED;
1322 return JS_UNDEFINED;
1327 if (JS_IsNull(value)) {
1329 return JS_UNDEFINED;
1332 return JS_UNDEFINED;
1338 goto playerReadOnly;
1340 if (JS_IsNull(value)) {
1342 return JS_UNDEFINED;
1345 return JS_UNDEFINED;
1351 goto playerReadOnly;
1353 if (JS_IsNull(value)) {
1355 return JS_UNDEFINED;
1358 return JS_UNDEFINED;
1364 if (group !=
nil || JS_IsNull(value)) {
1366 return JS_UNDEFINED;
1371 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1373 return JS_UNDEFINED;
1378 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1379 fValue = fmax(fValue, 0.0);
1381 return JS_UNDEFINED;
1386 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1387 fValue = fmax(fValue, 0.125);
1389 return JS_UNDEFINED;
1394 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1396 return JS_UNDEFINED;
1401 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1403 return JS_UNDEFINED;
1408 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1410 return JS_UNDEFINED;
1416 goto playerReadOnly;
1418 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1420 return JS_UNDEFINED;
1425 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1427 return JS_UNDEFINED;
1432 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1434 return JS_UNDEFINED;
1440 goto playerReadOnly;
1442 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1444 return JS_UNDEFINED;
1450 goto playerReadOnly;
1456 return JS_UNDEFINED;
1462 goto playerReadOnly;
1464 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1466 return JS_UNDEFINED;
1472 goto playerReadOnly;
1474 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1476 return JS_UNDEFINED;
1483 return JS_UNDEFINED;
1489 if (colorForScript !=
nil || JS_IsNull(value)) {
1491 return JS_UNDEFINED;
1497 if (colorForScript !=
nil || JS_IsNull(value)) {
1499 return JS_UNDEFINED;
1505 if (colorForScript !=
nil || JS_IsNull(value)) {
1507 return JS_UNDEFINED;
1513 if (colorForScript !=
nil || JS_IsNull(value)) {
1515 return JS_UNDEFINED;
1521 if (colorForScript !=
nil || JS_IsNull(value)) {
1523 return JS_UNDEFINED;
1528 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1530 return JS_UNDEFINED;
1535 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1536 if (fValue > 0.0 && fValue < 1.0) {
1538 return JS_UNDEFINED;
1549 return JS_UNDEFINED;
1554 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1555 if (fValue >= 0.0f && fValue <= 1.0f) {
1557 return JS_UNDEFINED;
1568 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1570 return JS_UNDEFINED;
1575 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1581 return JS_UNDEFINED;
1586 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1592 return JS_UNDEFINED;
1597 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1603 return JS_UNDEFINED;
1608 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1614 return JS_UNDEFINED;
1619 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1621 OOJSReportError(context,
@"ship.injectorBurnRate cannot be negative.");
1625 return JS_UNDEFINED;
1630 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1632 OOJSReportError(context,
@"ship.injectorSpeedFactor cannot be less than 1.0.");
1635#if OO_VARIABLE_TORUS_SPEED
1645 return JS_UNDEFINED;
1650 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1656 return JS_UNDEFINED;
1661 if ((JS_ToFloat64(context, &fValue, value) == 0)) {
1663 OOJSReportError(context,
@"ship.energyRechargeRate cannot be negative.");
1667 return JS_UNDEFINED;
1672 if (((bValue = JS_ToBool(context, value)) >= 0)) {
1677 return JS_UNDEFINED;
1684 return JS_UNDEFINED;
1694 if (sValue ==
nil) {
1695 sValue =
@"EQ_WEAPON_NONE";
1715 if ([entity isPlayer]) {
1721 return JS_UNDEFINED;
1725 goto playerReadOnly;
1728 if ((NSInteger)iValue < (NSInteger)[[entity escortGroup]
count] - 1) {
1737 return JS_UNDEFINED;
1766#define GET_THIS_SHIP(THISENT) \
1768 if (EXPECT_NOT(!JSShipGetShipEntity(context, OOJS_THIS, &THISENT))) \
1769 return OOJSNativeFailure(context); \
1770 if (OOIsStaleEntity(THISENT)) \
1780 NSString* name =
nil;
1806 NSString* name =
nil;
1832 NSString* name =
nil;
1859 NSString* message =
nil;
1866 thisAI = [thisEnt
getAI];
1868 if ([thisAI hasSuspendedStateMachines]) {
1876 OOJSReportWarningForCaller(context,
@"Ship",
@"exitAI()",
@"Cannot exit current AI state machine because there are no suspended state machines.");
1889 NSString* message =
nil;
1915 NSString* message =
nil;
1971 NSString* equipment =
nil;
1993 NSString* role =
nil;
2015 NSString* role =
nil;
2037 int procEvents = NO;
2038 int procMessages = NO;
2050 if ([target scanClass] != CLASS_CARGO) {
2054 if ([target status] != STATUS_IN_FLIGHT) {
2083 NSString* itemKey =
nil;
2120 int32_t i,
count = 1;
2121 BOOL gotCount = YES;
2129 for (i = 1; i <
count; i++) {
2130 [thisEnt performSelector:@selector(dumpCargo) withObject:nil afterDelay:0.75 * i];
2145 NSString* role =
nil;
2147 BOOL gotCount = YES;
2148 NSArray* result =
nil;
2178 double velocityBias = 0.0;
2189 gotDamage = (JS_ToFloat64(context, &baseDamage,
OOJS_ARGV[0]) == 0);
2190 if (
EXPECT_NOT(!gotDamage || baseDamage < 0)) {
2194 gotRange = (JS_ToFloat64(context, &range,
OOJS_ARGV[1]) == 0);
2200 gotVBias = (JS_ToFloat64(context, &velocityBias,
OOJS_ARGV[2]) == 0);
2230 int suppressDeathEvent = NO;
2234 if ([thisEnt isPlayer]) {
2239 if (argc > 0 &&
EXPECT_NOT(!((suppressDeathEvent = JS_ToBool(context,
OOJS_ARGV[0])) >= 0))) {
2246 if (suppressDeathEvent) {
2262 NSArray* actions =
nil;
2269 if (
EXPECT_NOT(argc != 2 || !JS_IsObject(
OOJS_ARGV[0]) || !JSShipGetShipEntity(context,
OOJS_ARGV[0], &target) || ![actions isKindOfClass:[NSArray
class]])) {
2279 withContextName:[NSString stringWithFormat:@"<ship \"%@\" legacy actions>", [thisEnt
name]]
2294 NSString* message =
nil;
2308 }
else if (target !=
nil)
2329 OOJSReportWarning(context,
@"Ship %@ was requested to fire ECM burst but does not carry ECM equipment.", [thisEnt oo_jsDescription]);
2356 NSString* key =
nil;
2357 NSString* ctx =
@"scripted";
2373 if (![ctx isEqualToString:
@"scripted"] && ![ctx isEqualToString:
@"purchase"] && ![ctx isEqualToString:
@"newShip"] && ![ctx isEqualToString:
@"npc"]) {
2381 if ([key isEqualToString:
@"EQ_FUEL"])
2403 NSString* identifier =
nil;
2419 berth = [identifier isEqualToString:@"EQ_PASSENGER_BERTH"];
2422 }
else if ([identifier isEqualToString:
@"EQ_FUEL"]) {
2429 if ([thisEnt isPlayer]) {
2432 if ([identifier isEqualToString:
@"EQ_MISSILE_REMOVAL"]) {
2434 }
else if ([eqType isMissileOrMine]) {
2438 }
else if ([identifier isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"]) {
2441 isRepair = [thisEnt
hasEquipmentItem:[identifier stringByAppendingString:@"_DAMAGED"]];
2443 if (OK && isRepair) {
2448 if ([identifier isEqualToString:
@"EQ_MISSILE_REMOVAL"]) {
2452 else if (!berth && ![identifier isEqualToString:
@"EQ_PASSENGER_BERTH_REMOVAL"]) {
2471 NSString* key =
nil;
2486 key = [key stringByAppendingString:@"_DAMAGED"];
2491 if ([key isEqualToString:
@"EQ_PASSENGER_BERTH"] || [key isEqualToString:
@"EQ_CARGO_BAY"]) {
2492 if ([key isEqualToString:
@"EQ_PASSENGER_BERTH"]) {
2493 if ([thisEnt passengerCapacity] > [thisEnt passengerCount]) {
2495 if ([thisEnt isPlayer])
2502 if ([thisEnt isPlayer] || [thisEnt extraCargo] <= [thisEnt availableCargoSpace]) {
2522 NSUInteger numSubEntitiesRestored = 0U;
2531 if ([[thisEnt subEntitiesForScript]
count] - subCount > 0)
2535 if ([thisEnt isPlayer]) {
2554 NSString* key =
nil;
2555 NSString* damagedKey =
nil;
2556 NSString* status =
nil;
2557 BOOL hasOK = NO, hasDamaged = NO;
2579 if (![status isEqualToString:
@"EQUIPMENT_OK"] && ![status isEqualToString:
@"EQUIPMENT_DAMAGED"]) {
2580 OOJSReportErrorForCaller(context,
@"Ship",
@"setEquipmentStatus",
@"Second parameter for setEquipmentStatus must be either \"EQUIPMENT_OK\
" or \"EQUIPMENT_DAMAGED\".");
2586 BOOL setOK = [status isEqualToString:@"EQUIPMENT_OK"];
2587 BOOL setDamaged = [status isEqualToString:@"EQUIPMENT_DAMAGED"];
2588 if ([eqType canBeDamaged]) {
2589 damagedKey = [key stringByAppendingString:@"_DAMAGED"];
2592 if ((setOK && hasDamaged) || (setDamaged && hasOK)) {
2595 if ([thisEnt isPlayer]) {
2614 if (hasOK && ![status isEqualToString:
@"EQUIPMENT_OK"]) {
2631 NSString* key =
nil;
2633 NSDictionary* dict =
nil;
2642 if (argc > 0 && JS_IsString(
OOJS_ARGV[0])) {
2644 dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:1], @"EQUIPMENT_UNKNOWN", nil];
2656 dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:[thisEnt
countEquipmentItem:key]], @"EQUIPMENT_OK", [NSNumber numberWithUnsignedInteger:[thisEnt
countEquipmentItem:[key stringByAppendingString:@"_DAMAGED"]]], @"EQUIPMENT_DAMAGED", nil];
2659 if ([thisEnt hasEquipmentItem:key includeWeapons:YES whileLoading:NO])
2661 else if ([thisEnt hasEquipmentItem:[key stringByAppendingString:
@"_DAMAGED"]])
2681 result =
@"EQ_MISSILE";
2721 foreach (se, [
UNIVERSE stations]) {
2722 sdist =
HPdistance2([thisEnt position], [se position]);
2741 NSString* reason =
nil;
2742 int32_t newbounty = 0;
2743 BOOL gotBounty = YES;
2751 if (
EXPECT_NOT(reason ==
nil || !gotBounty || newbounty < 0)) {
2771 BOOL gotCount = YES;
2784 if ([[
UNIVERSE commodities] goodDefined:commodity]) {
2801 NSDictionary* crewDefinition =
nil;
2812 if (![thisEnt isExplicitlyUnpiloted]) {
2818 [thisEnt
setCrew:[NSArray arrayWithObject:crew]];
2835 NSString* cargoType =
nil;
2846 OOJSReportBadArguments(context,
@"Ship",
@"setCargoType", argc,
OOJS_ARGV,
nil, [NSString stringWithFormat:
@"Can only be used on cargo pod carriers, not cargo pods (%@)", [thisEnt shipDataKey]]);
2850 if ([cargoType isEqualToString:
@"SCARCE_GOODS"]) {
2852 }
else if ([cargoType isEqualToString:
@"PLENTIFUL_GOODS"]) {
2854 }
else if ([cargoType isEqualToString:
@"MEDICAL_GOODS"]) {
2856 }
else if ([cargoType isEqualToString:
@"ILLEGAL_GOODS"]) {
2858 }
else if ([cargoType isEqualToString:
@"PIRATE_GOODS"]) {
2918 JSValueConst params = JS_UNDEFINED;
2919 NSDictionary* materials;
2920 NSDictionary* shaders;
2921 BOOL withShaders = NO;
2962 smooth:[shipDict oo_boolForKey:@"smooth" defaultValue:NO]
2983 int32_t systemID = -1;
3012 [thisEnt updateEscortFormation];
3028 NSCAssert(explode,
@"RemoveOrExplodeShip(): shouldn't be called for player with !explode.");
3031 if ([player isDocked]) {
3032 OOJSReportError(context,
@"Cannot explode() player's ship while docked.");
3039 [UNIVERSE unMagicMainStation];
3042 if (
EXPECT_NOT([thisEnt status] == STATUS_DOCKED)) {
3046 [thisEnt setStatus:STATUS_DEAD];
3052 [thisEnt setSuppressExplosion:!explode];
3053 [thisEnt setEnergy:1];
3054 [thisEnt takeEnergyDamage:500000000.0 from:nil becauseOf:nil weaponIdentifier:@""];
3068 [thisEnt removeAllDefenseTargets];
3088 [thisEnt addDefenseTarget:target];
3108 [thisEnt removeDefenseTarget:target];
3131 [thisEnt addCollisionException:target];
3153 [thisEnt removeCollisionException:target];
3167 NSObject* result =
nil;
3171 result = [[thisEnt mesh] materials];
3173 result = [NSDictionary dictionary];
3185 NSObject* result =
nil;
3189 result = [[thisEnt mesh] shaders];
3191 result = [NSDictionary dictionary];
3203 [thisEnt broadcastEnergyBlastImminent];
3216 [thisEnt becomeEnergyBlast];
3236 BOOL result = [thisEnt suggestEscortTo:mother];
3251 [thisEnt groupAttackTarget];
3270 if ([target isStation]) {
3290 if ((ship !=
nil) && ([ship status] != STATUS_DEAD) && ([ship status] != STATUS_DOCKED)) {
3306 if ([
PLAYER status] != STATUS_ENTERING_WITCHSPACE) {
3307 OOJSReportError(context,
@"Cannot use this function while player's ship not entering witchspace.");
3313 [thisEnt enterPlayerWormhole];
3315 if (![hole isWormhole]) {
3320 [thisEnt enterWormhole:(WormholeEntity*)hole];
3335 [thisEnt wormholeEntireGroup];
3348 [thisEnt setThrowSparks:YES];
3361 [thisEnt performAttack];
3374 [thisEnt performCollect];
3387 [thisEnt performEscort];
3400 [thisEnt performFaceDestination];
3413 [thisEnt performFlee];
3426 [thisEnt performFlyToRangeFromDestination];
3439 [thisEnt performHold];
3452 [thisEnt performIdle];
3465 [thisEnt performIntercept];
3478 [thisEnt performLandOnPlanet];
3491 [thisEnt performMining];
3504 [thisEnt performScriptedAI];
3517 [thisEnt performScriptedAttackAI];
3530 [thisEnt performStop];
3543 [thisEnt performTumble];
3556 [thisEnt requestDockingCoordinates];
3558 NSDictionary* dockingInstructions = [thisEnt dockingInstructions];
3559 if (dockingInstructions !=
nil) {
3574 [thisEnt recallDockingInstructions];
3576 NSDictionary* dockingInstructions = [thisEnt dockingInstructions];
3577 if (dockingInstructions !=
nil) {
3592 [thisEnt broadcastDistressMessageWithDumping:NO];
3606 Entity* hazard = [UNIVERSE hazardOnRouteFromEntity:thisEnt toDistance:[thisEnt desiredRange] fromPoint:[thisEnt destination]];
3620 HPVector waypoint = [UNIVERSE getSafeVectorFromEntity:thisEnt toDistance:[thisEnt desiredRange] fromPoint:[thisEnt destination]];
3632 int onlyCheckPowered = NO;
3636 if (argc > 0 &&
EXPECT_NOT(!((onlyCheckPowered = JS_ToBool(context,
OOJS_ARGV[0])) >= 0))) {
3641 if (onlyCheckPowered) {
3642 [thisEnt checkScannerIgnoringUnpowered];
3644 [thisEnt checkScanner];
3646 ShipEntity** scannedShips = [thisEnt scannedShips];
3647 unsigned num = [thisEnt numberOfScannedShips];
3648 NSMutableArray* scanResult = [NSMutableArray array];
3649 for (
unsigned i = 0; i < num; i++) {
3650 [scanResult addObject:scannedShips[i]];
3662 NSString* commodity =
@"";
3663 int32_t adjustment = 0;
3679 OOJSReportError(context,
@"ship.adjustCargo may only be used on NPC cargo carriers");
3685 if (adjustment > 0) {
3686 NSArray* cargo = [UNIVERSE getContainersOfCommodity:commodity how_much:adjustment];
3687 ok = [thisEnt addCargo:cargo];
3688 }
else if (adjustment < 0) {
3690 ok = [thisEnt removeCargo:commodity amount:r];
3709 if ([thisEnt missileCapacity] > 0 && [[thisEnt missilesList]
count] == 0) {
3714 if ([thisEnt hasFuelInjection] && [thisEnt fuel] < 35) {
3740 double assessment = 2.5;
3742 GLfloat maxspeed = [thisEnt maxFlightSpeed];
3743 assessment += (maxspeed - 300) / 1000;
3744 if (maxspeed < 200) {
3745 assessment += (maxspeed - 200) / 500;
3750 assessment += ([thisEnt maxEnergy] - 200) / 1000;
3755 if ([thisEnt missileCapacity] > 2) {
3758 assessment += ((double)[thisEnt missileCapacity]) / 5.0;
3765 assessment += [thisEnt turretCount];
3769 if ([thisEnt isPlayer]) {
3770 double score = (double)[
PLAYER score];
3774 assessment += pow(score, 0.33) / 10;
3777 assessment += [thisEnt accuracy] / 5;
3781 OOWeaponType wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_FORWARD strict:NO];
3790 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_AFT strict:NO];
3795 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_PORT strict:NO];
3799 wt = [thisEnt weaponTypeIDForFacing:WEAPON_FACING_STARBOARD strict:NO];
3805 if ([thisEnt hasECM]) {
3808 if ([thisEnt hasFuelInjection]) {
3814 if ([thisEnt isThargoid]) {
3816 if ([thisEnt hasRole:
@"thargoid-mothership"]) {
3821 if ([thisEnt weaponFacings] == 1) {
3831 if ([thisEnt behaviour] == BEHAVIOUR_FLEE_TARGET || [thisEnt behaviour] == BEHAVIOUR_FLEE_EVASIVE_ACTION) {
3838 if (assessment < 0.1) {
3862 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)
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
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)
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 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)
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 JSValueToHPVector(JSContext *context, jsval value, HPVector *outVector) NONNULL_FUNC
id OOJSNativeObjectFromJSValue(JSContext *context, jsval value)
void OOJSReportWarning(JSContext *context, NSString *format,...)
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)
OOINLINE BOOL OOJSValueToBOOL(JSContext *context, jsval value)
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,...)
OOINLINE BOOL OOJSValueToInt32(JSContext *context, jsval value, int32_t *outValue)
id OOJSNativeObjectOfClassFromJSValue(JSContext *context, jsval value, Class requiredClass)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
#define OOJS_RETURN_QUATERNION(value)
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_RETURN_INT(v)
#define OOJS_RETURN_VECTOR(value)
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
JSClassID JSEntityClassID(void)
JSClassID JSShipClassID(void)
static JSClassID sShipClassID
#define OOJS_PROPERTY_RW(name, getter, setter, magic)
JSValue OOJSNativeFailure(JSContext *context)
JSClassID OOJSRegisterClass(JSClassID *ioClassID, const JSClassDef *classDef)
#define OOJS_PROPERTY_RO(name, getter, magic)
NSString * OOStringFromJSPropertyMagic(int magic, const JSCFunctionListEntry *list, size_t count)
JSValueConst OOJSInitClass(JSContext *context, JSValueConst global, JSClassID classID, JSValueConst parentPrototype, JSCFunction *constructor, int constructorArgCount, const JSCFunctionListEntry *properties, size_t propertyCount, const JSCFunctionListEntry *methods, size_t methodCount, const JSCFunctionListEntry *staticMethods, size_t staticMethodCount)
#define OOJS_COUNT(array)
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