void on_decay(int freshness)

Called whenever an object decays. The parameter refers to how rotten the
object is. The higher the score, the more rotten it is. When the rottenness
hits the maximum returned by query_perishable(), it self-destructs.

Within the on_decay function, you can send messages saying that the object
is rotting away or similar. You can also speed up or slow down the decay by
calling set_decay. For example, if you call set_decay(0) every time, you
will make the object never decay at all.
