1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-30 04:30:58 +02:00

Merge pull request #182 from JCA122204/patch-1

Remove unessecary lines (more)
This commit is contained in:
Valansch 2018-06-05 11:26:16 +02:00 committed by GitHub
commit bdbead938e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 64 deletions

View File

@ -51,9 +51,7 @@ local function player_joined_game(event)
spawn_name = get_min_count_spawn_name()
if not spawn_name then
return
end
if not spawn_name then return end
local spawn = global.spawns[spawn_name]
global.player_spawns[index] = spawn_name
@ -68,9 +66,7 @@ local function player_left_game(event)
local spawn_name = global.player_spawns[index]
local spawn = global.spawns[spawn_name]
if not spawn then
return
end
if not spawn then return end
local count = spawn.count
spawn.count = count - 1
@ -81,9 +77,7 @@ local function player_respawned(event)
local spawn_name = global.player_spawns[index]
local spawn = global.spawns[spawn_name]
if not spawn then
return
end
if not spawn then return end
game.players[index].teleport(spawn)
end
@ -143,10 +137,8 @@ end
local function print_spawns()
local str = ""
for name, spawn in pairs(global.spawns) do
str = str .. name .. ": (" .. spawn.x .. ", " .. spawn.y .. "), player count = " .. spawn.count .. "\n\r"
game.player.print(string.format("%s: (%d, %d), player count = %d", name, spawn.x, spawn.y, spawn.count))
end
game.player.print(str)
end
local function print_players_for_spawn(target_spawn_name)
@ -166,9 +158,7 @@ local function print_players_for_spawn(target_spawn_name)
end
end
if str == "" then
str = "no players"
end
if str == "" then str = "no players" end
game.player.print(str)
end
@ -189,11 +179,7 @@ local function tp_spawn_command(cmd)
table.insert( ps,p )
end
if #ps == 1 then
tp_spawn(game.player.name, ps[1])
else
tp_spawn(ps[1], ps[2])
end
if #ps == 1 then tp_spawn(game.player.name, ps[1]) else tp_spawn(ps[1], ps[2]) end
end
function change_spawn_command(cmd)
@ -209,9 +195,7 @@ function change_spawn_command(cmd)
end
local ps ={}
for p in params:gmatch("%S+") do
table.insert( ps,p )
end
for p in params:gmatch("%S+") do table.insert( ps,p ) end
change_spawn(ps[1], ps[2])
end
@ -238,9 +222,7 @@ local function print_players_for_spawn_command(cmd)
end
local ps ={}
for p in params:gmatch("%S+") do
table.insert( ps,p )
end
for p in params:gmatch("%S+") do table.insert( ps,p ) end
print_players_for_spawn(ps[1])
end
@ -252,4 +234,4 @@ Event.add(defines.events.on_player_respawned, player_respawned)
commands.add_command("tpspawn", "<player> <spawn_name> teleports a player to the spawn point (Admins only)", tp_spawn_command)
commands.add_command("changespawn", "<player> <spawn_name> changes the spawn point for a player (Admins only)", change_spawn_command)
commands.add_command("printspawns", "prints info on all spawn points (Admins only)", print_spawns_command)
commands.add_command("printplayersforspawn", "<spawn_name> prints all the connected players for a spawn (Admins only)", print_players_for_spawn_command)
commands.add_command("printplayersforspawn", "<spawn_name> prints all the connected players for a spawn (Admins only)", print_players_for_spawn_command)

View File

@ -87,14 +87,11 @@ local function tasklist(player)
global.tasklist_items[3] = frame.textfield_task_3.text
global.tasklist_items[4] = frame.textfield_task_4.text
global.tasklist_items[5] = frame.textfield_task_5.text
if (global.tasklist_items[5] .. global.tasklist_items[4] .. global.tasklist_items[3] .. global.tasklist_items[2] .. global.tasklist_items[1] == "") then
return
end
if (global.tasklist_items[5] .. global.tasklist_items[4] .. global.tasklist_items[3] .. global.tasklist_items[2] .. global.tasklist_items[1] == "") then return end
global.tasklist_author = player.name
local msg = player.name
msg = msg .. " has created an updated tasklist!"
local msg = player.name .. " has created an updated tasklist!"
local frame = player.gui.left["tasklist-assembler"]
frame.destroy()
@ -103,14 +100,9 @@ local function tasklist(player)
local frame = player.gui.left["tasklist-panel"]
if (frame) then
frame.destroy()
end
if (global.autoshow_tasklist_for_player[player.name] == true) then
tasklist_show(player)
end
if (frame) then frame.destroy() end
if (global.autoshow_tasklist_for_player[player.name] == true) then tasklist_show(player) end
end
game.print(msg)
@ -161,45 +153,27 @@ local function on_gui_click(event)
if (name == "tasklist") then
local frame = player.gui.left["tasklist-panel"]
if (frame) then
frame.destroy()
else
tasklist_show(player)
end
if (frame) then frame.destroy() else tasklist_show(player) end
local frame = player.gui.left["tasklist-assembler"]
if (frame) then
frame.destroy()
end
if (frame) then frame.destroy() end
end
if (name == "new_tasklist_assembler_button") then
local frame = player.gui.left["tasklist-assembler"]
if (frame) then
frame.destroy()
else
tasklist_assembler(player)
end
if (frame) then frame.destroy() else tasklist_assembler(player) end
end
if (name == "create_new_tasklist_button") then
tasklist(player)
end
if (name == "create_new_tasklist_button") then tasklist(player) end
if (name == "tasklist_hide_button") then
local frame = player.gui.left["tasklist-panel"]
if (frame) then
frame.destroy()
end
if (frame) then frame.destroy() end
local frame = player.gui.left["tasklist-assembler"]
if (frame) then
frame.destroy()
end
if (frame) then frame.destroy() end
end
if (name == "auto_show_tasklist_checkbox") then
global.autoshow_tasklist_for_player[player.name] = event.element.state
end
if (name == "auto_show_tasklist_checkbox") then global.autoshow_tasklist_for_player[player.name] = event.element.state end
end
Event.add(defines.events.on_gui_click, on_gui_click)