selection: Improve message shown to players

This commit is contained in:
Starbeamrainbowlabs 2022-01-02 13:19:31 +00:00
parent dc5f8f0753
commit d9204e95b5
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 11 additions and 1 deletions

View file

@ -43,6 +43,7 @@ Note to self: See the bottom of this file for the release template text.
- Fix crash if no arguments are specified - Fix crash if no arguments are specified
- Fix automatic seed when generating many mazes in the same second (e.g. with `//for`, `//many`) - Fix automatic seed when generating many mazes in the same second (e.g. with `//for`, `//many`)
- `//convolve`: Fix those super tall pillars appearing randomly - `//convolve`: Fix those super tall pillars appearing randomly
- cloud wand: improve feedback messages sent to players
## v1.12: The selection tools update (26th June 2021) ## v1.12: The selection tools update (26th June 2021)

View file

@ -13,6 +13,7 @@ local selection = {}
-- @param pos vector The position to include. -- @param pos vector The position to include.
function selection.add_point(name, pos) function selection.add_point(name, pos)
if pos ~= nil then if pos ~= nil then
local created_new = not worldedit.pos1[name] or not worldedit.pos2[name]
-- print("[set_pos1]", name, "("..pos.x..", "..pos.y..", "..pos.z..")") -- print("[set_pos1]", name, "("..pos.x..", "..pos.y..", "..pos.z..")")
if not worldedit.pos1[name] then worldedit.pos1[name] = vector.new(pos) end if not worldedit.pos1[name] then worldedit.pos1[name] = vector.new(pos) end
if not worldedit.pos2[name] then worldedit.pos2[name] = vector.new(pos) end if not worldedit.pos2[name] then worldedit.pos2[name] = vector.new(pos) end
@ -26,9 +27,17 @@ function selection.add_point(name, pos)
local volume_after = worldedit.volume(worldedit.pos1[name], worldedit.pos2[name]) local volume_after = worldedit.volume(worldedit.pos1[name], worldedit.pos2[name])
local volume_difference = volume_after - volume_before local volume_difference = volume_after - volume_before
if volume_difference == 0 and created_new then
volume_difference = 1
end
local msg = "Expanded region by "
if created_new then msg = "Created new region with " end
msg = msg..volume_difference.." node"
if volume_difference ~= 1 then msg = msg.."s" end
worldedit.marker_update(name) worldedit.marker_update(name)
worldedit.player_notify(name, "Expanded region by "..volume_difference.." nodes") worldedit.player_notify(name, msg)
else else
worldedit.player_notify(name, "Error: Too far away (try raising your maxdist with //farwand maxdist <number>)") worldedit.player_notify(name, "Error: Too far away (try raising your maxdist with //farwand maxdist <number>)")
-- print("[set_pos1]", name, "nil") -- print("[set_pos1]", name, "nil")