Add startable legacy code
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
--- Stores if you use alt mode or not and auto applies it
|
||||
-- @data Alt-View
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local Event = require("modules/exp_legacy/utils/event") ---@dep utils.event
|
||||
|
||||
--- Stores the visible state of alt mode
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local UsesAlt = PlayerData.Settings:combine('UsesAlt')
|
||||
UsesAlt:set_default(false)
|
||||
UsesAlt:set_metadata{
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@data Bonus
|
||||
]]
|
||||
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local config = require 'config.bonus' --- @dep config.bonuses
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.bonus") --- @dep config.bonuses
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
-- Stores the bonus for the player
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local PlayerBonus = PlayerData.Settings:combine('Bonus')
|
||||
PlayerBonus:set_default(0)
|
||||
PlayerBonus:set_metadata{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- Greets players on join
|
||||
-- @data Greetings
|
||||
|
||||
local config = require 'config.join_messages' --- @dep config.join_messages
|
||||
local Commands = require 'expcore.commands' ---@dep expcore.commands
|
||||
require 'config.expcore.command_general_parse'
|
||||
local config = require("modules.exp_legacy.config.join_messages") --- @dep config.join_messages
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") ---@dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
--- Stores the join message that the player have
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local CustomMessages = PlayerData.Settings:combine('JoinMessage')
|
||||
CustomMessages:set_metadata{
|
||||
permission = 'command/join-message'
|
||||
@@ -26,7 +26,7 @@ end)
|
||||
--- Set your custom join message
|
||||
-- @command join-message
|
||||
-- @tparam string message The custom join message that will be used
|
||||
Commands.new_command('join-message', {'expcom-join-message.description-msg'}, 'Sets your custom join message')
|
||||
Commands.new_command('join-message', 'Sets your custom join message')
|
||||
:add_param('message', false, 'string-max-length', 255)
|
||||
:enable_auto_concat()
|
||||
:register(function(player, message)
|
||||
@@ -35,7 +35,7 @@ Commands.new_command('join-message', {'expcom-join-message.description-msg'}, 'S
|
||||
return {'join-message.message-set'}
|
||||
end)
|
||||
|
||||
Commands.new_command('join-message-clear', {'expcom-join-message.description-clr'}, 'Clear your join message')
|
||||
Commands.new_command('join-message-clear', 'Clear your join message')
|
||||
:register(function(player)
|
||||
if not player then return end
|
||||
CustomMessages:remove(player)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- Stores the language used to join the server
|
||||
-- @data Language
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local Event = require("modules/exp_legacy/utils/event") ---@dep utils.event
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local LocalLanguage = PlayerData.Statistics:combine('LocalLanguage')
|
||||
LocalLanguage:set_default("Unknown")
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local config = require 'config.personal_logistic' --- @dep config.personal-logistic
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local config = require("modules.exp_legacy.config.personal_logistic") --- @dep config.personal-logistic
|
||||
|
||||
local pl = {}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- Gives players random colours when they join, also applies preset colours to those who have them
|
||||
-- @data Player-Colours
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
|
||||
local config = require 'config.preset_player_colours' --- @dep config.preset_player_colours
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local Colours = require("modules/exp_util/include/color")
|
||||
local config = require("modules.exp_legacy.config.preset_player_colours") --- @dep config.preset_player_colours
|
||||
|
||||
--- Stores the colour that the player wants
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local PlayerColours = PlayerData.Settings:combine('Colour')
|
||||
PlayerColours:set_metadata{
|
||||
stringify = function(value)
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
@data Quickbar
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local config = require("modules.exp_legacy.config.preset_player_quickbar") --- @dep config.preset_player_quickbar
|
||||
|
||||
--- Stores the quickbar filters for a player
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local PlayerFilters = PlayerData.Settings:combine('QuickbarFilters')
|
||||
PlayerFilters:set_metadata{
|
||||
permission = 'command/save-quickbar',
|
||||
@@ -41,7 +41,7 @@ local ignoredItems = {
|
||||
|
||||
--- Saves your quickbar preset to the script-output folder
|
||||
-- @command save-quickbar
|
||||
Commands.new_command('save-quickbar', {'expcom-quickbar.description'}, 'Saves your quickbar preset items to file')
|
||||
Commands.new_command('save-quickbar', 'Saves your Quickbar preset items to file')
|
||||
:add_alias('save-toolbar')
|
||||
:register(function(player)
|
||||
local filters = {}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
local Global = require 'utils.global' ---@dep utils.global
|
||||
local config = require 'config.statistics' ---@dep config.statistics
|
||||
local Event = require("modules/exp_legacy/utils/event") ---@dep utils.event
|
||||
local Storage = require("modules/exp_util/storage") ---@dep utils.global
|
||||
local config = require("modules.exp_legacy.config.statistics") ---@dep config.statistics
|
||||
local format_time = _C.format_time
|
||||
local floor = math.floor
|
||||
local afk_required = 5*3600 -- 5 minutes
|
||||
|
||||
--- Stores players who have been created, required to avoid loss of data
|
||||
local new_players = {}
|
||||
Global.register(new_players, function(tbl)
|
||||
Storage.register(new_players, function(tbl)
|
||||
new_players = tbl
|
||||
end)
|
||||
|
||||
--- Stores the statistics on a player
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local AllPlayerData = PlayerData.All
|
||||
local Statistics = PlayerData.Statistics
|
||||
Statistics:set_metadata{
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@data Tag
|
||||
]]
|
||||
|
||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||
require 'config.expcore.command_general_parse'
|
||||
require 'config.expcore.command_role_parse'
|
||||
require 'config.expcore.command_color_parse'
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
require("modules.exp_legacy.config.expcore.command_role_parse")
|
||||
require("modules.exp_legacy.config.expcore.command_color_parse")
|
||||
|
||||
--- Stores the tag for a player
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
|
||||
local PlayerTags = PlayerData.Settings:combine('Tag')
|
||||
local PlayerTagColors = PlayerData.Settings:combine('TagColor')
|
||||
PlayerTags:set_metadata{
|
||||
@@ -49,7 +49,7 @@ end)
|
||||
--- Sets your player tag.
|
||||
-- @command tag
|
||||
-- @tparam string tag the tag that will be after the name, there is a max length
|
||||
Commands.new_command('tag', {'expcom-tag.description'}, 'Sets your player tag.')
|
||||
Commands.new_command('tag', 'Sets your player tag.')
|
||||
:add_param('tag', false, 'string-max-length', 20)
|
||||
:enable_auto_concat()
|
||||
:register(function(player, tag)
|
||||
@@ -69,7 +69,7 @@ end)
|
||||
--- Clears your tag. Or another player if you are admin.
|
||||
-- @command tag-clear
|
||||
-- @tparam[opt=self] LuaPlayer player the player to remove the tag from, nil will apply to self
|
||||
Commands.new_command('tag-clear', {'expcom-tag.description-clear'}, 'Clears your tag. Or another player if you are admin.')
|
||||
Commands.new_command('tag-clear', 'Clears your tag. Or another player if you are admin.')
|
||||
:add_param('player', true, 'player-role')
|
||||
:set_defaults{player=function(player)
|
||||
return player -- default is the user using the command
|
||||
@@ -78,11 +78,9 @@ end}
|
||||
if action_player.index == player.index then
|
||||
-- no player given so removes your tag
|
||||
PlayerTags:remove(action_player)
|
||||
|
||||
elseif Roles.player_allowed(player, 'command/clear-tag/always') then
|
||||
-- player given and user is admin so clears that player's tag
|
||||
PlayerTags:remove(action_player)
|
||||
|
||||
else
|
||||
-- user is not admin and tried to clear another users tag
|
||||
return Commands.error{'expcore-commands.unauthorized'}
|
||||
|
||||
Reference in New Issue
Block a user