Update all code styles

This commit is contained in:
Cooldude2606
2024-09-28 01:56:54 +01:00
parent 5e2a62ab27
commit 292c1a1b68
194 changed files with 9817 additions and 9703 deletions

View File

@@ -11,26 +11,24 @@ require("modules.exp_legacy.config.expcore.command_role_parse")
--- Kills yourself or another player.
-- @command kill
-- @tparam[opt=self] LuaPlayer player the player to kill, must be alive to be valid
Commands.new_command('kill', {'expcom-kill.description'}, 'Kills yourself or another player.')
:add_param('player', true, 'player-role-alive')
:set_defaults{player=function(player)
-- default is the player unless they are dead
if player.character and player.character.health > 0 then
return player
end
end}
:register(function(player, action_player)
if not action_player then
-- can only be nil if no player given and the user is dead
return Commands.error{'expcom-kill.already-dead'}
end
if player == action_player then
action_player.character.die()
elseif Roles.player_allowed(player, 'command/kill/always') then
action_player.character.die()
else
return Commands.error{'expcore-commands.unauthorized'}
end
end)
Commands.new_command("kill", { "expcom-kill.description" }, "Kills yourself or another player.")
:add_param("player", true, "player-role-alive")
:set_defaults{ player = function(player)
-- default is the player unless they are dead
if player.character and player.character.health > 0 then
return player
end
end }
:register(function(player, action_player)
if not action_player then
-- can only be nil if no player given and the user is dead
return Commands.error{ "expcom-kill.already-dead" }
end
if player == action_player then
action_player.character.die()
elseif Roles.player_allowed(player, "command/kill/always") then
action_player.character.die()
else
return Commands.error{ "expcore-commands.unauthorized" }
end
end)