Add equipmentRepaired worldscript event
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4873 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
4038d0a9ec
commit
a48c4dfee0
@ -6806,11 +6806,13 @@ static NSString *last_outfitting_key=nil;
|
||||
double price = pricePerUnit;
|
||||
double priceFactor = 1.0;
|
||||
OOCreditsQuantity tradeIn = 0;
|
||||
BOOL isRepair = NO;
|
||||
|
||||
// repairs cost 50%
|
||||
if ([self hasEquipmentItem:eqKeyDamaged])
|
||||
{
|
||||
price /= 2.0;
|
||||
isRepair = YES;
|
||||
}
|
||||
|
||||
if ([eqKey isEqualToString:@"EQ_RENOVATION"])
|
||||
@ -6996,6 +6998,10 @@ static NSString *last_outfitting_key=nil;
|
||||
{
|
||||
credits -= price;
|
||||
[self addEquipmentItem:eqKey withValidation:NO]; // no need to validate twice.
|
||||
if (isRepair)
|
||||
{
|
||||
[self doScriptEvent:OOJSID("equipmentRepaired") withArgument:eqKey];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -1817,7 +1817,15 @@ static JSBool ShipSetEquipmentStatus(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
// these player methods are different to the ship ones.
|
||||
[(PlayerEntity*)thisEnt addEquipmentItem:(hasOK ? damagedKey : key) withValidation:NO];
|
||||
if (hasOK) [(PlayerEntity*)thisEnt doScriptEvent:OOJSID("equipmentDamaged") withArgument:key];
|
||||
if (hasOK)
|
||||
{
|
||||
[(PlayerEntity*)thisEnt doScriptEvent:OOJSID("equipmentDamaged") withArgument:key];
|
||||
}
|
||||
else if (hasDamaged)
|
||||
{
|
||||
[(PlayerEntity*)thisEnt doScriptEvent:OOJSID("equipmentRepaired") withArgument:key];
|
||||
}
|
||||
|
||||
// if player's Docking Computers are set to EQUIPMENT_DAMAGED while on, stop them
|
||||
if (hasOK && [key isEqualToString:@"EQ_DOCK_COMP"]) [(PlayerEntity*)thisEnt disengageAutopilot];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user