Every Node can now be used. Screenshot added.

This commit is contained in:
A.C.M 2018-11-03 22:09:45 +01:00
parent 8d6b93cba9
commit ae4d4c303e
3 changed files with 63 additions and 48 deletions

View File

@ -2,6 +2,7 @@
This Mod adds Barchairs to Minetest. This Mod adds Barchairs to Minetest.
![Screenshot 1](screenshot.jpg)
## Install ## Install
Move your Download to the Mods-Folder. Move your Download to the Mods-Folder.

104
init.lua
View File

@ -1,63 +1,74 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local wood = {} local mod
local mat
local burn
local material = {}
-- Various default Wood -- Various default Wood
wood = { material = {
--wood -- Mod , Material, burnvalue
"wood", {"default:", "wood", 15 },
"junglewood", {"default:", "junglewood", 15 },
"aspen_wood", {"default:", "aspen_wood", 15 },
"pine_wood", {"default:", "pine_wood", 15 },
"acacia_wood", {"default:", "acacia_wood", 15 },
--glasslike --glasslike
"obsidian", {"default:", "obsidian", 0 },
"ice", {"default:", "ice", 0 },
{"default:", "diamondblock", 0 },
{"default:", "mese", 0 },
-- trees -- trees
"aspen_tree", {"default:", "aspen_tree", 17 },
"acacia_tree", {"default:", "acacia_tree", 17 },
"pine_tree", {"default:", "pine_tree", 17 },
"jungletree", {"default:", "jungletree", 17 },
"tree", {"default:", "tree", 17 },
-- other -- other
"cactus", {"default:", "cactus", 12 },
"coral_skeleton", {"default:", "coral_skeleton", 0 },
-- metal -- metal
"goldblock", {"default:", "goldblock", 0 },
"bronzeblock", {"default:", "bronzeblock", 0 },
"tinblock", {"default:", "tinblock", 0 },
"copperblock" {"default:", "copperblock", 0 },
{"default:", "steelblock", 0 },
} }
for _,kind in ipairs(wood) do for _,kind in pairs(material) do
mod = kind[1] -- Modname
mat = kind[2] -- Materialname (for the Textur)
burn = kind[3] -- Burnvalue > 0 = burnable
-- print( mod, mat, burn)
if(minetest.registered_nodes["default:" .. kind] ~= nil) then if(minetest.registered_nodes[mod .. mat] ~= nil) then
minetest.register_node("barchairs:barchairs_plain_" .. kind, { minetest.register_node("barchairs:barchairs_plain_" .. mat, {
description = "Barchair plain " .. kind, description = "Barchair plain " .. mat,
tiles = minetest.registered_nodes["default:" .. kind].tiles, tiles = minetest.registered_nodes[mod .. mat].tiles,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.3125, 0.375, -0.3125, 0.3125, 0.5, 0.3125}, -- Barchair {-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125}, -- Barchair
{-0.3125, -0.5, -0.3125, -0.25, 0.5, -0.1875}, -- Bein_vl {-0.3125, -0.5, -0.3125, -0.25, 0.25, -0.1875}, -- Bein_vl
{0.25, -0.5, 0.1875, 0.3125, 0.5, 0.3125}, -- Bein_hr {0.25, -0.5, 0.1875, 0.3125, 0.25, 0.3125}, -- Bein_hr
{-0.3125, -0.5, 0.1875, -0.25, 0.5, 0.3125}, -- Bein_hl {-0.3125, -0.5, 0.1875, -0.25, 0.25, 0.3125}, -- Bein_hl
{0.25, -0.5, -0.3125, 0.3125, 0.5, -0.1875}, -- Bein_vr {0.25, -0.5, -0.3125, 0.3125, 0.25, -0.1875}, -- Bein_vr
{-0.3125, -0.125, -0.3125, 0.3125, -0.0625, -0.25}, -- Quer_l {-0.3125, -0.3125, -0.3125, 0.3125, -0.25, -0.25}, -- Quer_l
{-0.3125, -0.125, 0.25, 0.3125, -0.0625, 0.3125}, -- Quer_r {-0.3125, -0.3125, 0.25, 0.3125, -0.25, 0.3125}, -- Quer_r
{-0.3125, -0.125, -0.25, -0.25, -0.0625, 0.3125}, -- Quer_h {-0.3125, -0.3125, -0.25, -0.25, -0.25, 0.3125}, -- Quer_h
{0.25, -0.125, -0.3125, 0.3125, -0.0625, 0.3125}, -- Quer_v {0.25, -0.3125, -0.3125, 0.3125, -0.25, 0.3125}, -- Quer_v
} }
}, },
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -73,19 +84,22 @@ for _,kind in ipairs(wood) do
minetest.register_craft({ minetest.register_craft({
output = "barchairs:barchairs_plain_" .. kind, output = "barchairs:barchairs_plain_" .. mat .. " 2",
recipe = { recipe = {
{"","default:" .. kind,""}, {"",mod .. mat,""},
{"default:stick","","default:stick"}, {"default:stick","","default:stick"},
{"default:stick","default:" .. kind,"default:stick"} {"default:stick",mod .. mat,"default:stick"}
}, },
}) -- minetest.register_craft }) -- minetest.register_craft
minetest.register_craft({ if(burn > 0) then
type = "fuel", minetest.register_craft({
recipe = "barchairs:barchairs_plain_" .. kind, type = "fuel",
burntime = 17, recipe = "barchairs:barchairs_plain_" .. mat,
}) -- minetest.register_craft burntime = burn,
}) -- minetest.register_craft
end -- if(burn
end -- if(minetest.registered_nodes end -- if(minetest.registered_nodes

BIN
screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB