Add Hive and Rust Bars
19
crafts.lua
@ -134,11 +134,26 @@ minetest.register_craftitem("xdecor:hammer", {
|
|||||||
inventory_image = "xdecor_hammer.png"
|
inventory_image = "xdecor_hammer.png"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "xdecor:hive",
|
||||||
|
recipe = {
|
||||||
|
{"default:paper", "default:paper", "default:paper"},
|
||||||
|
{"default:paper", "", "default:paper"},
|
||||||
|
{"default:paper", "default:paper", "default:paper"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("xdecor:honey", {
|
||||||
|
description = "Honey",
|
||||||
|
inventory_image = "xdecor_honey.png",
|
||||||
|
on_use = minetest.item_eat(2)
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "xdecor:ivy 2",
|
output = "xdecor:ivy 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:leaves", "group:stick"},
|
{"group:leaves"},
|
||||||
{"group:stick", "group:leaves"}
|
{"group:leaves"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
56
hive.lua
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
local function hive_construct(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", "size[8,5;]"..xdecor.fancy_gui..
|
||||||
|
"label[1.5,0;Bees are making honey\nwith pollen around...]"..
|
||||||
|
"list[current_name;honey;5,0;1,1;]"..
|
||||||
|
"list[current_player;main;0,1.35;8,4;]")
|
||||||
|
meta:set_string("infotext", "Artificial Hive")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("honey", 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function hive_dig(pos, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
if not inv:is_empty("honey") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
xdecor.register("hive", {
|
||||||
|
description = "Artificial Hive",
|
||||||
|
tiles = {
|
||||||
|
"xdecor_hive_top.png",
|
||||||
|
"xdecor_hive_top.png",
|
||||||
|
"xdecor_hive_side.png",
|
||||||
|
"xdecor_hive_side.png",
|
||||||
|
"xdecor_hive_side.png",
|
||||||
|
"xdecor_hive_front.png",
|
||||||
|
},
|
||||||
|
groups = {choppy=3, flammable=1},
|
||||||
|
on_construct = hive_construct,
|
||||||
|
can_dig = hive_dig,
|
||||||
|
on_punch = function(pos, node, puncher, pointed_thing)
|
||||||
|
local health = puncher:get_hp()
|
||||||
|
puncher:set_hp(health-4)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"xdecor:hive"},
|
||||||
|
interval = 10, chance = 10,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
|
local radius = 16
|
||||||
|
local minp = {x=pos.x-radius, y=pos.y-radius, z=pos.z-radius}
|
||||||
|
local maxp = {x=pos.x+radius, y=pos.y+radius, z=pos.z+radius}
|
||||||
|
local flowers = minetest.find_nodes_in_area(minp, maxp, "group:flower")
|
||||||
|
|
||||||
|
if #flowers >= 4 then
|
||||||
|
inv:add_item("honey", "xdecor:honey")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
1
init.lua
@ -4,6 +4,7 @@ modpath = minetest.get_modpath("xdecor")
|
|||||||
dofile(modpath.."/handlers/nodeboxes.lua")
|
dofile(modpath.."/handlers/nodeboxes.lua")
|
||||||
dofile(modpath.."/handlers/registration.lua")
|
dofile(modpath.."/handlers/registration.lua")
|
||||||
dofile(modpath.."/crafts.lua")
|
dofile(modpath.."/crafts.lua")
|
||||||
|
dofile(modpath.."/hive.lua")
|
||||||
dofile(modpath.."/itemframes.lua")
|
dofile(modpath.."/itemframes.lua")
|
||||||
dofile(modpath.."/mailbox.lua")
|
dofile(modpath.."/mailbox.lua")
|
||||||
dofile(modpath.."/rope.lua")
|
dofile(modpath.."/rope.lua")
|
||||||
|
18
nodes.lua
@ -318,7 +318,7 @@ for _, f in ipairs(flowerstype) do
|
|||||||
xdecor.register("potted_"..f, {
|
xdecor.register("potted_"..f, {
|
||||||
description = "Potted Flowers ("..f..")",
|
description = "Potted Flowers ("..f..")",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {dig_immediate=3, flammable=3, plant=1},
|
groups = {dig_immediate=3, flammable=3, plant=1, flower=1},
|
||||||
tiles = {"xdecor_"..f.."_pot.png"},
|
tiles = {"xdecor_"..f.."_pot.png"},
|
||||||
inventory_image = "xdecor_"..f.."_pot.png",
|
inventory_image = "xdecor_"..f.."_pot.png",
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -380,6 +380,22 @@ xdecor.register("multishelf", {
|
|||||||
sounds = xdecor.wood
|
sounds = xdecor.wood
|
||||||
})
|
})
|
||||||
|
|
||||||
|
xpanes.register_pane("rust_bar", {
|
||||||
|
description = "Rust Bars",
|
||||||
|
tiles = {"xdecor_rust_bars.png"},
|
||||||
|
drawtype = "airlike",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
textures = {"xdecor_rust_bars.png", "xdecor_rust_bars.png",
|
||||||
|
"xpanes_space.png"},
|
||||||
|
inventory_image = "xdecor_rust_bars.png",
|
||||||
|
wield_image = "xdecor_rust_bars.png",
|
||||||
|
groups = {snappy=2, pane=1},
|
||||||
|
recipe = {
|
||||||
|
{"xpanes:bar", "default:dirt"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
xdecor.register("stereo", {
|
xdecor.register("stereo", {
|
||||||
description = "Stereo",
|
description = "Stereo",
|
||||||
groups = {snappy=2},
|
groups = {snappy=2},
|
||||||
|
BIN
textures/xdecor_hive_front.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
textures/xdecor_hive_side.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
textures/xdecor_hive_top.png
Normal file
After Width: | Height: | Size: 375 B |
BIN
textures/xdecor_honey.png
Normal file
After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 192 B |
BIN
textures/xdecor_rust_bars.png
Normal file
After Width: | Height: | Size: 190 B |