mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-27 17:43:53 +01:00
parent
093a4823bb
commit
feb4d6a4bf
@ -5,6 +5,7 @@ It's about time I started a changelog! This will serve from now on as the main c
|
||||
## v1.12 (unreleased)
|
||||
- Add `//srect` (_select rectangle_) - thanks, @VorTechnix!
|
||||
- Add `//spush`, `//spop`, and `//sstack`
|
||||
- `//overlay`: Don't place nodes above water
|
||||
|
||||
|
||||
## v1.11: The big data update (25th January 2021)
|
||||
|
@ -23,32 +23,38 @@ function worldeditadditions.overlay(pos1, pos2, node_weights)
|
||||
for x = pos2.x, pos1.x, -1 do
|
||||
local found_air = false
|
||||
local placed_node = false
|
||||
|
||||
-- print("\n\n[overlay] ****** column start ******")
|
||||
for y = pos2.y, pos1.y, -1 do
|
||||
local i = area:index(x, y, z)
|
||||
-- print("[overlay] pos", x, y, z, "id", data[i], "name", minetest.get_name_from_content_id(data[i]), "is_liquid", worldeditadditions.is_liquidlike(data[i]))
|
||||
|
||||
local is_air = worldeditadditions.is_airlike(data[i])
|
||||
local is_liquid = worldeditadditions.is_liquidlike(data[i])
|
||||
-- wielded_light is now handled by worldeditadditions.is_airlike
|
||||
|
||||
local is_ignore = data[i] == node_id_ignore
|
||||
|
||||
if not is_air and not is_ignore then
|
||||
if found_air then
|
||||
local i_above = area:index(x, y + 1, z)
|
||||
if found_air and not is_liquid then
|
||||
local new_id = node_ids[math.random(node_ids_count)]
|
||||
-- We've found an air block previously, so it must be above us
|
||||
-- Replace the node above us with the target block
|
||||
data[area:index(x, y + 1, z)] = new_id
|
||||
data[i_above] = new_id
|
||||
changes.updated = changes.updated + 1
|
||||
placed_node = true
|
||||
if not changes.placed[new_id] then
|
||||
changes.placed[new_id] = 0
|
||||
end
|
||||
changes.placed[new_id] = changes.placed[new_id] + 1
|
||||
-- print("[overlay] placed above ", x, y, z)
|
||||
break -- Move on to the next column
|
||||
end
|
||||
elseif not is_ignore then
|
||||
elseif not is_ignore and not is_liquid then
|
||||
-- print("[overlay] found air at", x, y, z)
|
||||
found_air = true
|
||||
end
|
||||
if is_liquid then found_air = false end
|
||||
end
|
||||
|
||||
if not placed_node then
|
||||
|
@ -44,7 +44,7 @@ function worldeditadditions.is_liquidlike(id)
|
||||
if node_name == nil or not minetest.registered_nodes[node_name] then return false end
|
||||
|
||||
local liquidtype = minetest.registered_nodes[node_name].liquidtype
|
||||
-- print("[is_liquidlike]", "id", id, "liquidtype", liquidtype)
|
||||
-- print("[is_liquidlike]", "id", id, "name", node_name, "liquidtype", liquidtype)
|
||||
|
||||
if liquidtype == nil or liquidtype == "none" then return false end
|
||||
-- If it's not none, then it has to be a liquid as the only other values are source and flowing
|
||||
|
Loading…
Reference in New Issue
Block a user