run_command require_pos: also check WEA pos subsystem

This commit is contained in:
Starbeamrainbowlabs 2022-09-25 02:02:23 +01:00
parent 363acde496
commit 268e123221
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2

@ -14,14 +14,18 @@ local function run_command_stage2(player_name, func, parse_result)
end
local function run_command(cmdname, options, player_name, paramtext)
if options.require_pos > 0 and not worldedit.pos1[player_name] then
if options.require_pos > 0 and not worldedit.pos1[player_name] and not wea_c.pos.get1(player_name) then
worldedit.player_notify(player_name, "Error: pos1 must be selected to use this command.")
return false
end
if options.require_pos > 1 and not worldedit.pos2[player_name] then
if options.require_pos > 1 and not worldedit.pos2[player_name] and not wea_c.pos.get2(player_name) then
worldedit.player_notify(player_name, "Error: Both pos1 and pos2 must be selected (together making a region) to use this command.")
return false
end
local pos_count = wea_c.pos.count(player_name)
if options.require_pos > 2 and pos_count < options.require_pos then
worldedit.player_notify(player_name, "Error: At least "..options.require_pos.."positions must be defined to use this command, but you only have "..pos_count.." defined (try using the multiwand).")
end
local parse_result = { options.parse(paramtext) }
local success = table.remove(parse_result, 1)