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 add, parse = Commands.add_data_type, Commands.parse_input
local valid, invalid = Commands.status.success, Commands.status.invalid_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 local types = {} --- @class Commands._types
--- A boolean value where true is one of: yes, y, true, 1 --- A boolean value where true is one of: yes, y, true, 1
@@ -229,4 +231,29 @@ types.color =
end end
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 return types

View File

@@ -27,6 +27,7 @@ force=Invalid Force Name.
surface=Invalid Surface Name. surface=Invalid Surface Name.
planet=Invalid Planet Name. planet=Invalid Planet Name.
color=Invalid Color Name. color=Invalid Color Name.
role=Invalid Role Name.
[exp-commands-authorities] [exp-commands-authorities]
character-only=This command can not be used in remote view. character-only=This command can not be used in remote view.

View File

@@ -27,6 +27,7 @@ force=勢力名稱錯誤。
surface=地表名稱錯誤。 surface=地表名稱錯誤。
planet=星球名稱錯誤。 planet=星球名稱錯誤。
color=顏色名稱錯誤。 color=顏色名稱錯誤。
role=權限組名稱錯誤。
[exp-commands-authorities] [exp-commands-authorities]
character-only=該命令不能在遠端視圖中使用。 character-only=該命令不能在遠端視圖中使用。

View File

@@ -27,6 +27,7 @@ force=勢力名稱錯誤。
surface=地表名稱錯誤。 surface=地表名稱錯誤。
planet=星球名稱錯誤。 planet=星球名稱錯誤。
color=顏色名稱錯誤。 color=顏色名稱錯誤。
role=權限組名稱錯誤。
[exp-commands-authorities] [exp-commands-authorities]
character-only=該命令不能在遠端視圖中使用。 character-only=該命令不能在遠端視圖中使用。