Make Items Spoiling (or the script trigger) a separate event

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
PennyJim
Fast Inserter
Fast Inserter
Posts: 104
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Make Items Spoiling (or the script trigger) a separate event

Post by PennyJim »

Currently, everyone is using the spoil_trigger with a script trigger to react to special items spoiling. Using it to add features that simply aren't possible for various reasons.

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 heard that apparently the slot is no longer valid... That'll be disappointing if we don't get it, but it being optional isn't the end of the world.

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.
Post Reply

Return to “Modding interface requests”