isValid

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

isValid

Post by Eric Walch »

I think the property "isValid" is handled wrong. I defined a variable "this.target" in the debug console. It was a cargo item. Then I shot it away. When I now call for the variable I only get back "[object Ship]". I can use this string to check if an entity still exists. That works well, but the official way was to use the method: "valid()". However, when used with 1.72 I get the message it is deprecated and I should use the property "isValid". But when an entity dies, this property is also cleared. I think it was mend that this property is set to false after clearing all properties.

Code: Select all

> this.target
[Ship "Fuel cannister" ID: 234 position: (113120, -22813, 533539) scanClass: CLASS_CARGO status: STATUS_IN_FLIGHT]
> this.target
[object Ship]
> this.target.isValid
> this.target.valid()
Warning: Entity.valid() is deprecated, use Entity.isValid property instead.
    Active script: "oolite-debug-console" 1.71
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Fixed. In 1.72, isValid will work (and every other property will be undefined).
Post Reply