I'm trying to find a way to detect when a player adds, removes, or changes the modules in a drill or assembling machine.
Is there an event that triggers for this? or a way to work around to check modules after gui closed?
Detect when modules changed
Re: Detect when modules changed
Code: Select all
script.on_event(defines.events.on_gui_closed, function(event)
if not event.entity then return end
local module_slots = event.entity.prototype.module_inventory_size
if not module_slots or module_slots == 0 then return end
game.print("modules were potentially edited")
end)
Re: Detect when modules changed
Ctrl-click triggers the on_player_fast_transferred eventDaveMcW wrote: Sat Jul 20, 2019 11:15 amI don't think there is a way to detect a Ctrl+click. Or a construction robot module delivery.Code: Select all
script.on_event(defines.events.on_gui_closed, function(event) if not event.entity then return end local module_slots = event.entity.prototype.module_inventory_size if not module_slots or module_slots == 0 then return end game.print("modules were potentially edited") end)