Adds weaponInfo to EquipmentInfo script obbject
parent
682878fc9d
commit
bd4a0c4887
|
@ -142,6 +142,7 @@ SOFTWARE.
|
|||
// weapon properties
|
||||
- (BOOL) isTurretLaser;
|
||||
- (BOOL) isMiningLaser;
|
||||
- (NSDictionary *) weaponInfo;
|
||||
- (GLfloat) weaponRange;
|
||||
- (GLfloat) weaponEnergyUse;
|
||||
- (GLfloat) weaponDamage;
|
||||
|
|
|
@ -630,6 +630,12 @@ static NSDictionary *sMissilesRegistry = nil;
|
|||
}
|
||||
|
||||
|
||||
- (NSDictionary *) weaponInfo
|
||||
{
|
||||
return _weaponInfo;
|
||||
}
|
||||
|
||||
|
||||
- (GLfloat) weaponRange
|
||||
{
|
||||
return [_weaponInfo oo_floatForKey:@"range" defaultValue:12500.0];
|
||||
|
|
|
@ -77,7 +77,8 @@ enum
|
|||
kEquipmentInfo_requiresNonFullFuel,
|
||||
kEquipmentInfo_scriptInfo, // arbitrary data for scripts, dictionary, read-only
|
||||
kEquipmentInfo_scriptName,
|
||||
kEquipmentInfo_techLevel
|
||||
kEquipmentInfo_techLevel,
|
||||
kEquipmentInfo_weaponInfo
|
||||
};
|
||||
|
||||
|
||||
|
@ -117,6 +118,7 @@ static JSPropertySpec sEquipmentInfoProperties[] =
|
|||
{ "scriptInfo", kEquipmentInfo_scriptInfo, OOJS_PROP_READONLY_CB },
|
||||
{ "scriptName", kEquipmentInfo_scriptName, OOJS_PROP_READONLY_CB },
|
||||
{ "techLevel", kEquipmentInfo_techLevel, OOJS_PROP_READONLY_CB },
|
||||
{ "weaponInfo", kEquipmentInfo_weaponInfo, OOJS_PROP_READONLY_CB },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -390,6 +392,11 @@ static JSBool EquipmentInfoGetProperty(JSContext *context, JSObject *this, jsid
|
|||
if (result == nil) result = @"";
|
||||
break;
|
||||
|
||||
case kEquipmentInfo_weaponInfo:
|
||||
result = [eqType weaponInfo];
|
||||
if (result == nil) result = [NSDictionary dictionary]; // empty rather than null
|
||||
break;
|
||||
|
||||
default:
|
||||
OOJSReportBadPropertySelector(context, this, propID, sEquipmentInfoProperties);
|
||||
return NO;
|
||||
|
|
Loading…
Reference in New Issue