39static JSBool
WaypointGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value);
40static JSBool
WaypointSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value);
56 JSCLASS_NO_OPTIONAL_MEMBERS
104 if (outEntity == NULL)
return NO;
107 result = OOJSEntityGetEntity(context, wormholeObj, &entity);
108 if (!result)
return NO;
119@implementation OOWaypointEntity (OOJavaScriptExtensions)
121- (void)getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype
143 if (!JSID_IS_INT(propID))
return YES;
152 if (entity ==
nil) { *value = JSVAL_VOID;
return YES; }
154 switch (JSID_TO_INT(propID))
166 if (![entity oriented])
173 return JS_NewNumberValue(context, [entity
size], value);
187static JSBool
WaypointSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value)
189 if (!JSID_IS_INT(propID))
return YES;
195 NSString *sValue =
nil;
199 if (entity ==
nil)
return YES;
201 switch (JSID_TO_INT(propID))
205 if (sValue ==
nil || [sValue length] == 0)
207 if ([entity isBeacon])
209 [UNIVERSE clearBeacon:entity];
210 if ([
PLAYER nextBeacon] == entity)
212 [PLAYER setCompassMode:COMPASS_MODE_PLANET];
218 if ([entity isBeacon])
225 [UNIVERSE setNextBeacon:entity];
249 if (JS_ValueToNumber(context, *value, &fValue))
#define OOJS_PROFILE_EXIT
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_PROFILE_ENTER
OOINLINE JSClass * JSEntityClass(void)
OOINLINE JSObject * JSEntityPrototype(void)
BOOL JSValueToQuaternion(JSContext *context, jsval value, Quaternion *outQuaternion) NONNULL_FUNC
BOOL QuaternionToJSValue(JSContext *context, Quaternion quaternion, jsval *outValue) NONNULL_FUNC
static JSPropertySpec sWaypointProperties[]
static JSObject * sWaypointPrototype
static JSClass sWaypointClass
static JSBool WaypointSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSFunctionSpec sWaypointMethods[]
static BOOL JSWaypointGetWaypointEntity(JSContext *context, JSObject *stationObj, OOWaypointEntity **outEntity)
void InitOOJSWaypoint(JSContext *context, JSObject *global)
static JSBool WaypointGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
#define OOJS_PROP_READWRITE_CB
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
void OOJSRegisterSubclass(JSClass *subclass, JSClass *superclass)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
const Quaternion kIdentityQuaternion
const Quaternion kZeroQuaternion
BOOL isVisibleToScripts()
NSString * oo_jsClassName()
void setNormalOrientation:(Quaternion quat)
void setBeaconLabel:(NSString *blabel)
void setBeaconCode:(NSString *bcode)
void setSize:(OOScalar newSize)