178{
180
181 OOPlanetEntity* planet =
nil;
182 NSString* sValue =
nil;
185 double dValue;
187
188 if (!JSPlanetGetPlanetEntity(context, this, &planet))
190
191 switch (magic) {
194 if (colorForScript !=
nil || JS_IsNull(value)) {
195 [planet setAirColor:colorForScript];
196 return JS_UNDEFINED;
197 }
198 break;
199
201 if (JS_ToFloat64(context, &dValue, value) == 0) {
202 [planet setAirColorMixRatio:dValue];
203 return JS_UNDEFINED;
204 }
205 break;
206
208 if (JS_ToFloat64(context, &dValue, value) == 0) {
209 [planet setAirDensity:dValue];
210 return JS_UNDEFINED;
211 }
212 break;
213
216 if (colorForScript !=
nil || JS_IsNull(value)) {
217 [planet setIlluminationColor:colorForScript];
218 return JS_UNDEFINED;
219 }
220 break;
221
224 [planet setName:sValue];
225 return JS_UNDEFINED;
226
228 BOOL OK = NO;
230
232
233 if ([planet isKindOfClass:[OOPlanetEntity class]]) {
236 } else {
237 OK = YES;
238 }
239 }
240
241 if (OK) {
242 OK = [planet setUpPlanetFromTexture:sValue];
243 if (!OK)
244 OOJSReportWarning(context,
@"Cannot find texture \"%@\
". Value not set.", sValue);
245 }
246
248
249 return JS_UNDEFINED;
250 }
251
255 [planet setOrientation:qValue];
256 return JS_UNDEFINED;
257 }
258 break;
259
261 if (JS_ToFloat64(context, &dValue, value) == 0) {
262 [planet setRotationalVelocity:dValue];
263 return JS_UNDEFINED;
264 }
265 break;
266
269 [planet setTerminatorThresholdVector:vValue];
270 return JS_UNDEFINED;
271 }
272 break;
273
274 default:
277 }
278
281
283}
BOOL JSValueToQuaternion(JSContext *context, jsval value, Quaternion *outQuaternion) NONNULL_FUNC
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
void OOJSPauseTimeLimiter(void)
void OOJSReportWarning(JSContext *context, NSString *format,...)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
void OOJSResumeTimeLimiter(void)
OOINLINE void quaternion_normalize(Quaternion *quat) NONNULL_FUNC ALWAYS_INLINE_FUNC
OOColor * colorWithDescription:(id description)