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

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

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

#1 Post 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).

Nagyhal
Wyrmic
Posts: 282
Joined: Tue Feb 15, 2011 12:01 am

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

#2 Post 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.)

Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

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

#3 Post 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 :(

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

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

#4 Post 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?
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

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

#5 Post 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. :?
"Blessed are the yeeks, for they shall inherit Arda..."

Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

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

#6 Post 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 :)

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

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

#7 Post 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 :/
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Zireael
Archmage
Posts: 449
Joined: Tue Jun 18, 2013 7:24 pm

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

#8 Post 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 :)

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

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

#9 Post 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 ;)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply