2018-12-30 03:42:03 +01:00
|
|
|
--[[
|
|
|
|
**********************************************
|
|
|
|
*** Barchair ***
|
|
|
|
*** ***
|
|
|
|
*** Barchair is a Mod for Minetest ***
|
|
|
|
*** and adds some simple Barchairs to ***
|
|
|
|
*** the Game. ***
|
|
|
|
*** ***
|
|
|
|
*** License: GPL 3.0 by A.C.M. ***
|
|
|
|
*** ***
|
|
|
|
**********************************************
|
|
|
|
|
|
|
|
]]--
|
2018-12-15 12:40:39 +01:00
|
|
|
|
2018-11-03 22:09:45 +01:00
|
|
|
local mod
|
|
|
|
local mat
|
|
|
|
local burn
|
|
|
|
|
2018-12-30 03:42:03 +01:00
|
|
|
barchair = {}
|
|
|
|
|
|
|
|
barchair.modname = minetest.get_current_modname()
|
|
|
|
barchair.modpath = minetest.get_modpath(barchair.modname)
|
|
|
|
barchair.version = 1
|
|
|
|
barchair.revision = 1
|
|
|
|
|
2018-11-03 22:09:45 +01:00
|
|
|
local material = {}
|
2018-10-11 23:30:02 +02:00
|
|
|
|
2018-11-03 20:44:38 +01:00
|
|
|
-- Various default Wood
|
2018-11-03 22:09:45 +01:00
|
|
|
material = {
|
|
|
|
-- Mod , Material, burnvalue
|
|
|
|
{"default:", "wood", 15 },
|
|
|
|
{"default:", "junglewood", 15 },
|
|
|
|
{"default:", "aspen_wood", 15 },
|
|
|
|
{"default:", "pine_wood", 15 },
|
|
|
|
{"default:", "acacia_wood", 15 },
|
2018-11-03 20:44:38 +01:00
|
|
|
|
|
|
|
--glasslike
|
2018-11-03 22:09:45 +01:00
|
|
|
{"default:", "obsidian", 0 },
|
|
|
|
{"default:", "ice", 0 },
|
|
|
|
{"default:", "diamondblock", 0 },
|
|
|
|
{"default:", "mese", 0 },
|
2018-11-03 20:44:38 +01:00
|
|
|
-- trees
|
2018-11-03 22:09:45 +01:00
|
|
|
{"default:", "aspen_tree", 17 },
|
|
|
|
{"default:", "acacia_tree", 17 },
|
|
|
|
{"default:", "pine_tree", 17 },
|
|
|
|
{"default:", "jungletree", 17 },
|
|
|
|
{"default:", "tree", 17 },
|
2018-11-03 20:44:38 +01:00
|
|
|
|
|
|
|
-- other
|
2018-11-03 22:09:45 +01:00
|
|
|
{"default:", "cactus", 12 },
|
|
|
|
{"default:", "coral_skeleton", 0 },
|
2018-11-03 20:44:38 +01:00
|
|
|
|
|
|
|
-- metal
|
2018-11-03 22:09:45 +01:00
|
|
|
{"default:", "goldblock", 0 },
|
|
|
|
{"default:", "bronzeblock", 0 },
|
|
|
|
{"default:", "tinblock", 0 },
|
|
|
|
{"default:", "copperblock", 0 },
|
|
|
|
{"default:", "steelblock", 0 },
|
2018-11-03 20:44:38 +01:00
|
|
|
}
|
|
|
|
|
2018-12-30 03:42:03 +01:00
|
|
|
--[[
|
|
|
|
***************************************************************
|
|
|
|
Function register_barchair()
|
2018-11-03 20:44:38 +01:00
|
|
|
|
2018-12-30 03:42:03 +01:00
|
|
|
mod = String of the current modname like "default:"
|
|
|
|
mat = Material, is the name of the node lide "dirt"
|
|
|
|
burnvalue = Is the Chair burnable? 0 = not burnable, >= how long takes it to burn
|
|
|
|
If you don't give a valid Number, burnvalue = 0 and the chair is unburnable.
|
|
|
|
|
|
|
|
***************************************************************
|
|
|
|
]]--
|
|
|
|
|
|
|
|
function barchair.register_barchair(mod, mat, burnvalue)
|
|
|
|
|
|
|
|
if(mod == "" or mod == nil) then
|
|
|
|
return
|
|
|
|
|
|
|
|
end -- if(mod ==
|
|
|
|
|
|
|
|
if(mat == "" or mat == nil) then
|
|
|
|
return
|
|
|
|
|
|
|
|
end -- if(mat ==
|
|
|
|
|
|
|
|
if(burnvalue == nil or burnvalue < 0) then
|
|
|
|
burnvalue = 0
|
|
|
|
|
|
|
|
end -- if(burnvalue
|
2018-11-03 20:44:38 +01:00
|
|
|
|
2018-11-03 22:09:45 +01:00
|
|
|
|
2018-11-04 12:07:33 +01:00
|
|
|
if(minetest.registered_nodes[mod .. mat] ~= nil) then
|
2018-11-03 20:44:38 +01:00
|
|
|
|
2018-11-04 15:13:45 +01:00
|
|
|
-- Barchair
|
2018-12-30 03:42:03 +01:00
|
|
|
minetest.register_node(":" .. barchair.modname .. ":barchairs_plain_" .. mat, {
|
2018-11-03 22:09:45 +01:00
|
|
|
description = "Barchair plain " .. mat,
|
|
|
|
tiles = minetest.registered_nodes[mod .. mat].tiles,
|
|
|
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2018-11-03 20:44:38 +01:00
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
2018-11-03 23:13:51 +01:00
|
|
|
paramtype2 = "facedir",
|
2018-11-03 20:44:38 +01:00
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2018-11-03 22:28:58 +01:00
|
|
|
{-0.1875, 0.125, -0.25, 0.1875, 0.25, 0.1875}, -- Barchair
|
|
|
|
{-0.1875, -0.5, -0.25, -0.125, 0.25, -0.1875}, -- Bein_vl
|
2018-11-04 12:07:33 +01:00
|
|
|
{0.125, -0.5, 0.125, 0.1875, 0.25, 0.1875}, -- Bein_hr
|
2018-11-03 22:28:58 +01:00
|
|
|
{-0.1875, -0.5, 0.125, -0.125, 0.25, 0.1875}, -- Bein_hl
|
|
|
|
{0.125, -0.5, -0.25, 0.1875, 0.25, -0.1875}, -- Bein_vr
|
|
|
|
{-0.125, -0.3125, -0.25, 0.125, -0.25, -0.1875}, -- Quer_l
|
|
|
|
{-0.125, -0.3125, 0.125, 0.125, -0.25, 0.1875}, -- Quer_r
|
|
|
|
{-0.1875, -0.3125, -0.1875, -0.125, -0.25, 0.125}, -- Quer_h
|
|
|
|
{0.125, -0.3125, -0.1875, 0.1875, -0.25, 0.1875}, -- Quer_v
|
|
|
|
}
|
2018-11-03 20:44:38 +01:00
|
|
|
},
|
2018-11-03 23:13:51 +01:00
|
|
|
on_place = minetest.rotate_node,
|
2018-11-03 20:44:38 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
if not clicker:is_player() then
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
pos.y = pos.y-0.5
|
|
|
|
clicker:setpos(pos)
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
|
|
|
}) -- minetest.register_node
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2018-12-30 03:42:03 +01:00
|
|
|
output = barchair.modname .. ":barchairs_plain_" .. mat .. " 2",
|
2018-11-03 20:44:38 +01:00
|
|
|
recipe = {
|
2018-11-03 22:09:45 +01:00
|
|
|
{"",mod .. mat,""},
|
2018-11-03 20:44:38 +01:00
|
|
|
{"default:stick","","default:stick"},
|
2018-11-03 22:09:45 +01:00
|
|
|
{"default:stick",mod .. mat,"default:stick"}
|
2018-11-03 20:44:38 +01:00
|
|
|
},
|
|
|
|
}) -- minetest.register_craft
|
2018-11-03 22:09:45 +01:00
|
|
|
|
|
|
|
if(burn > 0) then
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
2018-12-30 03:42:03 +01:00
|
|
|
recipe = barchair.modname .. ":barchairs_plain_" .. mat,
|
2018-11-03 22:09:45 +01:00
|
|
|
burntime = burn,
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
end -- if(burn
|
2018-11-04 15:13:45 +01:00
|
|
|
|
|
|
|
-- Bar
|
|
|
|
|
|
|
|
-- Bar Front
|
2018-12-30 03:42:03 +01:00
|
|
|
minetest.register_node(":" .. barchair.modname .. ":bar_front_" .. mat, {
|
2018-11-04 15:13:45 +01:00
|
|
|
description = "Bar front " .. mat,
|
|
|
|
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",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{0.0625, -0.5, -0.5, 0.1875, 0.5, 0.5}, -- Front
|
|
|
|
{0.0625, 0.375, -0.5, 0.5, 0.5, 0.5}, -- Top
|
|
|
|
{0, -0.5, 0.375, 0.0625, 0.5, 0.4375}, -- Deco_1
|
|
|
|
{0, -0.5, 0.125, 0.0625, 0.5, 0.1875}, -- Deco_2
|
|
|
|
{0, -0.5, -0.125, 0.0625, 0.5, -0.0625}, -- Deco_3
|
|
|
|
{0, -0.5, -0.375, 0.0625, 0.5, -0.3125}, -- Deco_4
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, -- node_box
|
|
|
|
|
|
|
|
on_place = minetest.rotate_node,
|
|
|
|
|
|
|
|
}) -- minetest.register_node
|
|
|
|
|
|
|
|
-- Recipe
|
|
|
|
minetest.register_craft({
|
2018-12-30 03:42:03 +01:00
|
|
|
output = barchair.modname .. ":bar_front_" .. mat .. " 2",
|
2018-11-04 15:13:45 +01:00
|
|
|
recipe = {
|
|
|
|
{"",mod .. mat,""},
|
|
|
|
{"default:stick","default:stick","default:stick"},
|
|
|
|
{"",mod .. mat,""}
|
|
|
|
},
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
-- Recipe full
|
|
|
|
if(burn > 0) then
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
2018-12-30 03:42:03 +01:00
|
|
|
recipe = barchair.modname .. ":bar_front_" .. mat,
|
2018-11-04 15:13:45 +01:00
|
|
|
burntime = burn + 2,
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
end -- if(burn
|
|
|
|
|
|
|
|
-- Bar Corner left
|
2018-12-30 03:42:03 +01:00
|
|
|
minetest.register_node(":" .. barchair.modname .. ":bar_corner_left_" .. mat, {
|
2018-11-04 15:13:45 +01:00
|
|
|
description = "Bar corner left " .. mat,
|
|
|
|
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",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, -0.1875, 0.5, 0.5, -0.0625}, -- Front
|
|
|
|
{-0.5, 0.375, -0.5, 0.5, 0.5, -0.0625}, -- Top
|
|
|
|
{-0.4375, -0.5, -0.0625, -0.375, 0.5, -0}, -- Deco_1
|
|
|
|
{-0.1875, -0.5, -0.0625, -0.125, 0.5, -0}, -- Deco_2
|
|
|
|
{0.0625, -0.5, -0.0625, 0.125, 0.5, -0}, -- Deco_3
|
|
|
|
{0.3125, -0.5, -0.0625, 0.375, 0.5, -0}, -- Deco_4
|
|
|
|
{-0.5, -0.5, -0.5, -0.375, 0.5, -0.125}, -- Side_r
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, -- node_box
|
|
|
|
|
|
|
|
on_place = minetest.rotate_node,
|
|
|
|
|
|
|
|
}) -- minetest.register_node
|
|
|
|
|
|
|
|
-- Recipe
|
|
|
|
minetest.register_craft({
|
2018-12-30 03:42:03 +01:00
|
|
|
output = barchair.modname .. ":bar_corner_left_" .. mat .. " 2",
|
2018-11-04 15:13:45 +01:00
|
|
|
recipe = {
|
|
|
|
{mod .. mat,"",""},
|
|
|
|
{"default:stick","default:stick","default:stick"},
|
|
|
|
{mod .. mat, "",""}
|
|
|
|
},
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
-- Recipe full
|
|
|
|
if(burn > 0) then
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
2018-12-30 03:42:03 +01:00
|
|
|
recipe = barchair.modname .. ":bar_corner_left_" .. mat,
|
2018-11-04 15:13:45 +01:00
|
|
|
burntime = burn + 2,
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
end -- if(burn
|
|
|
|
|
|
|
|
-- Bar Corner right
|
2018-12-30 03:42:03 +01:00
|
|
|
minetest.register_node(":" .. barchair.modname .. ":bar_corner_right_" .. mat, {
|
2018-11-04 15:13:45 +01:00
|
|
|
description = "Bar corner right " .. mat,
|
|
|
|
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",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, 0.0625, 0.5, 0.5, 0.1875}, -- Front
|
|
|
|
{-0.5, 0.375, 0.0625, 0.5, 0.5, 0.5}, -- Top
|
|
|
|
{-0.4375, -0.5, 0, -0.375, 0.5, 0.0625}, -- Deco_1
|
|
|
|
{-0.1875, -0.5, 0, -0.125, 0.5, 0.0625}, -- Deco_2
|
|
|
|
{0.0625, -0.5, 0, 0.125, 0.5, 0.0625}, -- Deco_3
|
|
|
|
{0.3125, -0.5, 0, 0.375, 0.5, 0.0625}, -- Deco_4
|
|
|
|
{-0.5, -0.5, 0.125, -0.375, 0.5, 0.5}, -- Side_r
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, -- node_box
|
|
|
|
|
|
|
|
on_place = minetest.rotate_node,
|
|
|
|
|
|
|
|
}) -- minetest.register_node
|
|
|
|
|
|
|
|
-- Recipe
|
|
|
|
minetest.register_craft({
|
2018-12-30 03:42:03 +01:00
|
|
|
output = barchair.modname .. ":bar_corner_right_" .. mat .. " 2",
|
2018-11-04 15:13:45 +01:00
|
|
|
recipe = {
|
|
|
|
{"", "", mod .. mat},
|
|
|
|
{"default:stick","default:stick","default:stick"},
|
|
|
|
{"", "", mod .. mat}
|
|
|
|
},
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
-- Recipe full
|
|
|
|
if(burn > 0) then
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
2018-12-30 03:42:03 +01:00
|
|
|
recipe = barchair.modname .. ":bar_corner_right_" .. mat,
|
2018-11-04 15:13:45 +01:00
|
|
|
burntime = burn + 2,
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
end -- if(burn
|
|
|
|
|
|
|
|
-- Bar Side
|
2018-12-30 03:42:03 +01:00
|
|
|
minetest.register_node(":" .. barchair.modname .. ":bar_side_" .. mat, {
|
2018-11-04 15:13:45 +01:00
|
|
|
description = "Bar side " .. mat,
|
|
|
|
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",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, -0.4375, 0.5, 0.5, -0.3125}, -- Front
|
|
|
|
{-0.5, 0.375, -0.5, 0.5, 0.5, -0.0625}, -- Top
|
|
|
|
{0.375, -0.5, -0.5, 0.4375, 0.5, -0.4375}, -- Deco_1
|
|
|
|
{0.0625, -0.5, -0.5, 0.125, 0.5, -0.4375}, -- Deco_2
|
|
|
|
{-0.125, -0.5, -0.5, -0.0625, 0.5, -0.4375}, -- Deco_3
|
|
|
|
{-0.375, -0.5, -0.5, -0.3125, 0.5, -0.4375}, -- Deco_4
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, -- node_box
|
|
|
|
|
|
|
|
on_place = minetest.rotate_node,
|
|
|
|
|
|
|
|
}) -- minetest.register_node
|
|
|
|
|
|
|
|
-- Recipe
|
|
|
|
minetest.register_craft({
|
2018-12-30 03:42:03 +01:00
|
|
|
output = barchair.modname .. ":bar_side_" .. mat .. " 2",
|
2018-11-04 15:13:45 +01:00
|
|
|
recipe = {
|
|
|
|
{"","default:stick",""},
|
|
|
|
{mod .. mat,"default:stick",mod .. mat},
|
|
|
|
{"","default:stick",""}
|
|
|
|
},
|
|
|
|
}) -- minetest.register_craft
|
2018-11-03 22:09:45 +01:00
|
|
|
|
2018-11-04 15:13:45 +01:00
|
|
|
-- Recipe full
|
|
|
|
if(burn > 0) then
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
2018-12-30 03:42:03 +01:00
|
|
|
recipe = barchair.modname .. ":bar_side_" .. mat,
|
2018-11-04 15:13:45 +01:00
|
|
|
burntime = burn + 2,
|
|
|
|
}) -- minetest.register_craft
|
|
|
|
|
|
|
|
end -- if(burn
|
|
|
|
|
2018-11-03 20:44:38 +01:00
|
|
|
end -- if(minetest.registered_nodes
|
2018-11-04 15:13:45 +01:00
|
|
|
|
2018-12-30 03:42:03 +01:00
|
|
|
end -- function barchair.register_barchair(
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
barchair.register_barchair(mod, mat, burn)
|
|
|
|
|
2018-11-03 20:44:38 +01:00
|
|
|
end -- for
|
2018-12-15 12:40:39 +01:00
|
|
|
|
2018-12-30 03:42:03 +01:00
|
|
|
--[[
|
2018-12-15 12:40:39 +01:00
|
|
|
minetest.register_chatcommand(modname .. "_version",{
|
|
|
|
|
|
|
|
params = "<>",
|
|
|
|
description = "Shows the current Version of " .. modname,
|
|
|
|
func = function (name)
|
|
|
|
|
|
|
|
minetest.chat_send_player(name, "Mod: " .. modname .. " v " .. version .. "." .. revision .. "\n")
|
|
|
|
|
|
|
|
end -- function
|
|
|
|
|
|
|
|
}) -- chatcommand prospector_version
|
2018-12-30 03:42:03 +01:00
|
|
|
]]--
|
|
|
|
|
|
|
|
print("[MOD]" .. barchair.modname .. " Version " .. barchair.version .. "." .. barchair.revision .. " successfully loaded.")
|