From b9435d08baa2d2aaddaa4b96e69310469926caf7 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 26 Oct 2018 16:20:09 +0100 Subject: [PATCH] Bug Fixes Round One --- modules/ExpGamingCommands/teleport/control.lua | 2 +- modules/ExpGamingCore/Command/control.lua | 3 ++- modules/ExpGamingCore/Gui/control.lua | 1 + modules/ExpGamingCore/Role/control.lua | 1 + modules/WarpPoints/control.lua | 2 +- modules/WarpPoints/src/commands.lua | 4 ++-- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/ExpGamingCommands/teleport/control.lua b/modules/ExpGamingCommands/teleport/control.lua index 00c73250..b2abdf47 100644 --- a/modules/ExpGamingCommands/teleport/control.lua +++ b/modules/ExpGamingCommands/teleport/control.lua @@ -3,7 +3,7 @@ -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -local Admin = require('ExpGamingAdmin.Teleport@^4.0.0') +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') --- Teleports the user to the player given -- @command go-to diff --git a/modules/ExpGamingCore/Command/control.lua b/modules/ExpGamingCore/Command/control.lua index 3d463c9d..43197867 100644 --- a/modules/ExpGamingCore/Command/control.lua +++ b/modules/ExpGamingCore/Command/control.lua @@ -146,7 +146,8 @@ function commands.validate_args(event) index = index+1 if not word then break end local pos, _pos = word:find('"') - while pos and pos == _pos do + local hasSecond = pos and word:find('"',pos+1) or nil + while not hasSecond and pos and pos == _pos do local next = table.remove(words,index+1) if not next then return commands.error('invalid-parse') end words[index] = words[index]..' '..next diff --git a/modules/ExpGamingCore/Gui/control.lua b/modules/ExpGamingCore/Gui/control.lua index bb864a27..9c20d668 100644 --- a/modules/ExpGamingCore/Gui/control.lua +++ b/modules/ExpGamingCore/Gui/control.lua @@ -180,6 +180,7 @@ script.on_event('on_tick', function(event) end) script.on_event('on_player_respawned',function(event) + if Gui.center then Gui.center.clear() end if loaded_modules['ExpGamingCore.Server'] then return end if global.players and is_type(global.players,'table') and #global.players > 0 and global.players[event.player_index] then local remove = {} diff --git a/modules/ExpGamingCore/Role/control.lua b/modules/ExpGamingCore/Role/control.lua index 97bb1cb1..5098dd9e 100644 --- a/modules/ExpGamingCore/Role/control.lua +++ b/modules/ExpGamingCore/Role/control.lua @@ -327,6 +327,7 @@ function Role._prototype:get_players(online) if not self_test(self,'role','get_players') then return end if online and not type_error(online,'boolean','Invalid argument #1 to role:get_players, online is not a boolean.') then return end if not global.roles[self.name] then global.roles[self.name] = {} end + if self.is_default then if online then return game.connected_players else return game.players end end local rtn = {} for _,player_index in pairs(global.roles[self.name]) do local player = game.players[player_index] diff --git a/modules/WarpPoints/control.lua b/modules/WarpPoints/control.lua index 604292f0..2674d4b8 100644 --- a/modules/WarpPoints/control.lua +++ b/modules/WarpPoints/control.lua @@ -241,7 +241,7 @@ script.on_event(defines.events.on_player_created, function(event) text='Warp: Spawn', icon={type='item',name=warp_item} }) - global.warps['Spawn'] = {tag=tag,surface=player.surface.index,position={0,0}} + global.warps['Spawn'] = {tag=tag,surface=player.surface.index,position={x=0,y=0}} end end) diff --git a/modules/WarpPoints/src/commands.lua b/modules/WarpPoints/src/commands.lua index b90bb899..89e4cb2b 100644 --- a/modules/WarpPoints/src/commands.lua +++ b/modules/WarpPoints/src/commands.lua @@ -11,8 +11,8 @@ commands.add_command('make-warp', 'Make a warp point at your location', { if game.player.gui.top[name] then player_return({'WarpPoints.name-used'},defines.textcolor.med) return commands.error end if warps.warps[name] then player_return({'WarpPoints.name-used'},defines.textcolor.med) return commands.error end for name,warp in pairs(warps.warps) do - local dx = position.x-warp.position[1] - local dy = position.y-warp.position[2] + local dx = position.x-warp.position.x + local dy = position.y-warp.position.y if dx^2 + dy^2 < warp_min_distance then player_return({'WarpPoints.too-close'},defines.textcolor.med) return commands.error end end -- to do add a test for all warps