Added quickbar preset command

This commit is contained in:
Kevin Taylor
2020-05-16 16:36:38 +01:00
parent e880e58998
commit a52f447ff9
3 changed files with 35 additions and 0 deletions

View File

@@ -141,6 +141,7 @@ Roles.new_role('Sponsor','Spon')
'command/home-get',
'command/return',
'fast-tree-decon',
'command/load-quickbar'
}
Roles.new_role('Supporter','Sup')

View 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'}
}
}

View 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)