Bugfix for bug #13041:resolved odd behaviour with 'U': 1) if scanner enhancement is present, the hud will confirm both missiles on safety & ident system deactivation.
2) Scrolling through targets from inactive ident system doesn't change missiles status anymore. Added Ship.commsMessage('msg') to replace Ship.call('commsMessage:','msg') - no apparent conflict with Player.commsMessage(); git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1630 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
83395a7db3
commit
bde0379e85
@ -6161,6 +6161,7 @@ OOSound* burnersound;
|
||||
if (potential_target->zero_distance < SCANNER_MAX_RANGE2)
|
||||
{
|
||||
[super addTarget:potential_target];
|
||||
if (missile_status == MISSILE_STATUS_SAFE) ident_engaged = YES;
|
||||
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
||||
[self printIdentLockedOnForMissile:!ident_engaged];
|
||||
[self playTargetSwitched];
|
||||
|
@ -659,7 +659,7 @@ static NSTimeInterval time_last_frame;
|
||||
primaryTarget = NO_TARGET;
|
||||
ident_engaged = YES;
|
||||
[self playIdentOn];
|
||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[ident-on]") forCount:2.0];
|
||||
[UNIVERSE addMessage:DESC(@"ident-on") forCount:2.0];
|
||||
}
|
||||
ident_pressed = YES;
|
||||
}
|
||||
@ -690,13 +690,13 @@ static NSTimeInterval time_last_frame;
|
||||
{
|
||||
if (missile_entity[activeMissile])
|
||||
[missile_entity[activeMissile] removeTarget:nil];
|
||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[missile-armed]") forCount:2.0];
|
||||
[UNIVERSE addMessage:DESC(@"missile-armed") forCount:2.0];
|
||||
[self playMissileArmed];
|
||||
}
|
||||
}
|
||||
if ([missile_entity[activeMissile] isMine])
|
||||
{
|
||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[mine-armed]") forCount:4.5];
|
||||
[UNIVERSE addMessage:DESC(@"mine-armed") forCount:4.5];
|
||||
[self playMineArmed];
|
||||
}
|
||||
ident_engaged = NO;
|
||||
@ -711,22 +711,22 @@ static NSTimeInterval time_last_frame;
|
||||
{
|
||||
if (!safety_pressed)
|
||||
{
|
||||
//targetting off in both cases!
|
||||
if (!ident_engaged)
|
||||
{
|
||||
// targetting 'off' here
|
||||
missile_status = MISSILE_STATUS_SAFE;
|
||||
if (missile_status !=MISSILE_STATUS_SAFE)
|
||||
[UNIVERSE addMessage:[NSString stringWithFormat:@"%@ %@", DESC(@"missile-safe"), (primaryTarget != NO_TARGET && [self hasEquipmentItem:@"EQ_SCANNER_SHOW_MISSILE_TARGET"])? DESC(@"ident-off") : @""] forCount:2.5];
|
||||
primaryTarget = NO_TARGET;
|
||||
[self safeAllMissiles];
|
||||
[self playMissileSafe];
|
||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[missile-safe]") forCount:2.0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// targetting 'back on' here
|
||||
primaryTarget = [missile_entity[activeMissile] primaryTargetID];
|
||||
missile_status = (primaryTarget != NO_TARGET)? MISSILE_STATUS_TARGET_LOCKED : MISSILE_STATUS_SAFE;
|
||||
primaryTarget = NO_TARGET;
|
||||
[self safeAllMissiles];
|
||||
[self playIdentOff];
|
||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[ident-off]") forCount:2.0];
|
||||
[UNIVERSE addMessage:DESC(@"ident-off") forCount:2.0];
|
||||
}
|
||||
ident_engaged = NO;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ static JSBool ShipDumpCargo(JSContext *context, JSObject *this, uintN argc, jsva
|
||||
static JSBool ShipSpawn(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool ShipExplode(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool ShipRunLegacyScriptActions(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool ShipCommsMessage(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
|
||||
|
||||
static JSExtendedClass sShipClass =
|
||||
@ -191,6 +192,7 @@ static JSFunctionSpec sShipMethods[] =
|
||||
{ "runLegacyScriptActions", ShipRunLegacyScriptActions, 2 },
|
||||
{ "spawn", ShipSpawn, 1 },
|
||||
{ "explode", ShipExplode, 0 },
|
||||
{ "commsMessage", ShipCommsMessage, 1 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -866,3 +868,22 @@ static JSBool ShipRunLegacyScriptActions(JSContext *context, JSObject *this, uin
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
static JSBool ShipCommsMessage(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||
{
|
||||
ShipEntity *thisEnt = nil;
|
||||
NSString *msg = nil;
|
||||
|
||||
if (!JSShipGetShipEntity(context, this, &thisEnt)) return YES; // stale reference, no-op.
|
||||
msg = [NSString stringWithJavaScriptValue:*argv inContext:context];
|
||||
|
||||
if (msg != nil)
|
||||
{
|
||||
if (!thisEnt->isPlayer)
|
||||
{
|
||||
[thisEnt commsMessage:msg withUnpilotedOverride:YES];
|
||||
}
|
||||
//else: player.commsMessage handles this already.
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user