Mod cleanup
This commit is contained in:
parent
36b8a6c917
commit
353eff957f
@ -1 +1 @@
|
|||||||
This mod adds bees and beehives into minetest
|
This mod adds bees and hives to Minetest
|
||||||
|
160
init.lua
160
init.lua
@ -14,7 +14,9 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- FUNCTIONS
|
-- FUNCTIONS
|
||||||
|
--
|
||||||
|
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local random = math.random
|
local random = math.random
|
||||||
@ -55,15 +57,17 @@ local polinate_flower = function(pos, flower)
|
|||||||
}
|
}
|
||||||
local floor_pos = {x = spawn_pos.x, y = spawn_pos.y - 1, z = spawn_pos.z}
|
local floor_pos = {x = spawn_pos.x, y = spawn_pos.y - 1, z = spawn_pos.z}
|
||||||
local spawn = minetest.get_node(spawn_pos).name
|
local spawn = minetest.get_node(spawn_pos).name
|
||||||
local floor = minetest.get_node(floor_pos).name
|
local floorn = minetest.get_node(floor_pos).name
|
||||||
|
|
||||||
if floor == "group:soil" and spawn == "air" then
|
if floorn == "group:soil" and spawn == "air" then
|
||||||
minetest.set_node(spawn_pos, {name = flower})
|
minetest.set_node(spawn_pos, {name = flower})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- NODES
|
-- NODES
|
||||||
|
--
|
||||||
|
|
||||||
minetest.register_node("bees:extractor", {
|
minetest.register_node("bees:extractor", {
|
||||||
description = S("Honey Extractor"),
|
description = S("Honey Extractor"),
|
||||||
@ -77,11 +81,11 @@ minetest.register_node("bees:extractor", {
|
|||||||
tubedevice_receiver = 1
|
tubedevice_receiver = 1
|
||||||
},
|
},
|
||||||
|
|
||||||
on_construct = function(pos, node)
|
on_construct = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local pos = pos.x .. "," .. pos.y .. "," .. pos.z
|
pos = pos.x .. "," .. pos.y .. "," .. pos.z
|
||||||
|
|
||||||
inv:set_size("frames_filled", 1)
|
inv:set_size("frames_filled", 1)
|
||||||
inv:set_size("frames_emptied", 1)
|
inv:set_size("frames_emptied", 1)
|
||||||
@ -102,10 +106,11 @@ minetest.register_node("bees:extractor", {
|
|||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos, node)
|
on_timer = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
|
||||||
if not inv:contains_item("frames_filled", "bees:frame_full")
|
if not inv:contains_item("frames_filled", "bees:frame_full")
|
||||||
or not inv:contains_item("bottles_empty", "vessels:glass_bottle") then
|
or not inv:contains_item("bottles_empty", "vessels:glass_bottle") then
|
||||||
@ -125,12 +130,6 @@ minetest.register_node("bees:extractor", {
|
|||||||
inv:remove_item("bottles_empty", "vessels:glass_bottle")
|
inv:remove_item("bottles_empty", "vessels:glass_bottle")
|
||||||
inv:remove_item("frames_filled", "bees:frame_full")
|
inv:remove_item("frames_filled", "bees:frame_full")
|
||||||
|
|
||||||
local p = {
|
|
||||||
x = pos.x + random() - 0.5,
|
|
||||||
y = pos.y + random() - 0.5,
|
|
||||||
z = pos.z + random() - 0.5
|
|
||||||
}
|
|
||||||
|
|
||||||
-- wax flying all over the place
|
-- wax flying all over the place
|
||||||
minetest.add_particle({
|
minetest.add_particle({
|
||||||
pos = {x = pos.x, y = pos.y, z = pos.z},
|
pos = {x = pos.x, y = pos.y, z = pos.z},
|
||||||
@ -146,18 +145,14 @@ minetest.register_node("bees:extractor", {
|
|||||||
texture = "bees_wax_particle.png",
|
texture = "bees_wax_particle.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
|
|
||||||
timer:start(5)
|
timer:start(5)
|
||||||
else
|
else
|
||||||
local timer = minetest.get_node_timer(pos)
|
timer:start(5) -- try again in 5 seconds (was 1)
|
||||||
|
|
||||||
timer:start(5) -- Try again in 5 seconds (was 1)
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
tube = {
|
tube = {
|
||||||
insert_object = function(pos, node, stack, direction)
|
insert_object = function(pos, _, stack)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -183,7 +178,7 @@ minetest.register_node("bees:extractor", {
|
|||||||
return stack
|
return stack
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_insert = function(pos,node,stack,direction)
|
can_insert = function(pos, _, stack)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -205,7 +200,7 @@ minetest.register_node("bees:extractor", {
|
|||||||
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
|
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
|
||||||
},
|
},
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, _, stack)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -217,7 +212,7 @@ minetest.register_node("bees:extractor", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(_, listname, _, stack)
|
||||||
|
|
||||||
if (listname == "bottles_empty" and stack:get_name() == "vessels:glass_bottle")
|
if (listname == "bottles_empty" and stack:get_name() == "vessels:glass_bottle")
|
||||||
or (listname == "frames_filled" and stack:get_name() == "bees:frame_full") then
|
or (listname == "frames_filled" and stack:get_name() == "bees:frame_full") then
|
||||||
@ -227,11 +222,11 @@ minetest.register_node("bees:extractor", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function()
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_take = function(pos, _, _, stack, player)
|
||||||
|
|
||||||
if player and minetest.is_protected(pos, player:get_player_name()) then
|
if player and minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
@ -247,14 +242,12 @@ minetest.register_node("bees:bees", {
|
|||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1},
|
||||||
tiles = {
|
tiles = {{
|
||||||
{
|
|
||||||
name = "bees_strip.png",
|
name = "bees_strip.png",
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0
|
type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0
|
||||||
}
|
}
|
||||||
}
|
}},
|
||||||
},
|
|
||||||
damage_per_second = 1,
|
damage_per_second = 1,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
@ -265,8 +258,7 @@ minetest.register_node("bees:bees", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(_, _, puncher)
|
||||||
|
|
||||||
puncher:set_hp(puncher:get_hp() - 2)
|
puncher:set_hp(puncher:get_hp() - 2)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -274,7 +266,7 @@ minetest.register_node("bees:bees", {
|
|||||||
|
|
||||||
minetest.register_node("bees:hive_wild", {
|
minetest.register_node("bees:hive_wild", {
|
||||||
description = S("Wild Bee Hive"),
|
description = S("Wild Bee Hive"),
|
||||||
tiles = { --Neuromancer"s base texture
|
tiles = { -- Neuromancer's base texture
|
||||||
"bees_hive_wild.png", "bees_hive_wild.png", "bees_hive_wild.png",
|
"bees_hive_wild.png", "bees_hive_wild.png", "bees_hive_wild.png",
|
||||||
"bees_hive_wild.png", "bees_hive_wild_bottom.png"
|
"bees_hive_wild.png", "bees_hive_wild_bottom.png"
|
||||||
},
|
},
|
||||||
@ -291,10 +283,10 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
node_box = { -- VanessaE's wild hive nodebox contribution
|
node_box = { -- VanessaE's wild hive nodebox contribution
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.250000,-0.500000,-0.250000,0.250000,0.375000,0.250000}, --NodeBox 2
|
{-0.25, -0.5, -0.25, 0.25, 0.375, 0.25},
|
||||||
{-0.312500,-0.375000,-0.312500,0.312500,0.250000,0.312500}, --NodeBox 4
|
{-0.3125, -0.375, -0.3125, 0.3125, 0.25, 0.3125},
|
||||||
{-0.375000,-0.250000,-0.375000,0.375000,0.125000,0.375000}, --NodeBox 5
|
{-0.375, -0.25, -0.375, 0.375, 0.125, 0.375},
|
||||||
{-0.062500,-0.500000,-0.062500,0.062500,0.500000,0.062500}, --NodeBox 6
|
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -328,7 +320,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
|
|
||||||
local stacks = inv:get_list("combs")
|
local stacks = inv:get_list("combs")
|
||||||
|
|
||||||
for k, v in pairs(stacks) do
|
for k, _ in pairs(stacks) do
|
||||||
|
|
||||||
if inv:get_stack("combs", k):is_empty() then
|
if inv:get_stack("combs", k):is_empty() then
|
||||||
|
|
||||||
@ -363,7 +355,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, _, puncher)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -374,7 +366,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, taker)
|
on_metadata_inventory_take = function(pos, listname, _, _, taker)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -388,7 +380,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, taker)
|
on_metadata_inventory_put = function(pos)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
|
||||||
@ -397,7 +389,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(_, listname, _, stack)
|
||||||
|
|
||||||
-- restart the colony by adding a queen
|
-- restart the colony by adding a queen
|
||||||
if listname == "queen" and stack:get_name() == "bees:queen" then
|
if listname == "queen" and stack:get_name() == "bees:queen" then
|
||||||
@ -407,7 +399,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, _, clicker, itemstack)
|
||||||
|
|
||||||
minetest.show_formspec(clicker:get_player_name(),
|
minetest.show_formspec(clicker:get_player_name(),
|
||||||
"bees:hive_artificial",
|
"bees:hive_artificial",
|
||||||
@ -426,7 +418,7 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -438,10 +430,9 @@ minetest.register_node("bees:hive_wild", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
after_dig_node = function(_, _, _, user)
|
||||||
|
|
||||||
local wielded
|
local wielded
|
||||||
|
|
||||||
if user:get_wielded_item() ~= nil then
|
if user:get_wielded_item() ~= nil then
|
||||||
wielded = user:get_wielded_item()
|
wielded = user:get_wielded_item()
|
||||||
else
|
else
|
||||||
@ -488,7 +479,6 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
@ -500,13 +490,15 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
meta:set_string("infotext", S("Requires Queen bee to function"))
|
meta:set_string("infotext", S("Requires Queen bee to function"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, _, clicker)
|
||||||
|
|
||||||
if minetest.is_protected(pos, clicker:get_player_name()) then
|
local player_name = clicker:get_player_name()
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, player_name) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.show_formspec(clicker:get_player_name(),
|
minetest.show_formspec(player_name,
|
||||||
"bees:hive_artificial",
|
"bees:hive_artificial",
|
||||||
hive_artificial(pos)
|
hive_artificial(pos)
|
||||||
)
|
)
|
||||||
@ -523,7 +515,7 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos,elapsed)
|
on_timer = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -555,7 +547,7 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
|
|
||||||
local stacks = inv:get_list("frames")
|
local stacks = inv:get_list("frames")
|
||||||
|
|
||||||
for k, v in pairs(stacks) do
|
for k, _ in pairs(stacks) do
|
||||||
|
|
||||||
if inv:get_stack("frames", k):get_name() == "bees:frame_empty" then
|
if inv:get_stack("frames", k):get_name() == "bees:frame_empty" then
|
||||||
|
|
||||||
@ -578,7 +570,7 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname)
|
||||||
|
|
||||||
if listname == "queen" then
|
if listname == "queen" then
|
||||||
|
|
||||||
@ -591,7 +583,7 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function(pos, from_list, _, to_list, to_index)
|
||||||
|
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
|
||||||
@ -607,7 +599,7 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, _, stack)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -627,7 +619,7 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack)
|
||||||
|
|
||||||
if not minetest.get_meta(pos):get_inventory():get_stack(listname, index):is_empty() then return 0 end
|
if not minetest.get_meta(pos):get_inventory():get_stack(listname, index):is_empty() then return 0 end
|
||||||
|
|
||||||
@ -648,7 +640,10 @@ minetest.register_node("bees:hive_artificial", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ABMS
|
|
||||||
|
--
|
||||||
|
-- ABMs
|
||||||
|
--
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"bees:hive_artificial", "bees:hive_wild", "bees:hive_industrial"},
|
nodenames = {"bees:hive_artificial", "bees:hive_wild", "bees:hive_industrial"},
|
||||||
@ -692,14 +687,14 @@ minetest.register_abm({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- spawn abm. This should be changed to a more realistic type of spawning
|
-- spawn ABM. This should be changed to a more realistic type of spawning
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:leaves"},
|
nodenames = {"group:leaves"},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = 800,--1600,
|
interval = 800, -- 1600
|
||||||
chance = 10,--20,
|
chance = 10, -- 20
|
||||||
|
|
||||||
action = function(pos, node)
|
action = function(pos)
|
||||||
|
|
||||||
if floor(pos.x / 40) ~= pos.x / 40
|
if floor(pos.x / 40) ~= pos.x / 40
|
||||||
or floor(pos.z / 40) ~= pos.z / 40
|
or floor(pos.z / 40) ~= pos.z / 40
|
||||||
@ -725,7 +720,7 @@ minetest.register_abm({
|
|||||||
interval = 30,
|
interval = 30,
|
||||||
chance = 4,
|
chance = 4,
|
||||||
|
|
||||||
action = function(pos, node, _, _)
|
action = function(pos)
|
||||||
|
|
||||||
local p = {
|
local p = {
|
||||||
x = pos.x + random(-5, 5),
|
x = pos.x + random(-5, 5),
|
||||||
@ -746,13 +741,15 @@ minetest.register_abm({
|
|||||||
interval = 30,
|
interval = 30,
|
||||||
chance = 5,
|
chance = 5,
|
||||||
|
|
||||||
action = function(pos, node, _, _)
|
action = function(pos)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- ITEMS
|
-- ITEMS
|
||||||
|
--
|
||||||
|
|
||||||
minetest.register_craftitem("bees:frame_empty", {
|
minetest.register_craftitem("bees:frame_empty", {
|
||||||
description = S("Empty hive frame"),
|
description = S("Empty hive frame"),
|
||||||
@ -794,7 +791,9 @@ minetest.register_craftitem("bees:queen", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- CRAFTS
|
-- CRAFTS
|
||||||
|
--
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "bees:extractor",
|
output = "bees:extractor",
|
||||||
@ -852,7 +851,9 @@ if minetest.get_modpath("bushes_classic") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- TOOLS
|
-- TOOLS
|
||||||
|
--
|
||||||
|
|
||||||
minetest.register_tool("bees:smoker", {
|
minetest.register_tool("bees:smoker", {
|
||||||
description = S("smoker"),
|
description = S("smoker"),
|
||||||
@ -863,7 +864,7 @@ minetest.register_tool("bees:smoker", {
|
|||||||
damage_groups = {fleshy = 2},
|
damage_groups = {fleshy = 2},
|
||||||
},
|
},
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, _, pointed_thing)
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
@ -909,7 +910,10 @@ minetest.register_tool("bees:grafting_tool", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- COMPATIBILTY --remove after all has been updated
|
--
|
||||||
|
-- COMPATIBILTY
|
||||||
|
-- remove after all has been updated
|
||||||
|
--
|
||||||
|
|
||||||
-- ALIASES
|
-- ALIASES
|
||||||
minetest.register_alias("bees:honey_extractor", "bees:extractor")
|
minetest.register_alias("bees:honey_extractor", "bees:extractor")
|
||||||
@ -952,7 +956,9 @@ minetest.register_lbm({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- PIPEWORKS
|
-- PIPEWORKS
|
||||||
|
--
|
||||||
|
|
||||||
if minetest.get_modpath("pipeworks") then
|
if minetest.get_modpath("pipeworks") then
|
||||||
|
|
||||||
@ -967,7 +973,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
|
||||||
tube = {
|
tube = {
|
||||||
insert_object = function(pos, node, stack, direction)
|
insert_object = function(pos, _, stack)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -996,7 +1002,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
return stack
|
return stack
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_insert = function(pos,node,stack,direction)
|
can_insert = function(pos, _, stack)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -1016,7 +1022,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_remove = function(pos,node,stack,direction)
|
can_remove = function(_, _, stack)
|
||||||
|
|
||||||
if stack:get_name() == "bees:frame_full" then
|
if stack:get_name() == "bees:frame_full" then
|
||||||
return 1
|
return 1
|
||||||
@ -1032,7 +1038,6 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
@ -1044,13 +1049,15 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
meta:set_string("infotext", S("Requires Queen bee to function"))
|
meta:set_string("infotext", S("Requires Queen bee to function"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, _, clicker)
|
||||||
|
|
||||||
if minetest.is_protected(pos, clicker:get_player_name()) then
|
local player_name = clicker:get_player_name()
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, player_name) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.show_formspec(clicker:get_player_name(),
|
minetest.show_formspec(player_name,
|
||||||
"bees:hive_artificial",
|
"bees:hive_artificial",
|
||||||
hive_artificial(pos)
|
hive_artificial(pos)
|
||||||
)
|
)
|
||||||
@ -1067,7 +1074,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos,elapsed)
|
on_timer = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -1097,7 +1104,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
|
|
||||||
local stacks = inv:get_list("frames")
|
local stacks = inv:get_list("frames")
|
||||||
|
|
||||||
for k, v in pairs(stacks) do
|
for k, _ in pairs(stacks) do
|
||||||
|
|
||||||
if inv:get_stack("frames", k):get_name() == "bees:frame_empty" then
|
if inv:get_stack("frames", k):get_name() == "bees:frame_empty" then
|
||||||
|
|
||||||
@ -1120,7 +1127,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname)
|
||||||
|
|
||||||
if listname == "queen" then
|
if listname == "queen" then
|
||||||
|
|
||||||
@ -1133,7 +1140,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function(pos, from_list, _, to_list, to_index)
|
||||||
|
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
|
||||||
@ -1149,7 +1156,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, _, stack)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -1169,7 +1176,7 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack)
|
||||||
|
|
||||||
if not minetest.get_meta(pos):get_inventory():get_stack(listname, index):is_empty() then
|
if not minetest.get_meta(pos):get_inventory():get_stack(listname, index):is_empty() then
|
||||||
return 0
|
return 0
|
||||||
@ -1203,17 +1210,18 @@ if minetest.get_modpath("pipeworks") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
-- LUCKY BLOCKS
|
-- LUCKY BLOCKS
|
||||||
|
--
|
||||||
|
|
||||||
if minetest.get_modpath("lucky_block") then
|
if minetest.get_modpath("lucky_block") then
|
||||||
|
|
||||||
local add_bees = function(pos, player)
|
local add_bees = function(pos, player)
|
||||||
|
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 15)
|
local objs = minetest.get_objects_inside_radius(pos, 15)
|
||||||
local violet = minetest.get_color_escape_sequence("#ff00ff")
|
|
||||||
|
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
minetest.chat_send_player(player:get_player_name(),
|
||||||
violet .. S("Bees! Bees for all!"))
|
minetest.colorize("violet", S("Bees! Bees for all!")))
|
||||||
|
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user