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

@@ -9,18 +9,18 @@ local Roles = require 'expcore.roles' --- @dep expcore.roles
local function teleport(player)
local surface = player.surface
local spawn = player.force.get_spawn_position(surface)
local position = surface.find_non_colliding_position('character',spawn,32,1)
local position = surface.find_non_colliding_position('character', spawn, 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(position,surface)
player.teleport(position, surface)
return true
end
--- Teleport to spawn
-- @command go-to-spawn
-- @tparam[opt=self] LuaPlayer player the player to teleport to their spawn point
Commands.new_command('go-to-spawn','Teleport to spawn')
:add_param('player',true,'player-role-alive')
Commands.new_command('go-to-spawn', 'Teleport to spawn')
:add_param('player', true, 'player-role-alive')
:set_defaults{
player=function(player)
if player.connected and player.character and player.character.health > 0 then
@@ -28,15 +28,15 @@ Commands.new_command('go-to-spawn','Teleport to spawn')
end
end
}
:add_alias('spawn','tp-spawn')
:register(function(player,action_player)
if not action_player then
:add_alias('spawn', 'tp-spawn')
:register(function(player, action_player)
if not action_player then
return Commands.error{'expcom-spawn.unavailable'}
elseif action_player == player then
if not teleport(player) then
return Commands.error{'expcom-spawn.unavailable'}
end
elseif Roles.player_allowed(player,'command/go-to-spawn/always') then
elseif Roles.player_allowed(player, 'command/go-to-spawn/always') then
if not teleport(action_player) then
return Commands.error{'expcom-spawn.unavailable'}
end