This commit is contained in:
2024-12-30 16:09:23 +09:00
parent 3e4318fcab
commit 80cd1245e5
4 changed files with 30 additions and 0 deletions

View File

@@ -25,6 +25,8 @@ local Commands = require("modules/exp_commands")
local add, parse = Commands.add_data_type, Commands.parse_input
local valid, invalid = Commands.status.success, Commands.status.invalid_input
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
local types = {} --- @class Commands._types
--- A boolean value where true is one of: yes, y, true, 1
@@ -229,4 +231,29 @@ types.color =
end
end)
--- A player who has joined the game at least once, with a lower role
types.lower_role_player =
add("player", function(input, player)
local player_i = game.get_player(input)
local player = game.get_player(player)
if Roles.get_player_highest_role(player_i).index <= Roles.get_player_highest_role(player).index then
return invalid{ "exp-commands-parse.player", input }
else
return valid(player)
end
end)
--- A role that is lower than given user
types.lower_role =
add("role", function(input)
local player = game.get_player(input)
if Roles.config.roles[input] and (Roles.config.roles[input].index >= Roles.get_player_highest_role(player).index) then
return valid(player)
else
return invalid{ "exp-commands-parse.role", input }
end
end)
return types