diff --git a/bot.lua b/bot.lua new file mode 100644 index 00000000..261c6906 --- /dev/null +++ b/bot.lua @@ -0,0 +1,46 @@ +local Event = require "utils.event" + +Event.add(defines.events.on_player_died, function (event) + local player = event.player_index + if game.players[player].name ~= nil then + print("PLAYER$die," .. player .. "," .. game.players[player].name .. "," .. game.players[player].force.name) + end +end) + +Event.add(defines.events.on_player_respawned, function (event) + local player = event.player_index + if game.players[player].name ~= nil then + print("PLAYER$respawn," .. player .. "," .. game.players[player].name .. "," .. game.players[player].force.name) + end +end) + +Event.add(defines.events.on_player_joined_game, function (event) + local player = event.player_index + if game.players[player].name ~= nil then + print("PLAYER$join," .. player .. "," .. game.players[player].name .. "," .. game.players[player].force.name) + end +end) + +Event.add(defines.events.on_player_left_game, function (event) + local player = event.player_index + if game.players[player].name ~= nil then + print("PLAYER$leave," .. player .. "," .. game.players[player].name .. "," .. game.players[player].force.name) + end +end) + +function heartbeat() + --Do nothing, this is just so managepgm can call something as a heartbeat without any errors occurring +end + +function playerQuery() + if #game.connected_players == 0 then + print("output$pquery$none") + else + local response = "output&pquery$" + for _,player in pairs(game.connected_players) do + local playerdata = player.name .. "-" .. player.force.name + response = response .. playerdata .. "," + end + print(response:sub(1,#str-1)) + end +end \ No newline at end of file diff --git a/control.lua b/control.lua index 67b187d1..c9305fa0 100644 --- a/control.lua +++ b/control.lua @@ -1,4 +1,3 @@ -require "util" require "config" require "utils.utils" require "utils.list_utils" @@ -20,7 +19,7 @@ require "tasklist" require "autodeconstruct" require "corpse_util" require "reactor_meltdown" ---require "screenshot" +require "bot" local Event = require "utils.event" local function player_joined(event) diff --git a/custom_commands.lua b/custom_commands.lua index 2c184f8e..b01222e3 100644 --- a/custom_commands.lua +++ b/custom_commands.lua @@ -458,6 +458,17 @@ local function reactor_toggle() end end end + +local old_add_command = commands.add_command +commands.add_command = function(name, desc, func) + old_add_command(name, desc, function(cmd) + local success, error = pcall(func, cmd) + if not success then + log(error) + end + end) +end + commands.add_command("kill", "Will kill you.", kill) commands.add_command("tpplayer", " - Teleports you to the player. (Admins and moderators)", teleport_player) commands.add_command("invoke", " - Teleports the player to you. (Admins and moderators)", invoke) diff --git a/info.lua b/info.lua index 49f818e4..773eb720 100644 --- a/info.lua +++ b/info.lua @@ -13,7 +13,7 @@ local function create_info_button(event) button.style.bottom_padding = 2 button.style.vertically_stretchable = true button.style.vertically_squashable = true - button.style.vertical_spacing = 0 + --button.style.vertical_spacing = 0 -- this line logs an error when run. end end diff --git a/user_groups.lua b/user_groups.lua index 3233be8e..7ef1c595 100644 --- a/user_groups.lua +++ b/user_groups.lua @@ -1,5 +1,5 @@ global.mods = {} -global.regualrs = {} +global.regulars = {} function update_group(position) local file = position .. ".lua"