202{
203 if (!JSID_IS_INT(propID)) return YES;
204
206
207 OOPlanetEntity *planet =
nil;
208 NSString *sValue =
nil;
209 Quaternion qValue;
210 Vector vValue;
211 jsdouble dValue;
213
214 if (!JSPlanetGetPlanetEntity(context, this, &planet)) return NO;
215
216 switch (JSID_TO_INT(propID))
217 {
220 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
221 {
222 [planet setAirColor:colorForScript];
223 return YES;
224 }
225 break;
226
228 if (JS_ValueToNumber(context, *value, &dValue))
229 {
230 [planet setAirColorMixRatio:dValue];
231 return YES;
232 }
233 break;
234
236 if (JS_ValueToNumber(context, *value, &dValue))
237 {
238 [planet setAirDensity:dValue];
239 return YES;
240 }
241 break;
242
245 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
246 {
247 [planet setIlluminationColor:colorForScript];
248 return YES;
249 }
250 break;
251
254 [planet setName:sValue];
255 return YES;
256
258 {
259 BOOL OK = NO;
261
263
264 if ([planet isKindOfClass:[OOPlanetEntity class]])
265 {
267 {
269 }
270 else
271 {
272 OK = YES;
273 }
274 }
275
276 if (OK)
277 {
278 OK = [planet setUpPlanetFromTexture:sValue];
279 if (!OK)
OOJSReportWarning(context,
@"Cannot find texture \"%@\
". Value not set.", sValue);
280 }
281
283
284 return YES;
285 }
286
289 {
290 quaternion_normalize(&qValue);
291 [planet setOrientation:qValue];
292 return YES;
293 }
294 break;
295
297 if (JS_ValueToNumber(context, *value, &dValue))
298 {
299 [planet setRotationalVelocity:dValue];
300 return YES;
301 }
302 break;
303
306 {
307 [planet setTerminatorThresholdVector:vValue];
308 return YES;
309 }
310 break;
311
312 default:
314 return NO;
315 }
316
318 return NO;
319
321}
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)
OOColor * colorWithDescription:(id description)