Sep 27, 2016, 8:09 pm
So, as far as I can tell life expectancy of mirrored and spoiling items works as follows:
Any ideas about how you will prevent mirrored items from disappearing prematurely in the shop? Zolku stops his bananas spoiling somehow...
A mirrored or spoiling item is enabled, so that it gets processed on each game tick. This processing happens when item::Be() is called. item::Be() first calls MainMaterial->Be(). The material asks the item if it is allowed to spoil, and the item only says no if it's on the ground in a room that disallows spoiling. A room disallows spoiling if it's a shop with an enabled (conscious? alive?) shopkeeper and the item isn't worthless.
If the item is allowed to spoil, the spoil counter is increased etc. etc.
After the spoil check, item::Be() checks for life expectancy. If it's 0, it's not mirrored, nothing happens. If it's 1, the mirrored item disappears. otherwise, the mirrored item's life expectancy decreases.
It seems like it would be pretty easy to put a condition on the life expectancy code block just like for spoilage. It could use the same item::AllowSpoil() function, or a different item::AllowLifeExpectancy() function that only works for the Mondedr shop.
If it was done that way, the player would be able to use [the Mondedr] shop to preserve mirrored items that they want to use later. Of course, they can already do that by leaving the item on a different map, so that probably wouldn't affect balance.
I don't think creatures with a life expectancy (angels and mirrored creatures) call item::Be(), so that probably wouldn't let the player keep archangels indefinitely by locking them in a shop.