1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Merge branch 'develop' into small_fixes

This commit is contained in:
grilledham 2018-05-07 13:44:47 +01:00 committed by GitHub
commit 5425f5c216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

46
bot.lua Normal file
View File

@ -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

View File

@ -19,6 +19,7 @@ require "tasklist"
require "autodeconstruct"
require "corpse_util"
require "reactor_meltdown"
require "bot"
local Event = require "utils.event"
local function player_joined(event)