diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 24c135c7..ca4405fd 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -22,6 +22,7 @@ return { 'modules.commands.reports', 'modules.commands.spawn', 'modules.commands.warnings', + 'modules.commands.find', -- QoL Addons 'modules.addons.chat-popups', 'modules.addons.damage-popups', diff --git a/config/action_buttons.lua b/config/action_buttons.lua index b3da006a..cd48100d 100644 --- a/config/action_buttons.lua +++ b/config/action_buttons.lua @@ -184,7 +184,7 @@ return { ['command/report'] = { auth=function(player,action_player_name) if not Roles.player_allowed(player,'command/give-warning') then - return auth_lower_role(player,action_player_name) + return not Roles.player_has_flag(action_player_name,'report-immune') end end, reason_callback=report_player_callback, diff --git a/config/roles.lua b/config/roles.lua index 3fe9c615..3604d31a 100644 --- a/config/roles.lua +++ b/config/roles.lua @@ -182,6 +182,7 @@ local default = Roles.new_role('Guest','') 'command/tag-clear', 'command/chelp', 'command/list-roles', + 'command/find-on-map', 'command/report', 'gui/player-list', } diff --git a/modules/commands/find.lua b/modules/commands/find.lua new file mode 100644 index 00000000..ee242b1b --- /dev/null +++ b/modules/commands/find.lua @@ -0,0 +1,11 @@ +local Commands = require 'expcore.commands' +require 'config.expcore-commands.parse_general' + +Commands.new_command('find-on-map','Find a player on your map.') +:add_param('player',false,'player-online') -- the player to find on the map +:add_alias('find','zoom-to') +:register(function(player,action_player,raw) + local position = action_player.position + player.zoom_to_world(position,2) + return Commands.success -- prevents command complete message from showing +end) \ No newline at end of file diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index e5b6e51b..9987b341 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -11,6 +11,15 @@ local Colors = require 'resources.color_presets' local action_player_store = 'gui.left.player-list.action-player' local action_name_store = 'gui.left.player-list.action-name' +--- used on player name label to allow zoom to map +local zoom_to_map_name = Gui.uid_name() +Gui.on_click(zoom_to_map_name,function(event) + local action_player_name = event.element.caption + local action_player = Game.get_player_from_any(action_player_name) + local position = action_player.position + event.player.zoom_to_world(position,2) +end) + --- Button used to open the action bar local open_action_bar = Gui.new_button() @@ -204,9 +213,17 @@ end local function add_player(list_table,player,role_name) open_action_bar(list_table,player.name) + -- flow to contain player_name to allow all to have trigger for zoom to map + local player_name_flow = + list_table.add{ + type='flow' + } + Gui.set_padding(player_name_flow) + -- player name with the tooltip of their highest role and in they colour local player_name = - list_table.add{ + player_name_flow.add{ + name=zoom_to_map_name, type='label', caption=player.name, tooltip=player.name..' '..player.tag..'\n'..role_name