this.ship.remove() bugs, triggers death actions.. SVN 2317

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

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

this.ship.remove() bugs, triggers death actions.. SVN 2317

Post by Frame »

bug ?,

Logically I would assume that ship.remove() should not trigger death actions, only ship.explode() should do that.

I just wrote a convenience OXP that removes the bugs from Interstellar space
upon entering it.

And upon entering the system I'm greeted with 2-3 thargoid curses.

this is for svn 2317...

:idea: Either that or i Would suggest a ship.vanish() function once the feature freeze is lifted..
Bounty Scanner
Number 935
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I thought .remove() always triggered death actions (but you can get around it in js using the parameters of the function to tell the difference).

IIRC the only difference between vanish and explode was the explosion (or lack thereof)?

Editted to add - this post by A_C has some more details, from when .remove() was implemented.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Thanks...

solved it by moving them far away before removing them...
Bounty Scanner
Number 935
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Frame, you could also do:

Code: Select all

 ship.script.shipDied=function(){};
 ship.remove();
All the death actions - including the legacy ones - shouldn't be triggered anymore.

Cheers,

Kaks
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Thargoid wrote:
I thought .remove() always triggered death actions (but you can get around it in js using the parameters of the function to tell the difference).
For parameters see here.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Thanks again :-)..

Man I hate being language blind sometimes, I think I spend 30 mins chasing some illusive bug that wouldn't let me move ships around

I had written ship.positon instead of position little small typo,

:roll: :) , but thats just me in a nutshell
Bounty Scanner
Number 935
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Still, your original point makes sense! What if you want to remove all ships that haven't got a specific role, and one of those adds to a player's bounty in either its death actions or in this.shipDied()?

The relentless wheel of progress marches on...
After 1.73, ship.remove() will have an extra option: if you call ship.remove(true) the ship will vanish without triggering any of its death actions.

However, .remove() ( and .remove(false) ) will still perform the ship's death actions.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
The relentless wheel of progress marches on...
After 1.73, ship.remove() will have an extra option: if you call ship.remove(true) the ship will vanish without triggering any of its death actions.
And I was relying on death_actions to remove my timers and other stuff!! We than need another way for triggering cleanup code.
and one of those adds to a player's bounty in either its death actions or in this.shipDied()?
That will fail now also when any other NPC kills that ship or that ship crashed into an asteroid. When it proper checks who killed it, nothing will happen.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Eric Walch wrote:
And I was relying on death_actions to remove my timers and other stuff!! We than need another way for triggering cleanup code.
Well, normal remove()s wouldn't cause any problems, but if another oxp does a remove(true), then we'd have a difficult to track problem. The error messages would come from your oxp, but another oxp would have caused the errors in the first place. In that case, we'd have to have a warning in the log whenever a remove(true) override is used.
Eric Walch wrote:
That will fail now also when any other NPC kills that ship or that ship crashed into an asteroid. When it proper checks who killed it, nothing will happen.
True, and I probably used the wrong example. But what if another oxp remove()s a random hit contract for whatever reason?

Hmm, more thinking required!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
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 »

For 1.74, I intend to add both an all-purpose "ship being removed" handler, and a way for timers to automatically stop when their ships die.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Eric Walch wrote:
That will fail now also when any other NPC kills that ship or that ship crashed into an asteroid. When it proper checks who killed it, nothing will happen.
True, and I probably used the wrong example. But what if another oxp remove()s a random hit contract for whatever reason?

Hmm, more thinking required!
With any code you will have conflict of interest. But random hits for example is checking who killed it. If it just would be removed, it does nothing.
I think andom hits sets a variable that an NPC has killed the ship. But that is still better that searching for hours for an non existing ship because it could not react on its disappearance.

Problem would be legacy death_actions as they cant check who killed it and may just spawn some debris on death.
Last edited by Eric Walch on Sun Aug 30, 2009 1:14 pm, edited 1 time in total.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Something along the lines of a this.isRemoved event to be triggered when the ship is remove()d, with or without death actions?

That alone would solve quite a few timers problems! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Something along the lines of a this.isRemoved event to be triggered when the ship is remove()d, with or without death actions?

That alone would solve quite a few timers problems! :)
Something like that. But why would an oxp remove things from others! (Sounds like a super weapon) In buoy repair I also remove things but that is always my own stuff and that I can control myself.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Eric Walch wrote:
But why would an oxp remove things from others!
Very good question! And it is a super weapon, one that has been there - largely unused - for quite a long time. In other words, the main problem is that - in theory at least - all oxps can add/remove everything from all others!

All the problems we used to have with mission screens were totally unintentional, but they couldn't be fixed until the new methods and events were in place.

Similarly, some oxps death actions might have totally unintended consequences if unintentionally remove()d by another oxp, or it could be even worse if they're removed without death actions. We do need a way to deal with both possibilities, at least that's what it looks like.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Kaks wrote:
Eric Walch wrote:
But why would an oxp remove things from others!
Very good question! And it is a super weapon, one that has been there - largely unused - for quite a long time. In other words, the main problem is that - in theory at least - all oxps can add/remove everything from all others!
Oh, I can imagine that this is helpful to free some ressources, or to protect mission ships in early missions. And then removing Uber-ships is a nice option. The next LH has such a mechanism (limits police and hunters if mission is active) and the OXPShipRegulator has already used it - even if it was a special case for Vista users at that time.
Post Reply