Init
4
LICENSE
Normal file
@ -0,0 +1,4 @@
|
||||
This work is licensed under the Creative Commons Attribution-ShareAlike
|
||||
4.0 International License. To view a copy of this license, visit
|
||||
http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to
|
||||
Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
|
11
README.md
Normal file
@ -0,0 +1,11 @@
|
||||
## X-Decor ##
|
||||
|
||||
#### Minimal decoration mod for Minetest that aims to be simple and light. ####
|
||||
#### It provides just the essential made of cute pixels and cubes. ####
|
||||
|
||||
### Credits ###
|
||||
|
||||
#### Textures : Gambit, VanessaE, kilbith. ####
|
||||
#### Code : VanessaE, t4im, kilbith. ####
|
||||
|
||||
![Preview](http://i.imgur.com/teTQM6V.png)
|
37
building.lua
Normal file
@ -0,0 +1,37 @@
|
||||
xdecor.register("moonbrick", {
|
||||
description = "Moonbrick",
|
||||
tiles = {"xdecor_moonbrick.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
xdecor.register("wood_tile", {
|
||||
description = "Wood tile",
|
||||
tiles = {"xdecor_wood_tile.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
xdecor.register("coalstone_tile", {
|
||||
description = "Coalstone tile",
|
||||
tiles = {"xdecor_coalstone_tile.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
fence_material = {"brass", "wrought_iron"}
|
||||
|
||||
for _, m in ipairs(fence_material) do
|
||||
xdecor.register("fence_"..m, {
|
||||
description = "Fence ("..m..")",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"xdecor_"..m..".png"},
|
||||
inventory_image = "default_fence_overlay.png^xdecor_"..m..".png^default_fence_overlay.png^[makealpha:255,126,126",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
end
|
191
crafts.lua
Normal file
@ -0,0 +1,191 @@
|
||||
minetest.register_craft({
|
||||
output = "xdecor:barrel",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"default:iron_lump", "", "default:iron_lump"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("xdecor:brass_ingot", {
|
||||
description = "Brass ingot",
|
||||
inventory_image = "xdecor_brass_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:brass_ingot",
|
||||
recipe = {"default:copper_ingot", "moreores:tin_ingot"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cabinet",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"doors:trapdoor", "", "doors:trapdoor"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cabinet_half 2",
|
||||
recipe = { {"xdecor:cabinet"} }
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:candle 2",
|
||||
recipe = {"default:torch", "farming:string"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cardboard_box",
|
||||
recipe = {
|
||||
{"default:paper", "default:paper", "default:paper"},
|
||||
{"default:paper", "default:paper", "default:paper"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cauldron",
|
||||
recipe = {
|
||||
{"default:iron_lump", "", "default:iron_lump"},
|
||||
{"default:iron_lump", "default:water_source", "default:iron_lump"},
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:chair 2",
|
||||
recipe = {
|
||||
{"group:wood", "", ""},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"group:wood", "", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:coalstone_tile 8",
|
||||
recipe = {
|
||||
{"default:coalblock", "default:stone"},
|
||||
{"default:stone", "default:coalblock"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:cushion 2",
|
||||
recipe = {
|
||||
{"wool:red", "wool:red", "wool:red"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:fence_brass 4",
|
||||
recipe = {
|
||||
{"xdecor:brass_ingot", "xdecor:brass_ingot", "xdecor:brass_ingot"},
|
||||
{"xdecor:brass_ingot", "xdecor:brass_ingot", "xdecor:brass_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:fence_wrought_iron 4",
|
||||
recipe = {
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"},
|
||||
{"default:iron_lump", "default:iron_lump", "default:iron_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:flint_steel",
|
||||
recipe = {"default:obsidian_shard", "default:steel_ingot"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:frame",
|
||||
recipe = {
|
||||
{"group:stick", "group:stick", "group:stick"},
|
||||
{"group:stick", "default:paper", "group:stick"},
|
||||
{"group:stick", "group:stick", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:moonbrick",
|
||||
recipe = {"default:brick", "default:stone"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:multishelf",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"xdecor:skull", "group:book", "group:vessel"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:painting",
|
||||
recipe = {"default:sign_wall", "dye:blue"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:plant_pot 2",
|
||||
recipe = {
|
||||
{"default:clay_lump", "", "default:clay_lump"},
|
||||
{"default:clay_lump", "default:dirt", "default:clay_lump"},
|
||||
{"default:clay_lump", "default:clay_lump", "default:clay_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:rope 2",
|
||||
recipe = {
|
||||
{"farming:string"},
|
||||
{"farming:string"},
|
||||
{"farming:string"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:skull",
|
||||
recipe = {"bones:bones"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:table 2",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"", "group:wood", ""},
|
||||
{"", "group:wood", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:tv",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:glass", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:workbench",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"screwdriver:screwdriver", "screwdriver:screwdriver", "screwdriver:screwdriver"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:wood_tile 2",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"group:wood", "group:wood"}
|
||||
}
|
||||
})
|
3
depends.txt
Normal file
@ -0,0 +1,3 @@
|
||||
default
|
||||
moreblocks?
|
||||
moreores?
|
94
furniture.lua
Normal file
@ -0,0 +1,94 @@
|
||||
xdecor.register("chair", {
|
||||
description = "Chair",
|
||||
tiles = {"xdecor_wood.png"},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.3125, -0.5, 0.1875, -0.1875, 0.5, 0.3125},
|
||||
{0.1875, -0.5, 0.1875, 0.3125, 0.5, 0.3125},
|
||||
{-0.1875, 0.025, 0.22, 0.1875, 0.45, 0.28},
|
||||
{-0.3125, -0.5, -0.3125, -0.1875, -0.125, -0.1875},
|
||||
{0.1875, -0.5, -0.3125, 0.3125, -0.125, -0.1875},
|
||||
{-0.3125, -0.125, -0.3125, 0.3125, 0, 0.1875}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("cushion", {
|
||||
description = "Cushion",
|
||||
tiles = {"xdecor_cushion.png"},
|
||||
groups = {snappy=3},
|
||||
on_place = minetest.rotate_node,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { {-0.5, -0.5, -0.5, 0.5, 0, 0.5} }
|
||||
}
|
||||
})
|
||||
|
||||
local curtaincolors = {
|
||||
{ "red", "#ad2323e0:175" },
|
||||
{ "white", "#ffffffe0:175" }
|
||||
}
|
||||
|
||||
for c in ipairs(curtaincolors) do
|
||||
local color = curtaincolors[c][1]
|
||||
local hue = curtaincolors[c][2]
|
||||
local color_d = curtaincolors[c][1]
|
||||
|
||||
xdecor.register("curtain_"..color, {
|
||||
description = "Curtain ("..color_d..")",
|
||||
tiles = {"xdecor_curtain.png^[colorize:"..hue },
|
||||
inventory_image = "xdecor_curtain_open.png^[colorize:"..hue,
|
||||
drawtype = "signlike",
|
||||
use_texture_alpha = true,
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3},
|
||||
paramtype2 = "wallmounted",
|
||||
selection_box = {type = "wallmounted"},
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local fdir = node.param2
|
||||
minetest.set_node(pos, { name = "xdecor:curtain_open_"..color, param2 = fdir })
|
||||
end
|
||||
})
|
||||
|
||||
xdecor.register("curtain_open_"..color, {
|
||||
tiles = { "xdecor_curtain_open.png^[colorize:"..hue },
|
||||
drawtype = "signlike",
|
||||
use_texture_alpha = true,
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1},
|
||||
paramtype2 = "wallmounted",
|
||||
selection_box = {type = "wallmounted"},
|
||||
drop = "xdecor:curtain_"..color,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local fdir = node.param2
|
||||
minetest.set_node(pos, { name = "xdecor:curtain_"..color, param2 = fdir })
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:curtain_"..color.." 4",
|
||||
recipe = {
|
||||
{"", "wool:"..color, ""},
|
||||
{"", "wool:"..color, ""},
|
||||
{"", "wool:"..color, ""}
|
||||
}
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
xdecor.register("table", {
|
||||
description = "Table",
|
||||
tiles = {"xdecor_wood.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, 0.4, -0.5, 0.5, 0.5, 0.5},
|
||||
{-0.15, -0.5, -0.15, 0.15, 0.4, 0.15}
|
||||
}
|
||||
}
|
||||
})
|
28
handlers/nodeboxes.lua
Normal file
@ -0,0 +1,28 @@
|
||||
xdecor.box = {
|
||||
slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end,
|
||||
slab_z = function(depth) return { -0.5, -0.5, -0.5+depth, 0.5, 0.5, 0.5 } end,
|
||||
bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end,
|
||||
cuboid = function(radius_x, radius_y, radius_z) return {-radius_x, -radius_y, -radius_z, radius_x, radius_y, radius_z} end
|
||||
}
|
||||
|
||||
xdecor.nodebox = {
|
||||
regular = { type="regular" },
|
||||
null = { type = "fixed", fixed = { 0, 0, 0, 0, 0, 0 } }
|
||||
}
|
||||
|
||||
local mt = {}
|
||||
mt.__index = function(table, key)
|
||||
local ref = xdecor.box[key]
|
||||
local ref_type = type(ref)
|
||||
if ref_type == "function" then
|
||||
return function(...)
|
||||
return { type = "fixed", fixed = ref(...) }
|
||||
end
|
||||
elseif ref_type == "table" then
|
||||
return { type = "fixed", fixed = ref }
|
||||
elseif ref_type == "nil" then
|
||||
error(key .. "could not be found among nodebox presets and functions")
|
||||
end
|
||||
error("unexpected datatype " .. tostring(type(ref)) .. " while looking for " .. key)
|
||||
end
|
||||
setmetatable(xdecor.nodebox, mt)
|
76
handlers/registration.lua
Normal file
@ -0,0 +1,76 @@
|
||||
xdecor = xdecor or {}
|
||||
|
||||
local default_can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return meta:get_inventory():is_empty("main")
|
||||
end
|
||||
|
||||
local fancy_gui = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||
local default_inventory_size = 32
|
||||
local default_inventory_formspecs = {
|
||||
["8"]="size[8,6]"..fancy_gui..
|
||||
"list[context;main;0,0;8,1;]"..
|
||||
"list[current_player;main;0,2;8,4;]",
|
||||
|
||||
["16"]="size[8,7]"..fancy_gui..
|
||||
"list[context;main;0,0;8,2;]"..
|
||||
"list[current_player;main;0,3;8,4;]",
|
||||
|
||||
["24"]="size[8,8]" ..fancy_gui..
|
||||
"list[context;main;0,0;8,3;]"..
|
||||
"list[current_player;main;0,4;8,4;]",
|
||||
|
||||
["32"]="size[8,9]" ..fancy_gui..
|
||||
"list[context;main;0,0.3;8,4;]"..
|
||||
"list[current_player;main;0,4.85;8,1;]"..
|
||||
"list[current_player;main;0,6.08;8,3;8]"..
|
||||
default.get_hotbar_bg(0,4.85),
|
||||
}
|
||||
|
||||
local function get_formspec_by_size(size)
|
||||
local formspec = default_inventory_formspecs[tostring(size)]
|
||||
return formspec or default_inventory_formspecs
|
||||
end
|
||||
|
||||
function xdecor.register(name, def)
|
||||
def.drawtype = def.drawtype or (def.node_box and "nodebox")
|
||||
def.paramtype = def.paramtype or "light"
|
||||
def.paramtype2 = def.paramtype2 or "facedir"
|
||||
|
||||
local infotext = def.infotext
|
||||
local inventory = def.inventory
|
||||
def.inventory = nil
|
||||
|
||||
if inventory then
|
||||
def.on_construct = def.on_construct or function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if infotext then
|
||||
meta:set_string("infotext", infotext)
|
||||
end
|
||||
local size = inventory.size or default_inventory_size
|
||||
meta:get_inventory():set_size("main", size)
|
||||
meta:set_string("formspec", inventory.formspec or get_formspec_by_size(size))
|
||||
end
|
||||
|
||||
def.can_dig = def.can_dig or default_can_dig
|
||||
def.on_metadata_inventory_move = def.on_metadata_inventory_move or function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", "%s moves stuff in %s at %s"):format(
|
||||
player:get_player_name(), name, minetest.pos_to_string(pos))
|
||||
end
|
||||
def.on_metadata_inventory_put = def.on_metadata_inventory_put or function(pos, listname, index, stack, player)
|
||||
minetest.log("action", "%s moves stuff to %s at %s"):format(
|
||||
player:get_player_name(), name, minetest.pos_to_string(pos))
|
||||
end
|
||||
def.on_metadata_inventory_take = def.on_metadata_inventory_take or function(pos, listname, index, stack, player)
|
||||
minetest.log("action", "%s takes stuff from %s at %s"):format(
|
||||
player:get_player_name(), name, minetest.pos_to_string(pos))
|
||||
end
|
||||
elseif infotext and not def.on_construct then
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", infotext)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("xdecor:" .. name, def)
|
||||
end
|
14
init.lua
Normal file
@ -0,0 +1,14 @@
|
||||
xdecor = {}
|
||||
|
||||
modpath = minetest.get_modpath("xdecor")
|
||||
|
||||
dofile(modpath.."/handlers/nodeboxes.lua")
|
||||
dofile(modpath.."/handlers/registration.lua")
|
||||
|
||||
dofile(modpath.."/building.lua")
|
||||
dofile(modpath.."/crafts.lua")
|
||||
dofile(modpath.."/itemframes.lua")
|
||||
dofile(modpath.."/furniture.lua")
|
||||
dofile(modpath.."/lighting.lua")
|
||||
dofile(modpath.."/misc.lua")
|
||||
dofile(modpath.."/storage.lua")
|
125
itemframes.lua
Normal file
@ -0,0 +1,125 @@
|
||||
local tmp = {}
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
minetest.register_entity("xdecor:f_item",{
|
||||
hp_max = 1, visual="wielditem", visual_size={x=.33,y=.33},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0}, physical=false, textures={"air"},
|
||||
on_activate = function(self, staticdata)
|
||||
if tmp.nodename ~= nil and tmp.texture ~= nil then
|
||||
self.nodename = tmp.nodename
|
||||
tmp.nodename = nil
|
||||
self.texture = tmp.texture
|
||||
tmp.texture = nil
|
||||
else
|
||||
if staticdata ~= nil and staticdata ~= "" then
|
||||
local data = staticdata:split(';')
|
||||
if data and data[1] and data[2] then
|
||||
self.nodename = data[1]
|
||||
self.texture = data[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.texture ~= nil then
|
||||
self.object:set_properties({textures={self.texture}})
|
||||
end
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
if self.nodename ~= nil and self.texture ~= nil then
|
||||
return self.nodename .. ';' .. self.texture
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
})
|
||||
|
||||
local remove_item = function(pos, node)
|
||||
local objs = nil
|
||||
objs = minetest.get_objects_inside_radius(pos, .5)
|
||||
|
||||
if objs then
|
||||
for _, obj in ipairs(objs) do
|
||||
if obj and obj:get_luaentity() and obj:get_luaentity().name == "xdecor:f_item" then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local facedir = {}
|
||||
facedir[0] = {x=0, y=0, z=1}
|
||||
facedir[1] = {x=1, y=0, z=0}
|
||||
facedir[2] = {x=0, y=0, z=-1}
|
||||
facedir[3] = {x=-1, y=0, z=0}
|
||||
|
||||
local update_item = function(pos, node)
|
||||
remove_item(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if meta:get_string("item") ~= "" then
|
||||
local posad = facedir[node.param2]
|
||||
if not posad then return end
|
||||
pos.x = pos.x + posad.x*6.5/16
|
||||
pos.y = pos.y + posad.y*6.5/16
|
||||
pos.z = pos.z + posad.z*6.5/16
|
||||
tmp.nodename = node.name
|
||||
tmp.texture = ItemStack(meta:get_string("item")):get_name()
|
||||
|
||||
local e = minetest.add_entity(pos, "xdecor:f_item")
|
||||
local yaw = math.pi*2 - node.param2 * math.pi/2
|
||||
e:setyaw(yaw)
|
||||
end
|
||||
end
|
||||
|
||||
local drop_item = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("item") ~= "" then
|
||||
minetest.add_item(pos, meta:get_string("item"))
|
||||
meta:set_string("item", "")
|
||||
end
|
||||
remove_item(pos, node)
|
||||
end
|
||||
|
||||
xdecor.register("frame", {
|
||||
description = "Item frame",
|
||||
node_box = { type = "fixed", fixed = {-0.5, -0.5, 7/16, 0.5, 0.5, 0.5} },
|
||||
tiles = {"xdecor_frame.png"},
|
||||
inventory_image = "xdecor_frame.png",
|
||||
groups = {snappy=3},
|
||||
on_rotate = screwdriver.disallow,
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
meta:set_string("infotext", "Item frame (owned by "..placer:get_player_name()..")")
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if not itemstack then return end
|
||||
local meta = minetest.get_meta(pos)
|
||||
if clicker:get_player_name() == meta:get_string("owner") then
|
||||
drop_item(pos, node)
|
||||
local s = itemstack:take_item()
|
||||
meta:set_string("item", s:to_string())
|
||||
update_item(pos, node)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if puncher:get_player_name() == meta:get_string("owner") then
|
||||
drop_item(pos, node)
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return player:get_player_name() == meta:get_string("owner")
|
||||
end,
|
||||
after_destruct = remove_item,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:frame"},
|
||||
interval = 15,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then return end
|
||||
update_item(pos, node)
|
||||
end
|
||||
})
|
44
lighting.lua
Normal file
@ -0,0 +1,44 @@
|
||||
xdecor.register("candle", {
|
||||
description = "Candle",
|
||||
walkable = false,
|
||||
tiles = {
|
||||
{ name = "xdecor_candle_floor.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1.5
|
||||
}
|
||||
},
|
||||
{ name = "xdecor_candle_wall.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = {-0.25, -0.5, -0.25, 0.25, 0.1, 0.25},
|
||||
wall_side = {-0.5, -0.35, -0.15, -0.15, 0.4, 0.15}
|
||||
},
|
||||
inventory_image = "xdecor_candle_inv.png",
|
||||
drawtype = "torchlike",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
light_source = 12,
|
||||
groups = {dig_immediate=3, attached_node=1}
|
||||
})
|
||||
|
||||
xdecor.register("fire", {
|
||||
description = "Fake fire",
|
||||
walkable = false,
|
||||
tiles = { {name="xdecor_fire_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}} },
|
||||
drawtype = "plantlike",
|
||||
light_source = 14,
|
||||
damage_per_second = 2,
|
||||
drop = "",
|
||||
groups = {dig_immediate=3, not_in_creative_inventory=1}
|
||||
})
|
125
misc.lua
Normal file
@ -0,0 +1,125 @@
|
||||
xdecor.register("cauldron", {
|
||||
description = "Cauldron",
|
||||
groups = {snappy=1},
|
||||
tiles = {
|
||||
{
|
||||
name="xdecor_cauldron_top_anim.png",
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=3.0}
|
||||
},
|
||||
"xdecor_cauldron_sides.png"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("xdecor:flint_steel", {
|
||||
description = "Flint and steel",
|
||||
inventory_image = "xdecor_flint_steel.png",
|
||||
stack_max = 1,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0, max_drop_level = 0,
|
||||
groupcaps = {flamable = {uses=65, maxlevel=1}}
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type == "node" and minetest.get_node(pointed_thing.above).name == "air" then
|
||||
if not minetest.is_protected(pointed_thing.above, user:get_player_name()) then
|
||||
minetest.set_node(pointed_thing.above, {name="xdecor:fire"})
|
||||
else
|
||||
minetest.chat_send_player(user:get_player_name(), "This area is protected!")
|
||||
end
|
||||
else return end
|
||||
|
||||
itemstack:add_wear(65535/65)
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
flowers_type = {"dandelion_white", "dandelion_yellow", "geranium", "rose", "tulip", "viola"}
|
||||
|
||||
for _, f in ipairs(flowers_type) do
|
||||
xdecor.register("potted_"..f, {
|
||||
description = "Potted flowers ("..f..")",
|
||||
walkable = false,
|
||||
tiles = {"xdecor_"..f.."_pot.png"},
|
||||
inventory_image = "xdecor_"..f.."_pot.png",
|
||||
drawtype = "plantlike",
|
||||
groups = {dig_immediate=3},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "xdecor:potted_"..f.." 2",
|
||||
recipe = {"flowers:"..f, "xdecor:plant_pot"}
|
||||
})
|
||||
end
|
||||
|
||||
xdecor.register("painting", {
|
||||
description = "Painting",
|
||||
drawtype = "signlike",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
selection_box = {type = "wallmounted"},
|
||||
tiles = {"xdecor_painting.png"},
|
||||
inventory_image = "xdecor_painting.png",
|
||||
groups = {dig_immediate=3, attached_node=1},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
xdecor.register("plant_pot", {
|
||||
description = "Plant pot",
|
||||
tiles = {"xdecor_plant_pot_top.png", "xdecor_plant_pot_sides.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
local rope_sbox = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 }
|
||||
}
|
||||
|
||||
xdecor.register("rope", {
|
||||
description = "Hanging rope",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
tiles = {"xdecor_rope.png"},
|
||||
inventory_image = "xdecor_rope_inv.png",
|
||||
drawtype = "plantlike",
|
||||
groups = {dig_immediate=3},
|
||||
selection_box = rope_sbox
|
||||
})
|
||||
|
||||
local skull_sbox = {
|
||||
type = "fixed",
|
||||
fixed = { -0.3, -0.5, -0.3, 0.3, 0.25, 0.3 }
|
||||
}
|
||||
|
||||
xdecor.register("skull", {
|
||||
description = "Skull head",
|
||||
walkable = false,
|
||||
tiles = {"xdecor_skull.png"},
|
||||
inventory_image = "xdecor_skull.png",
|
||||
drawtype = "torchlike",
|
||||
groups = {dig_immediate=3, attached_node=1},
|
||||
selection_box = skull_sbox
|
||||
})
|
||||
|
||||
xdecor.register("tv", {
|
||||
description = "Television",
|
||||
tiles = {
|
||||
"xdecor_television_top.png",
|
||||
"xdecor_television_left.png^[transformR90",
|
||||
"xdecor_television_left.png^[transformFX",
|
||||
"xdecor_television_left.png",
|
||||
"xdecor_television_back.png",
|
||||
{ name="xdecor_television_front_animated.png",
|
||||
animation = {
|
||||
type="vertical_frames",
|
||||
aspect_w=16,
|
||||
aspect_h=16,
|
||||
length=80.0 }
|
||||
}
|
||||
},
|
||||
light_source = 11,
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
66
storage.lua
Normal file
@ -0,0 +1,66 @@
|
||||
xdecor.register("barrel", {
|
||||
description = "Barrel",
|
||||
tiles = {"xdecor_barrel_top.png", "xdecor_barrel_sides.png"},
|
||||
groups = {snappy=3},
|
||||
inventory = {size=24},
|
||||
infotext = "Barrel",
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
xdecor.register("cardboard_box", {
|
||||
description = "Cardboard box",
|
||||
tiles = {"xdecor_cardbox_top.png", "xdecor_cardbox_top.png", "xdecor_cardbox_sides.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { {-0.3125, -0.5, -0.3125, 0.3125, 0, 0.3125} }
|
||||
},
|
||||
groups = {snappy=3},
|
||||
inventory = {size=8}
|
||||
})
|
||||
|
||||
xdecor.register("cabinet", {
|
||||
description = "Cabinet",
|
||||
tiles = {"default_wood.png", "xdecor_cabinet_front.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
infotext = "Cabinet",
|
||||
inventory = {size=24}
|
||||
})
|
||||
|
||||
xdecor.register("cabinet_half", {
|
||||
description = "Cabinet half",
|
||||
tiles = {"default_wood.png", "xdecor_cabinet_half_front.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { {-0.5, 0, -0.5, 0.5, 0.5, 0.5} }
|
||||
},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
infotext = "Cabinet (half)",
|
||||
inventory = {size=8}
|
||||
})
|
||||
|
||||
xdecor.register("multishelf", {
|
||||
description = "Multishelf",
|
||||
tiles = {"default_wood.png", "xdecor_multishelf.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
infotext = "Multishelf",
|
||||
inventory = {size=24}
|
||||
})
|
||||
|
||||
xdecor.register("workbench", {
|
||||
description = "Work table",
|
||||
tiles = {
|
||||
"xdecor_workbench_top.png",
|
||||
"xdecor_workbench_top.png",
|
||||
"xdecor_workbench_sides.png",
|
||||
"xdecor_workbench_sides.png",
|
||||
"xdecor_workbench_front.png",
|
||||
"xdecor_workbench_front.png",
|
||||
},
|
||||
groups = {snappy=3},
|
||||
inventory = {size=24},
|
||||
infotext = "Work bench",
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
BIN
textures/xdecor_barrel_sides.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
textures/xdecor_barrel_top.png
Normal file
After Width: | Height: | Size: 271 B |
BIN
textures/xdecor_brass.png
Normal file
After Width: | Height: | Size: 199 B |
BIN
textures/xdecor_brass_ingot.png
Normal file
After Width: | Height: | Size: 242 B |
BIN
textures/xdecor_cabinet_front.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
textures/xdecor_cabinet_half_front.png
Normal file
After Width: | Height: | Size: 188 B |
BIN
textures/xdecor_candle_floor.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
textures/xdecor_candle_inv.png
Normal file
After Width: | Height: | Size: 176 B |
BIN
textures/xdecor_candle_wall.png
Normal file
After Width: | Height: | Size: 205 B |
BIN
textures/xdecor_cardbox_sides.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
textures/xdecor_cardbox_top.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
textures/xdecor_cauldron_sides.png
Normal file
After Width: | Height: | Size: 177 B |
BIN
textures/xdecor_cauldron_top_anim.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
textures/xdecor_coalstone_tile.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
textures/xdecor_curtain.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
textures/xdecor_curtain_open.png
Normal file
After Width: | Height: | Size: 276 B |
BIN
textures/xdecor_cushion.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
textures/xdecor_dandelion_white_pot.png
Normal file
After Width: | Height: | Size: 281 B |
BIN
textures/xdecor_dandelion_yellow_pot.png
Normal file
After Width: | Height: | Size: 284 B |
BIN
textures/xdecor_fire_anim.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
textures/xdecor_flint_steel.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
textures/xdecor_frame.png
Normal file
After Width: | Height: | Size: 224 B |
BIN
textures/xdecor_geranium_pot.png
Normal file
After Width: | Height: | Size: 302 B |
BIN
textures/xdecor_moonbrick.png
Normal file
After Width: | Height: | Size: 311 B |
BIN
textures/xdecor_multishelf.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
textures/xdecor_painting.png
Normal file
After Width: | Height: | Size: 257 B |
BIN
textures/xdecor_plant_pot_sides.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
textures/xdecor_plant_pot_top.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
textures/xdecor_rope.png
Normal file
After Width: | Height: | Size: 168 B |
BIN
textures/xdecor_rope_inv.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
textures/xdecor_rose_pot.png
Normal file
After Width: | Height: | Size: 294 B |
BIN
textures/xdecor_skull.png
Normal file
After Width: | Height: | Size: 188 B |
BIN
textures/xdecor_television_back.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
textures/xdecor_television_front_animated.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
textures/xdecor_television_left.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/xdecor_television_top.png
Normal file
After Width: | Height: | Size: 120 B |
BIN
textures/xdecor_tulip_pot.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
textures/xdecor_viola_pot.png
Normal file
After Width: | Height: | Size: 277 B |
BIN
textures/xdecor_wood.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
textures/xdecor_wood_tile.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
textures/xdecor_workbench_front.png
Normal file
After Width: | Height: | Size: 314 B |
BIN
textures/xdecor_workbench_sides.png
Normal file
After Width: | Height: | Size: 335 B |
BIN
textures/xdecor_workbench_top.png
Normal file
After Width: | Height: | Size: 287 B |
BIN
textures/xdecor_wrought_iron.png
Normal file
After Width: | Height: | Size: 192 B |