Added JS Ship.cruiseSpeed property.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3896 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
d7489498a0
commit
6254ca15a5
@ -659,6 +659,8 @@ MA 02110-1301, USA.
|
|||||||
- (double) desiredSpeed;
|
- (double) desiredSpeed;
|
||||||
- (void) setDesiredSpeed:(double) amount;
|
- (void) setDesiredSpeed:(double) amount;
|
||||||
|
|
||||||
|
- (double) cruiseSpeed;
|
||||||
|
|
||||||
- (Vector) thrustVector;
|
- (Vector) thrustVector;
|
||||||
- (void) setTotalVelocity:(Vector)vel; // Set velocity to vel - thrustVector, effectively setting the instanteneous velocity to vel.
|
- (void) setTotalVelocity:(Vector)vel; // Set velocity to vel - thrustVector, effectively setting the instanteneous velocity to vel.
|
||||||
|
|
||||||
|
@ -5443,6 +5443,12 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (double) cruiseSpeed
|
||||||
|
{
|
||||||
|
return cruiseSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) increase_flight_speed:(double) delta
|
- (void) increase_flight_speed:(double) delta
|
||||||
{
|
{
|
||||||
double factor = 1.0;
|
double factor = 1.0;
|
||||||
@ -9163,8 +9169,10 @@ BOOL class_masslocks(int some_class)
|
|||||||
}
|
}
|
||||||
else if ([self group] != escortGroup) [[self group] addShip:other_ship];
|
else if ([self group] != escortGroup) [[self group] addShip:other_ship];
|
||||||
|
|
||||||
if(([other_ship maxFlightSpeed] < cruiseSpeed) && ([other_ship maxFlightSpeed] > cruiseSpeed * 0.3))
|
if (([other_ship maxFlightSpeed] < cruiseSpeed) && ([other_ship maxFlightSpeed] > cruiseSpeed * 0.3))
|
||||||
|
{
|
||||||
cruiseSpeed = [other_ship maxFlightSpeed] * 0.99;
|
cruiseSpeed = [other_ship maxFlightSpeed] * 0.99;
|
||||||
|
}
|
||||||
|
|
||||||
OOLog(@"ship.escort.accept", @"Accepting existing escort %@.", other_ship);
|
OOLog(@"ship.escort.accept", @"Accepting existing escort %@.", other_ship);
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ enum
|
|||||||
kShip_cargoSpaceCapacity, // maximum cargo, integer, read-only
|
kShip_cargoSpaceCapacity, // maximum cargo, integer, read-only
|
||||||
kShip_cargoSpaceUsed, // cargo on board, integer, read-only
|
kShip_cargoSpaceUsed, // cargo on board, integer, read-only
|
||||||
kShip_contracts, // cargo contracts contracts, array - strings & whatnot, read only
|
kShip_contracts, // cargo contracts contracts, array - strings & whatnot, read only
|
||||||
|
kShip_cruiseSpeed, // desired cruising speed, number, read only
|
||||||
kShip_desiredSpeed, // AI desired flight speed, double, read/write
|
kShip_desiredSpeed, // AI desired flight speed, double, read/write
|
||||||
kShip_displayName, // name displayed on screen, string, read-only
|
kShip_displayName, // name displayed on screen, string, read-only
|
||||||
kShip_entityPersonality, // per-ship random number, int, read-only
|
kShip_entityPersonality, // per-ship random number, int, read-only
|
||||||
@ -208,6 +209,7 @@ static JSPropertySpec sShipProperties[] =
|
|||||||
{ "cargoSpaceAvailable", kShip_cargoSpaceAvailable, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
{ "cargoSpaceAvailable", kShip_cargoSpaceAvailable, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
// contracts instead of cargo to distinguish them from the manifest
|
// contracts instead of cargo to distinguish them from the manifest
|
||||||
{ "contracts", kShip_contracts, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
{ "contracts", kShip_contracts, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
|
{ "cruiseSpeed", kShip_cruiseSpeed, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
{ "desiredSpeed", kShip_desiredSpeed, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
{ "desiredSpeed", kShip_desiredSpeed, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||||
{ "displayName", kShip_displayName, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
{ "displayName", kShip_displayName, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||||
{ "entityPersonality", kShip_entityPersonality, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
{ "entityPersonality", kShip_entityPersonality, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
@ -536,6 +538,10 @@ static JSBool ShipGetProperty(OOJS_PROP_ARGS)
|
|||||||
OK = JS_NewDoubleValue(context, [entity flightSpeed], value);
|
OK = JS_NewDoubleValue(context, [entity flightSpeed], value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kShip_cruiseSpeed:
|
||||||
|
OK = JS_NewDoubleValue(context, [entity cruiseSpeed], value);
|
||||||
|
break;
|
||||||
|
|
||||||
case kShip_desiredSpeed:
|
case kShip_desiredSpeed:
|
||||||
OK = JS_NewDoubleValue(context, [entity desiredSpeed], value);
|
OK = JS_NewDoubleValue(context, [entity desiredSpeed], value);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user