//walls: Prevent crash if not parameters are specified by defaulting to dirt as the replace_node

This commit is contained in:
Starbeamrainbowlabs 2021-10-31 16:41:52 +00:00
parent d3a8efb9b8
commit dae59b63db
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 6 additions and 3 deletions

View File

@ -30,6 +30,7 @@ Note to self: See the bottom of this file for the release template text.
- `//replacemix`: Improve error handling to avoid crashes (thanks, Jonathon for reporting via Discord!)
- 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
- `//walls`: Prevent crash if not parameters are specified by defaulting to `dirt` as the replace_node
## v1.12: The selection tools update (26th June 2021)

View File

@ -146,10 +146,11 @@ Additional examples:
```
### `//walls <replace_node> [<thickness=1>]`
Creates vertical walls of `<replace_node>` around the inside edges of the defined region, optionally specifying the thickness thereof.
### `//walls [<replace_node=dirt> [<thickness=1>]]`
Creates vertical walls of `<replace_node>` around the inside edges of the defined region, optionally specifying the thickness thereof. Defaults to a replace node of `dirt` and a wall thickness of 1.
```weacmd
//walls
//walls dirt
//walls stone
//walls goldblock

View File

@ -4,11 +4,12 @@
-- ██ ███ ██ ██ ██ ██ ██ ██
-- ███ ███ ██ ██ ███████ ███████ ███████
worldedit.register_command("walls", {
params = "<replace_node> [<thickness=1>]",
params = "[<replace_node=dirt> [<thickness=1>]]",
description = "Creates vertical walls of <replace_node> around the inside edges of the defined region. Optionally specifies a thickness for the walls to be created (defaults to 1)",
privs = { worldedit = true },
require_pos = 2,
parse = function(params_text)
if not params_text or params_text == "" then params_text = "dirt" end
local parts = worldeditadditions.split_shell(params_text)
local target_node