From c7c505b3b5628f07dfeaaa6861f07106f6630503 Mon Sep 17 00:00:00 2001 From: bbassie Date: Tue, 9 Feb 2021 22:21:11 +0100 Subject: [PATCH 1/3] Basic implentation of a last location command --- config/_file_loader.lua | 1 + config/expcore/roles.lua | 1 + locale/en/commands.cfg | 5 ++++- modules/commands/last-location.lua | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 modules/commands/last-location.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 12550b98..16a135af 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -28,6 +28,7 @@ return { 'modules.commands.find', 'modules.commands.home', 'modules.commands.connect', + 'modules.commands.last-location', --- Addons 'modules.addons.chat-popups', diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 00ee0439..90752bc4 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -174,6 +174,7 @@ Roles.new_role('Veteran','Vet') :set_parent('Member') :allow{ 'command/chat-bot', + 'command/last-location' } :set_auto_assign_condition(function(player) if player.online_time >= hours10 then diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index 57f7754c..729f4ef5 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -79,4 +79,7 @@ too-many-matching=Multiple server were found with the given name: __1__ wrong-version=Servers were found but are on a different version: __1__ same-server=You are already connected to the server: __1__ offline=You cannot connect as the server is currently offline: __1__ -none-matching=No servers were found with that name, if you used an address please append true to the end of your command. \ No newline at end of file +none-matching=No servers were found with that name, if you used an address please append true to the end of your command. + +[expcom-lastlocation] +response=Last location of __1__ is [gps=__2__,__3__] \ No newline at end of file diff --git a/modules/commands/last-location.lua b/modules/commands/last-location.lua new file mode 100644 index 00000000..5e626e53 --- /dev/null +++ b/modules/commands/last-location.lua @@ -0,0 +1,19 @@ +--[[-- Commands Module - Last location + - Adds a command that will return the last location of a player + @commands LastLocation +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.common +require 'config.expcore.command_general_parse' + +--- Get the last location of a player. +-- @command last-location +-- @tparam LuaPlayer player the player that you want a location of +Commands.new_command('last-location', 'Sends you a warning') +:add_param('player', false, 'player-role') +:set_flag('admin_only') +:register(function(player, action_player) + local action_player_name_color = format_chat_player_name(action_player) + player.print{'expcom-lastlocation.response', action_player_name_color, action_player.position.x, action_player.position.y} +end) \ No newline at end of file From 928b06953935a1e0e66c5ac866d44dff0ce47aed Mon Sep 17 00:00:00 2001 From: bbassie Date: Tue, 9 Feb 2021 22:23:37 +0100 Subject: [PATCH 2/3] Help msg fix --- modules/commands/last-location.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/commands/last-location.lua b/modules/commands/last-location.lua index 5e626e53..35730117 100644 --- a/modules/commands/last-location.lua +++ b/modules/commands/last-location.lua @@ -10,7 +10,7 @@ require 'config.expcore.command_general_parse' --- Get the last location of a player. -- @command last-location -- @tparam LuaPlayer player the player that you want a location of -Commands.new_command('last-location', 'Sends you a warning') +Commands.new_command('last-location', 'Sends you the last location of a player') :add_param('player', false, 'player-role') :set_flag('admin_only') :register(function(player, action_player) From 2b451c562ed90b6c20d70c14808be19a389d55e0 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 30 Mar 2021 04:08:17 +0100 Subject: [PATCH 3/3] Made requested changes --- locale/en/commands.cfg | 2 +- modules/commands/last-location.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index 729f4ef5..dea7b935 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -82,4 +82,4 @@ offline=You cannot connect as the server is currently offline: __1__ none-matching=No servers were found with that name, if you used an address please append true to the end of your command. [expcom-lastlocation] -response=Last location of __1__ is [gps=__2__,__3__] \ No newline at end of file +response=Last location of __1__ was [gps=__2__,__3__] \ No newline at end of file diff --git a/modules/commands/last-location.lua b/modules/commands/last-location.lua index 35730117..b020efc4 100644 --- a/modules/commands/last-location.lua +++ b/modules/commands/last-location.lua @@ -11,8 +11,8 @@ require 'config.expcore.command_general_parse' -- @command last-location -- @tparam LuaPlayer player the player that you want a location of Commands.new_command('last-location', 'Sends you the last location of a player') -:add_param('player', false, 'player-role') -:set_flag('admin_only') +:add_alias('location') +:add_param('player', false, 'player') :register(function(player, action_player) local action_player_name_color = format_chat_player_name(action_player) player.print{'expcom-lastlocation.response', action_player_name_color, action_player.position.x, action_player.position.y}