mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-29 18:33:01 +00:00
Add //ndef
This commit is contained in:
parent
170ec01bed
commit
4728dad02a
4 changed files with 109 additions and 0 deletions
|
@ -15,6 +15,7 @@ Note to self: See the bottom of this file for the release template text.
|
||||||
- Also added an associated [movement speed adjustment tool](https://worldeditadditions.mooncarrot.space/Reference/#movement), which looks like this: ![A picture of the move speed adjustment tool. It looks like a monarch butterfly.](https://raw.githubusercontent.com/sbrl/Minetest-WorldEditAdditions/dev/worldeditadditions_farwand/textures/worldeditadditions_movement.png)
|
- Also added an associated [movement speed adjustment tool](https://worldeditadditions.mooncarrot.space/Reference/#movement), which looks like this: ![A picture of the move speed adjustment tool. It looks like a monarch butterfly.](https://raw.githubusercontent.com/sbrl/Minetest-WorldEditAdditions/dev/worldeditadditions_farwand/textures/worldeditadditions_movement.png)
|
||||||
- Added [`//set+`](https://worldeditadditions.mooncarrot.space/Reference/#set) for setting nodes and param2/light levels quickly.
|
- Added [`//set+`](https://worldeditadditions.mooncarrot.space/Reference/#set) for setting nodes and param2/light levels quickly.
|
||||||
- NOTE TO SELF: Setting light values doesn't appear to be working very well for some reason
|
- NOTE TO SELF: Setting light values doesn't appear to be working very well for some reason
|
||||||
|
- Added [`//ndef`](https://worldeditadditions.mooncarrot.space/Reference/#ndef) to print a given node's definition table. This is for debugging and development purposes.
|
||||||
|
|
||||||
### Bugfixes and changes
|
### Bugfixes and changes
|
||||||
- Don't warn on failed registration of `//flora` → [`//bonemeal`](https://worldeditadditions.mooncarrot.space/Reference/#bonemeal) if the `bonemeal` mod isn't installed (e.g. in MineClone2) - thanks @VorTechnix in #106
|
- Don't warn on failed registration of `//flora` → [`//bonemeal`](https://worldeditadditions.mooncarrot.space/Reference/#bonemeal) if the `bonemeal` mod isn't installed (e.g. in MineClone2) - thanks @VorTechnix in #106
|
||||||
|
|
|
@ -1047,6 +1047,77 @@ Finally, the customary misc examples:
|
||||||
//ngroups default:dry_shrub v
|
//ngroups default:dry_shrub v
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `//ndef <node_name>`
|
||||||
|
Short for *Node Definition*. Prints the definition table for the node with the given name. In other words. the output could look a little like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
stairs:stair_birch_wood {
|
||||||
|
description = (string) "Birch Wood Stair"
|
||||||
|
sounds = (table) {
|
||||||
|
dig = (table) {
|
||||||
|
name = (string) "default_dig_choppy"
|
||||||
|
gain = (number) 0.4
|
||||||
|
}
|
||||||
|
place = (table) {
|
||||||
|
name = (string) "default_place_node_hard"
|
||||||
|
gain = (number) 1
|
||||||
|
}
|
||||||
|
dug = (table) {
|
||||||
|
name = (string) "default_wood_footstep"
|
||||||
|
gain = (number) 1
|
||||||
|
}
|
||||||
|
footstep = (table) {
|
||||||
|
name = (string) "default_wood_footstep"
|
||||||
|
gain = (number) 0.15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
name = (string) "stairs:stair_birch_wood"
|
||||||
|
light_source = (number) 0
|
||||||
|
mod_origin = (string) "ethereal"
|
||||||
|
selection_box = (table) {
|
||||||
|
fixed = (table) {
|
||||||
|
1 = (table) [truncated]
|
||||||
|
2 = (table) [truncated]
|
||||||
|
}
|
||||||
|
type = (string) "fixed"
|
||||||
|
}
|
||||||
|
paramtype = (string) "light"
|
||||||
|
groups = (table) {
|
||||||
|
flammable = (number) 3
|
||||||
|
stair = (number) 1
|
||||||
|
choppy = (number) 2
|
||||||
|
oddly_breakable_by_hand = (number) 1
|
||||||
|
}
|
||||||
|
is_ground_content = (boolean) false
|
||||||
|
on_place = (function) function: 0x765b01d0edb8
|
||||||
|
drawtype = (string) "nodebox"
|
||||||
|
tiles = (table) {
|
||||||
|
1 = (table) {
|
||||||
|
name = (string) "moretrees_birch_wood.png"
|
||||||
|
backface_culling = (boolean) true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paramtype2 = (string) "facedir"
|
||||||
|
sunlight_propagates = (boolean) false
|
||||||
|
node_box = (table) {
|
||||||
|
fixed = (table) {
|
||||||
|
1 = (table) [truncated]
|
||||||
|
2 = (table) [truncated]
|
||||||
|
}
|
||||||
|
type = (string) "fixed"
|
||||||
|
}
|
||||||
|
type = (string) "node"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This command is intended for debugging and development purposes, but if you're implementing a mod yourself you might find it useful too.
|
||||||
|
|
||||||
|
```weacmd
|
||||||
|
//ndef stone
|
||||||
|
//ndef stairs:stair_birch_wood
|
||||||
|
//ndef glass
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Selection
|
## Selection
|
||||||
|
|
|
@ -9,3 +9,4 @@
|
||||||
local we_cmdpath = worldeditadditions_commands.modpath .. "/commands/nodes/"
|
local we_cmdpath = worldeditadditions_commands.modpath .. "/commands/nodes/"
|
||||||
|
|
||||||
dofile(we_cmdpath .. "ngroups.lua")
|
dofile(we_cmdpath .. "ngroups.lua")
|
||||||
|
dofile(we_cmdpath .. "ndef.lua")
|
||||||
|
|
36
worldeditadditions_commands/commands/nodes/ndef.lua
Normal file
36
worldeditadditions_commands/commands/nodes/ndef.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local core = worldeditadditions_core
|
||||||
|
local Vector3 = core.Vector3
|
||||||
|
|
||||||
|
-- ███ ██ ██████ ███████ ███████
|
||||||
|
-- ████ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ██ ██ ██ ██ █████ █████
|
||||||
|
-- ██ ██ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ████ ██████ ███████ ██
|
||||||
|
worldeditadditions_core.register_command("ndef", {
|
||||||
|
params = "<node_name>",
|
||||||
|
description =
|
||||||
|
"Prints the current definintion for the given node.",
|
||||||
|
privs = {},
|
||||||
|
parse = function(params_text)
|
||||||
|
params_text = core.trim(params_text)
|
||||||
|
if params_text == "" then return false, "No node name specified." end
|
||||||
|
|
||||||
|
local node_name = worldedit.normalize_nodename(params_text)
|
||||||
|
if not node_name then
|
||||||
|
return false, "Error: Unknown node " .. params_text .. "."
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, node_name
|
||||||
|
end,
|
||||||
|
nodes_needed = function()
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
func = function(_, node_name)
|
||||||
|
local node_def = minetest.registered_nodes[node_name]
|
||||||
|
if not node_def then return false, "Error: Failed to find definition for node " .. node_name .. "." end
|
||||||
|
|
||||||
|
local msg = { node_name, core.inspect(node_def) }
|
||||||
|
print(table.concat(msg, " "))
|
||||||
|
return true, table.concat(msg, " ")
|
||||||
|
end
|
||||||
|
})
|
Loading…
Reference in a new issue