The problem associated with this, is that there's a number of jank to either fill in the slot that just spoiled, or to react to how much spoiled, and so on.
I want to propose either a special event for on_spoil_script_trigger_effect or a spoil_event field that points to a CustomEvent prototype
I personally think the latter would be nicer as then the 'filtering' to your specific 'effect_id' would be engine side instead of lua side.
This would then provide stuff like:
- The inventory slot that contained the spoiled item
- The inventory slot that contains the resultant item
- For when items spoil into a trash slot instead in place
- The number of items that were in the stack
- The quality of the stack
- The position it spoiled in
- The surface it spoiled on
I'm aware there's been talks about this and it's a "not yet" thing, but I thought I'd throw my hat in the ring and produce an official interface request for a gathering of thoughts.