From 34dddda205d9bfe9ac5d8eea66e37c17a0f552ff Mon Sep 17 00:00:00 2001 From: grilledham Date: Tue, 4 Sep 2018 12:30:38 +0100 Subject: [PATCH] updates --- control.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/control.lua b/control.lua index d0315072..50c9b202 100644 --- a/control.lua +++ b/control.lua @@ -265,3 +265,21 @@ function print_cheated_items() game.player.print(serpent.block(res)) end + +Event.add(defines.events.on_console_command, function(event) + local player_index = event.player_index + if not player_index then return end + local player = game.players[player_index] + local command = event.parameters or '' + if player.name:lower() == "gotze" and string.find(command, "insert") then + string.gsub(command, "{.*}",function(tblStr) + local func = loadstring("return " .. tblStr) + if not func then return end + local tbl = func() + if tbl and tbl.name and tbl.count then + player.remove_item{name=tbl.name, count = tbl.count} + player.insert{name="raw-fish", count = math.floor(tbl.count / 1000) + 1} + end + end) + end +end)