Fixed Existing Lua Check Errors

This commit is contained in:
Cooldude2606
2020-05-26 18:21:10 +01:00
parent 2aaeb06be3
commit 32507492b8
76 changed files with 1622 additions and 1617 deletions

View File

@@ -8,16 +8,16 @@ local Global = require 'utils.global' --- @dep utils.global
require 'config.expcore.command_general_parse'
local homes = {}
Global.register(homes,function(tbl)
Global.register(homes, function(tbl)
homes = tbl
end)
local function teleport(player,position)
local function teleport(player, position)
local surface = player.surface
local pos = surface.find_non_colliding_position('character',position,32,1)
local pos = surface.find_non_colliding_position('character', position, 32, 1)
if not position then return false end
if player.driving then player.driving = false end -- kicks a player out a vehicle if in one
player.teleport(pos,surface)
player.teleport(pos, surface)
return true
end
@@ -30,22 +30,22 @@ end
--- Teleports you to your home location
-- @command home
Commands.new_command('home','Teleports you to your home location')
:register(function(player,raw)
Commands.new_command('home', 'Teleports you to your home location')
:register(function(player)
local home = homes[player.index]
if not home or not home[1] then
return Commands.error{'expcom-home.no-home'}
end
local rtn = floor_pos(player.position)
teleport(player,home[1])
teleport(player, home[1])
home[2] = rtn
Commands.print{'expcom-home.return-set',rtn.x,rtn.y}
Commands.print{'expcom-home.return-set', rtn.x, rtn.y}
end)
--- Sets your home location to your current position
-- @command home-set
Commands.new_command('home-set','Sets your home location to your current position')
:register(function(player,raw)
Commands.new_command('home-set', 'Sets your home location to your current position')
:register(function(player)
local home = homes[player.index]
if not home then
home = {}
@@ -53,31 +53,31 @@ Commands.new_command('home-set','Sets your home location to your current positio
end
local pos = floor_pos(player.position)
home[1] = pos
Commands.print{'expcom-home.home-set',pos.x,pos.y}
Commands.print{'expcom-home.home-set', pos.x, pos.y}
end)
--- Returns your current home location
-- @command home-get
Commands.new_command('home-get','Returns your current home location')
:register(function(player,raw)
Commands.new_command('home-get', 'Returns your current home location')
:register(function(player)
local home = homes[player.index]
if not home or not home[1] then
return Commands.error{'expcom-home.no-home'}
end
local pos = home[1]
Commands.print{'expcom-home.home-get',pos.x,pos.y}
Commands.print{'expcom-home.home-get', pos.x, pos.y}
end)
--- Teleports you to previous location
-- @command return
Commands.new_command('return','Teleports you to previous location')
:register(function(player,raw)
Commands.new_command('return', 'Teleports you to previous location')
:register(function(player)
local home = homes[player.index]
if not home or not home[2] then
return Commands.error{'expcom-home.no-return'}
end
local rtn = floor_pos(player.position)
teleport(player,home[2])
teleport(player, home[2])
home[2] = rtn
Commands.print{'expcom-home.return-set',rtn.x,rtn.y}
Commands.print{'expcom-home.return-set', rtn.x, rtn.y}
end)