If raise_event() added a `.raised = true` to the table in second parameter then listeners would always be able to determine if the event came from the game or a mod. Mod-raised events would always have .raised=true
Code: Select all
-- example
script.on_event( defines.events.on_built_entity, function( data )
if data.raised then
-- i know a mod did this
else
-- it's vanilla event
end
end
In addition, it would be nice if the LuaSurface.create_entity(), LuaEntity.destroy(), etc, methods took optional additional parameter `send_event` which if `true` (default: `false`) would generate appropriate events containing `raised = true` in their data tables.