mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
//maze: fix generated maze not reaching to the very edge of the defined region
Fixes #60.
This commit is contained in:
parent
af0e54cfdf
commit
6e89fc868f
2 changed files with 7 additions and 5 deletions
|
@ -36,7 +36,9 @@ Note to self: See the bottom of this file for the release template text.
|
||||||
- Cloud wand: Improve chat message text
|
- Cloud wand: Improve chat message text
|
||||||
- Fix `bonemeal` mod detection to look for the global `bonemeal`, not whether the `bonemeal` mod name has been loaded
|
- Fix `bonemeal` mod detection to look for the global `bonemeal`, not whether the `bonemeal` mod name has been loaded
|
||||||
- `//walls`: Prevent crash if not parameters are specified by defaulting to `dirt` as the replace_node
|
- `//walls`: Prevent crash if not parameters are specified by defaulting to `dirt` as the replace_node
|
||||||
- `//maze`, `//maze3d`: Fix crash if no arguments are specified
|
- `//maze`, `//maze3d`:
|
||||||
|
- Fix generated maze not reaching the very edge of the defined region
|
||||||
|
- Fix crash if no arguments are specified
|
||||||
|
|
||||||
|
|
||||||
## v1.12: The selection tools update (26th June 2021)
|
## v1.12: The selection tools update (26th June 2021)
|
||||||
|
|
|
@ -48,13 +48,13 @@ local function generate_maze(seed, width, height, path_length, path_width)
|
||||||
if cy - path_length > 0 and world[cy - path_length][cx] == "#" then
|
if cy - path_length > 0 and world[cy - path_length][cx] == "#" then
|
||||||
directions = directions .. "u"
|
directions = directions .. "u"
|
||||||
end
|
end
|
||||||
if cy + path_length < height-path_width and world[cy + path_length][cx] == "#" then
|
if cy + path_length < height-path_width+1 and world[cy + path_length][cx] == "#" then
|
||||||
directions = directions .. "d"
|
directions = directions .. "d"
|
||||||
end
|
end
|
||||||
if cx - path_length > 0 and world[cy][cx - path_length] == "#" then
|
if cx - path_length > 0 and world[cy][cx - path_length] == "#" then
|
||||||
directions = directions .. "l"
|
directions = directions .. "l"
|
||||||
end
|
end
|
||||||
if cx + path_length < width-path_width and world[cy][cx + path_length] == "#" then
|
if cx + path_length < width-path_width+1 and world[cy][cx + path_length] == "#" then
|
||||||
directions = directions .. "r"
|
directions = directions .. "r"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ function worldeditadditions.maze2d(pos1, pos2, target_node, seed, path_length, p
|
||||||
-- print("path_width: "..path_width..", path_length: "..path_length)
|
-- print("path_width: "..path_width..", path_length: "..path_length)
|
||||||
|
|
||||||
local maze = generate_maze(seed, extent.z, extent.x, path_length, path_width) -- x & need to be the opposite way around to how we index it
|
local maze = generate_maze(seed, extent.z, extent.x, path_length, path_width) -- x & need to be the opposite way around to how we index it
|
||||||
-- printspace(maze, extent.z, extent.x)
|
printspace(maze, extent.z, extent.x)
|
||||||
|
|
||||||
-- z y x is the preferred loop order, but that isn't really possible here
|
-- z y x is the preferred loop order, but that isn't really possible here
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue