Page 1 of 1

Objects should have an equivalent to actor's die() function

Posted: Sat Aug 01, 2015 6:11 pm
by Zireael
... so that they can be destroyed more easily. Instead of iterating over the whole map, I'm counting down torches' light and corpses' freshness in the item's act function. Now the only thing left is to remove them. Currently doing it from the Object class requires hacky solutions (see Zizzo's tome2 port).

Re: Objects should have an equivalent to actor's die() funct

Posted: Fri Nov 27, 2015 5:03 pm
by Nagyhal
Hey, Zireael. Yours and Zizzo's modules both require this feature, and those are pretty much the two coolest modules out there. So it seems this is an essential feature for module creators, even if it's not needed by ToME!

I shall do what I can do to try and get this feature cooked into the engine.

(Can you or Zizzo create a nice object die() function yourselves to be uploaded into the engine repository - or at least to share with other module creators? I haven't looked at the code yet so I don't know how feasible this is without fuckery.)

Re: Objects should have an equivalent to actor's die() funct

Posted: Fri Nov 27, 2015 7:55 pm
by Zireael
I can't and Zizzo's code seems to involve "fuckery".

Also apologies for not noticing sooner - Real Life snuck up on me :(

Re: Objects should have an equivalent to actor's die() funct

Posted: Fri Nov 27, 2015 10:11 pm
by darkgod
/me uses a scroll of save from real life on Zireael !

On a more serious note, what exactly would :die do exactly in your mind?

Re: Objects should have an equivalent to actor's die() funct

Posted: Sat Nov 28, 2015 1:36 am
by Zizzo
Zireael wrote:I can't and Zizzo's code seems to involve "fuckery".
:shock: *blink* I'm... almost afraid to ask which bit of my code we're talking about. :?

Re: Objects should have an equivalent to actor's die() funct

Posted: Sat Nov 28, 2015 7:44 am
by Zireael
darkgod wrote:On a more serious note, what exactly would :die do exactly in your mind?
Well, it would remove the objects from the map without moving them anywhere. Sorta like picking up, but without placing the item in the actor's inventory. And most importantly, it would be called by the object itself and not the actor. (Actors picking up and/or destroying items can already be done - what I have in mind is objects being removed on a one-by-one scale - for instance, by a targeted talent or upon cooldown expiring).

...
I've just imagined ToME 4 wands or inscriptions (epic/legendary) exploding/disintegrating after a random number of uses :)

Re: Objects should have an equivalent to actor's die() funct

Posted: Sat Nov 28, 2015 11:35 am
by darkgod
Ah I see, but then it wouldnt be logical to have it only work for map; :die on an item worn by an actor would need to remove it too.
But objects dont know where they are; for map they could store the map coords, but for actors it would create nasty circular references.
Not a very easy thing really :/

Re: Objects should have an equivalent to actor's die() funct

Posted: Sat Nov 28, 2015 12:48 pm
by Zireael
Putting it somewhere in map works, too. As I said, we can already add/remove objects worn by actors without fuss. It's the unworn objects that are difficult to remove :)

Re: Objects should have an equivalent to actor's die() funct

Posted: Sat Nov 28, 2015 12:53 pm
by darkgod
Removing from an actor is not a method of he object it's a method of the actor though.
Removing from the map is the same:
map:removeObject(x, y, map:findObject(x, y, o))

only works in 1.4 though, in 1.3 you need to iterate over the items in that spot to emualte findObject ;)