36@implementation Entity (OOJavaScriptExtensions)
48- (JSValue)oo_jsValueInContext:(JSContext*)context
52 _jsSelf = JS_NewObjectClass(context, (
int)[
self oo_jsClassID]);
53 if (JS_IsException(_jsSelf)) {
54 JS_FreeValue(context, JS_GetException(context));
55 _jsSelf = JS_UNDEFINED;
59 [[NSNotificationCenter defaultCenter] addObserver:
self
60 selector:@selector(deleteJSSelf)
61 name:kOOJavaScriptEngineWillResetNotification
66 if (JS_IsObject(_jsSelf))
67 return JS_DupValue(context, _jsSelf);
80 if (JS_IsObject(_jsSelf)) {
86 _jsSelf = JS_UNDEFINED;
89 name:kOOJavaScriptEngineWillResetNotification
96@implementation ShipEntity (OOJavaScriptExtensions)
98- (BOOL)isVisibleToScripts
108- (NSString*)oo_jsClassName
123 while ([me isSubEntity]) {
124 if (me == [me owner] || [me owner] ==
nil)
128 while ([target isSubEntity]) {
129 if (target == [target owner] || [target owner] ==
nil)
id OOConsumeReference(id OO_NS_CONSUMED value)
OOINLINE JSContext * OOJSAcquireContext(void)
JSClassID JSEntityClassID(void)
JSClassID JSShipClassID(void)
BOOL isVisibleToScripts()
NSString * oo_jsClassName()
NSArray * subEntitiesForScript()
OOJavaScriptEngine * sharedEngine()
void addTarget:(Entity *targetEntity)
void removeTarget:(Entity *targetEntity)
NSEnumerator * shipSubEntityEnumerator()