Page 1 of 1
Detect when modules changed
Posted: Sat Jul 20, 2019 8:42 am
by mat1k
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?
Re: Detect when modules changed
Posted: Sat Jul 20, 2019 11:15 am
by DaveMcW
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)
I don't think there is a way to detect a Ctrl+click. Or a construction robot module delivery.
Re: Detect when modules changed
Posted: Sat Jul 20, 2019 6:43 pm
by darkfrei
Re: Detect when modules changed
Posted: Sat Jul 20, 2019 6:57 pm
by mat1k
DaveMcW wrote: Sat Jul 20, 2019 11:15 am
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)
I don't think there is a way to detect a Ctrl+click. Or a construction robot module delivery.
Ctrl-click triggers the
on_player_fast_transferred event