mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Added quickbar preset command
This commit is contained in:
@@ -141,6 +141,7 @@ Roles.new_role('Sponsor','Spon')
|
|||||||
'command/home-get',
|
'command/home-get',
|
||||||
'command/return',
|
'command/return',
|
||||||
'fast-tree-decon',
|
'fast-tree-decon',
|
||||||
|
'command/load-quickbar'
|
||||||
}
|
}
|
||||||
|
|
||||||
Roles.new_role('Supporter','Sup')
|
Roles.new_role('Supporter','Sup')
|
||||||
|
|||||||
8
config/preset_player_quickbar.lua
Normal file
8
config/preset_player_quickbar.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
--- Preset quickbar items that players can load
|
||||||
|
-- @config Preset-Player-Quickbar
|
||||||
|
|
||||||
|
return {
|
||||||
|
players={ --- @setting players list of all players and their quickbar items
|
||||||
|
dangerarea={'transport-belt','fast-transport-belt'}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
modules/commands/quickbar.lua
Normal file
26
modules/commands/quickbar.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
--[[-- Commands Module - Quickbar
|
||||||
|
- Adds a command that allows players to load Quickbar presets
|
||||||
|
@commands LoadQuickbar
|
||||||
|
]]
|
||||||
|
|
||||||
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
|
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||||
|
local Game = require 'utils.game' --- @dep utils.game
|
||||||
|
local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar
|
||||||
|
require 'config.expcore.command_general_parse'
|
||||||
|
|
||||||
|
|
||||||
|
--- Changes the amount of bonus you receive
|
||||||
|
-- @command bonus
|
||||||
|
-- @tparam number amount range 0-50 the percent increase for your bonus
|
||||||
|
Commands.new_command('load-quickbar','Loads your preset Quickbar items')
|
||||||
|
:register(function(player)
|
||||||
|
if config.players[player.name] then
|
||||||
|
local custom_quickbar = config.players[player.name]
|
||||||
|
for i, item_name in ipairs(custom_quickbar) do
|
||||||
|
player.set_quick_bar_slot(i, item_name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Commands.print('Quickbar preset not found','red')
|
||||||
|
end
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user