Make ship.entityPersonality writable

Use a fixed personality on the "new game" screen to stop flickering with
certain shipset OXPs
This commit is contained in:
cim 2015-04-23 18:57:12 +01:00
parent 279321ecc9
commit 9153f5b968
3 changed files with 15 additions and 2 deletions

View File

@ -136,6 +136,7 @@ Properties:
just player
* ship.scannerHostileDisplayColor1, ship.scannerHostileDisplayColor2
* ship.subEntityRotation
* ship.entityPersonality is now writable
* equipmentInfo.provides
* player.ship.forwardShield, player.ship.maxForwardShield,
player.ship.forwardShieldRechargeRate, player.ship.aftShield,

View File

@ -277,7 +277,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
- (void) addScenarioModel:(NSString *)shipKey
{
[self showShipModelWithKey:shipKey shipData:nil personality:ENTITY_PERSONALITY_INVALID factorX:1.2 factorY:0.8 factorZ:6.4 inContext:@"scenario"];
[self showShipModelWithKey:shipKey shipData:nil personality:0 factorX:1.2 factorY:0.8 factorZ:6.4 inContext:@"scenario"];
}

View File

@ -367,7 +367,7 @@ static JSPropertySpec sShipProperties[] =
{ "displayName", kShip_displayName, OOJS_PROP_READWRITE_CB },
{ "dockingInstructions", kShip_dockingInstructions, OOJS_PROP_READONLY_CB },
{ "energyRechargeRate", kShip_energyRechargeRate, OOJS_PROP_READWRITE_CB },
{ "entityPersonality", kShip_entityPersonality, OOJS_PROP_READONLY_CB },
{ "entityPersonality", kShip_entityPersonality, OOJS_PROP_READWRITE_CB },
{ "equipment", kShip_equipment, OOJS_PROP_READONLY_CB },
{ "escorts", kShip_escorts, OOJS_PROP_READONLY_CB },
{ "escortGroup", kShip_escortGroup, OOJS_PROP_READONLY_CB },
@ -1342,6 +1342,18 @@ static JSBool ShipSetProperty(JSContext *context, JSObject *this, jsid propID, J
}
break;
case kShip_entityPersonality:
if (JS_ValueToInt32(context, *value, &iValue))
{
if (iValue < 0 || iValue > ENTITY_PERSONALITY_MAX)
{
OOJSReportError(context, @"ship.%@ must be >= 0 and <= %u.", OOStringFromJSPropertyIDAndSpec(context, propID, sShipProperties),ENTITY_PERSONALITY_MAX);
return NO;
}
[entity setEntityPersonalityInt: iValue];
return YES;
}
case kShip_hyperspaceSpinTime:
if (JS_ValueToNumber(context, *value, &fValue))
{