system.allDemoShips property
This commit is contained in:
parent
b834b1a19a
commit
293e74fd05
@ -155,6 +155,7 @@ New properties:
|
||||
* station.allegiance
|
||||
* station.market[*].legalPenalty
|
||||
* sun.name
|
||||
* system.allDemoShips
|
||||
* system.populatorSettings
|
||||
* system.stations
|
||||
* system.waypoints
|
||||
|
@ -110,6 +110,7 @@ static JSClass sSystemClass =
|
||||
enum
|
||||
{
|
||||
// Property IDs
|
||||
kSystem_allDemoShips, // demo ships, array of Ship, read-only
|
||||
kSystem_allShips, // ships in system, array of Ship, read-only
|
||||
kSystem_allVisualEffects, // VEs in system, array of VEs, read-only
|
||||
kSystem_breakPattern, // witchspace break pattern shown
|
||||
@ -144,6 +145,7 @@ enum
|
||||
static JSPropertySpec sSystemProperties[] =
|
||||
{
|
||||
// JS name ID flags
|
||||
{ "allDemoShips", kSystem_allDemoShips, OOJS_PROP_READONLY_CB },
|
||||
{ "allShips", kSystem_allShips, OOJS_PROP_READONLY_CB },
|
||||
{ "allVisualEffects", kSystem_allVisualEffects, OOJS_PROP_READONLY_CB },
|
||||
{ "breakPattern", kSystem_breakPattern, OOJS_PROP_READWRITE_CB },
|
||||
@ -293,6 +295,14 @@ static JSBool SystemGetProperty(JSContext *context, JSObject *this, jsid propID,
|
||||
handled = YES;
|
||||
break;
|
||||
|
||||
case kSystem_allDemoShips:
|
||||
OOJS_BEGIN_FULL_NATIVE(context)
|
||||
result = [UNIVERSE findShipsMatchingPredicate:JSEntityIsDemoShipPredicate parameter:NULL inRange:-1 ofEntity:nil];
|
||||
OOJS_END_FULL_NATIVE
|
||||
handled = YES;
|
||||
break;
|
||||
|
||||
|
||||
case kSystem_allVisualEffects:
|
||||
OOJS_BEGIN_FULL_NATIVE(context)
|
||||
result = [UNIVERSE findVisualEffectsMatchingPredicate:JSEntityIsJavaScriptSearchablePredicate parameter:NULL inRange:-1 ofEntity:nil];
|
||||
|
@ -352,6 +352,9 @@ BOOL JSEntityIsJavaScriptVisiblePredicate(Entity *entity, void *parameter);
|
||||
// YES for ships other than sub-entities and menu-display ships, and planets other than atmospheres and menu miniatures. Parameter: ignored.
|
||||
BOOL JSEntityIsJavaScriptSearchablePredicate(Entity *entity, void *parameter);
|
||||
|
||||
// YES for menu-display ships. Parameter: ignored
|
||||
BOOL JSEntityIsDemoShipPredicate(Entity *entity, void *parameter);
|
||||
|
||||
|
||||
// These require a request on context.
|
||||
id OOJSNativeObjectFromJSValue(JSContext *context, jsval value);
|
||||
|
@ -2118,6 +2118,11 @@ BOOL JSEntityIsJavaScriptSearchablePredicate(Entity *entity, void *parameter)
|
||||
}
|
||||
|
||||
|
||||
BOOL JSEntityIsDemoShipPredicate(Entity *entity, void *parameter)
|
||||
{
|
||||
return ([entity isVisibleToScripts] && [entity isShip] && [entity status] == STATUS_COCKPIT_DISPLAY && ![entity isSubEntity]);
|
||||
}
|
||||
|
||||
static NSMapTable *sRegisteredSubClasses;
|
||||
|
||||
void OOJSRegisterSubclass(JSClass *subclass, JSClass *superclass)
|
||||
|
Loading…
x
Reference in New Issue
Block a user