mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Added command find
This commit is contained in:
@@ -22,6 +22,7 @@ return {
|
|||||||
'modules.commands.reports',
|
'modules.commands.reports',
|
||||||
'modules.commands.spawn',
|
'modules.commands.spawn',
|
||||||
'modules.commands.warnings',
|
'modules.commands.warnings',
|
||||||
|
'modules.commands.find',
|
||||||
-- QoL Addons
|
-- QoL Addons
|
||||||
'modules.addons.chat-popups',
|
'modules.addons.chat-popups',
|
||||||
'modules.addons.damage-popups',
|
'modules.addons.damage-popups',
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ return {
|
|||||||
['command/report'] = {
|
['command/report'] = {
|
||||||
auth=function(player,action_player_name)
|
auth=function(player,action_player_name)
|
||||||
if not Roles.player_allowed(player,'command/give-warning') then
|
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
|
||||||
end,
|
end,
|
||||||
reason_callback=report_player_callback,
|
reason_callback=report_player_callback,
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ local default = Roles.new_role('Guest','')
|
|||||||
'command/tag-clear',
|
'command/tag-clear',
|
||||||
'command/chelp',
|
'command/chelp',
|
||||||
'command/list-roles',
|
'command/list-roles',
|
||||||
|
'command/find-on-map',
|
||||||
'command/report',
|
'command/report',
|
||||||
'gui/player-list',
|
'gui/player-list',
|
||||||
}
|
}
|
||||||
|
|||||||
11
modules/commands/find.lua
Normal file
11
modules/commands/find.lua
Normal file
@@ -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)
|
||||||
@@ -11,6 +11,15 @@ local Colors = require 'resources.color_presets'
|
|||||||
local action_player_store = 'gui.left.player-list.action-player'
|
local action_player_store = 'gui.left.player-list.action-player'
|
||||||
local action_name_store = 'gui.left.player-list.action-name'
|
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
|
--- Button used to open the action bar
|
||||||
local open_action_bar =
|
local open_action_bar =
|
||||||
Gui.new_button()
|
Gui.new_button()
|
||||||
@@ -204,9 +213,17 @@ end
|
|||||||
local function add_player(list_table,player,role_name)
|
local function add_player(list_table,player,role_name)
|
||||||
open_action_bar(list_table,player.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
|
-- player name with the tooltip of their highest role and in they colour
|
||||||
local player_name =
|
local player_name =
|
||||||
list_table.add{
|
player_name_flow.add{
|
||||||
|
name=zoom_to_map_name,
|
||||||
type='label',
|
type='label',
|
||||||
caption=player.name,
|
caption=player.name,
|
||||||
tooltip=player.name..' '..player.tag..'\n'..role_name
|
tooltip=player.name..' '..player.tag..'\n'..role_name
|
||||||
|
|||||||
Reference in New Issue
Block a user