refactor log registration.
rename log and sapling textures to be more clear. rewrite node registration code to account for this, and to be overall cleaner.
This commit is contained in:
parent
5a3d81787c
commit
19d63efcf5
|
@ -1,39 +1,35 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
|
||||
blockgame.register_node(modname .. ":log", {
|
||||
description = "Log",
|
||||
tiles = {
|
||||
modname .. "_log_top.png",
|
||||
modname .. "_log_top.png",
|
||||
modname .. "_log.png",
|
||||
},
|
||||
groups = {
|
||||
woody = 1,
|
||||
},
|
||||
})
|
||||
blockgame.register_node(modname .. ":log_alive", {
|
||||
description = "Living Log",
|
||||
tiles = {
|
||||
modname .. "_log_top.png",
|
||||
modname .. "_log_top.png",
|
||||
modname .. "_log.png",
|
||||
},
|
||||
groups = {
|
||||
woody = 1,
|
||||
planty = 1,
|
||||
},
|
||||
drop = modname .. ":log",
|
||||
local function reg_log (name, def)
|
||||
def = def or {}
|
||||
|
||||
def.description = def.description or "Log"
|
||||
|
||||
local texture = def.texture or name
|
||||
def.tiles = blockgame.underride(def.tiles, {
|
||||
modname .. "_" .. texture .. "_top.png",
|
||||
modname .. "_" .. texture .. "_top.png",
|
||||
modname .. "_" .. texture .. ".png",
|
||||
})
|
||||
|
||||
blockgame.register_node(modname .. ":sapling", {
|
||||
description = "Growing Log",
|
||||
tiles = {
|
||||
modname .. "_log_top_alive.png",
|
||||
modname .. "_log_top_alive.png",
|
||||
modname .. "_log_alive.png",
|
||||
},
|
||||
groups = {
|
||||
def.groups = blockgame.underride(def.groups, {
|
||||
woody = 1,
|
||||
supports_leaves = 1,
|
||||
})
|
||||
|
||||
blockgame.register_node(modname .. ":" .. name, def)
|
||||
end
|
||||
|
||||
reg_log("log")
|
||||
reg_log("log_alive", {
|
||||
groups = {
|
||||
planty = 1,
|
||||
},
|
||||
texture = "log",
|
||||
drop = modname .. ":log",
|
||||
})
|
||||
reg_log("sapling", {
|
||||
groups = {
|
||||
planty = 1,
|
||||
},
|
||||
drop = modname .. ":log",
|
||||
|
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Loading…
Reference in a new issue