mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-25 10:10:41 +01:00
Allow more commands for brush usage
In fact, allow all commands that are compatible by the brush: the ones that expect exactly pos1 to be set
This commit is contained in:
parent
7833b68c85
commit
9c38b9f6ad
@ -5,34 +5,6 @@ if minetest.raycast == nil then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local BRUSH_MAX_DIST = 150
|
local BRUSH_MAX_DIST = 150
|
||||||
local BRUSH_ALLOWED_COMMANDS = {
|
|
||||||
-- basically everything that only needs pos1
|
|
||||||
-- TODO: determine automatically now that `require_pos` exists
|
|
||||||
"cube",
|
|
||||||
"cylinder",
|
|
||||||
"dome",
|
|
||||||
"hollowcube",
|
|
||||||
"hollowcylinder",
|
|
||||||
"hollowdome",
|
|
||||||
"hollowpyramid",
|
|
||||||
"hollowsphere",
|
|
||||||
"load",
|
|
||||||
"pyramid",
|
|
||||||
"sphere",
|
|
||||||
"spiral",
|
|
||||||
|
|
||||||
"cyl",
|
|
||||||
"do",
|
|
||||||
"hcube",
|
|
||||||
"hcyl",
|
|
||||||
"hdo",
|
|
||||||
"hpyr",
|
|
||||||
"hspr",
|
|
||||||
"l",
|
|
||||||
"pyr",
|
|
||||||
"spr",
|
|
||||||
"spl",
|
|
||||||
}
|
|
||||||
local brush_on_use = function(itemstack, placer)
|
local brush_on_use = function(itemstack, placer)
|
||||||
local meta = itemstack:get_meta()
|
local meta = itemstack:get_meta()
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
@ -127,11 +99,8 @@ worldedit.register_command("brush", {
|
|||||||
meta:from_table(nil)
|
meta:from_table(nil)
|
||||||
worldedit.player_notify(name, "Brush assignment cleared.")
|
worldedit.player_notify(name, "Brush assignment cleared.")
|
||||||
else
|
else
|
||||||
local cmddef
|
local cmddef = worldedit.registered_commands[cmd]
|
||||||
if table.indexof(BRUSH_ALLOWED_COMMANDS, cmd) ~= -1 then
|
if cmddef == nil or cmddef.require_pos ~= 1 then
|
||||||
cmddef = worldedit.registered_commands[cmd]
|
|
||||||
end
|
|
||||||
if cmddef == nil then
|
|
||||||
worldedit.player_notify(name, "Invalid command for brush use: //" .. cmd)
|
worldedit.player_notify(name, "Invalid command for brush use: //" .. cmd)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user