new setting 'protect_beehive' to avoid honey plundering
parent
a30028f1f8
commit
a47472e2fb
|
@ -1,48 +1,58 @@
|
||||||
local S = ...
|
local S = ...
|
||||||
|
|
||||||
petz.set_infotext_behive = function(meta, honey_count, bee_count)
|
petz.set_infotext_beehive = function(meta, honey_count, bee_count)
|
||||||
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_behive
|
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_beehive
|
||||||
meta:set_string("infotext", S("Honey")..": "..tostring(honey_count) .." | "..S("Bees Inside")..": "..tostring(bee_count).." | "..S("Total Bees")..": "..tostring(total_bees))
|
local infotext = S("Honey")..": "..tostring(honey_count).." | "..S("Bees Inside")..": "..tostring(bee_count).." | "
|
||||||
|
..S("Total Bees")..": "..tostring(total_bees)
|
||||||
|
if petz.settings.protect_beehive then
|
||||||
|
local owner_name = meta:get_string("owner")
|
||||||
|
if owner_name == "" then
|
||||||
|
owner_name = S("Unknown")
|
||||||
|
end
|
||||||
|
infotext = infotext .. " | " .. S("Owner") .. ": ".. owner_name
|
||||||
|
end
|
||||||
|
meta:set_string("infotext", infotext)
|
||||||
end
|
end
|
||||||
|
|
||||||
petz.decrease_total_bee_count = function(pos)
|
petz.decrease_total_bee_count = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_behive
|
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_beehive
|
||||||
total_bees = total_bees - 1
|
total_bees = total_bees - 1
|
||||||
meta:set_int("total_bees", total_bees)
|
meta:set_int("total_bees", total_bees)
|
||||||
end
|
end
|
||||||
|
|
||||||
petz.behive_exists = function(self)
|
petz.beehive_exists = function(self)
|
||||||
local behive_exists
|
local beehive_exists
|
||||||
if self.behive then
|
if self.beehive then
|
||||||
local node = minetest.get_node_or_nil(self.behive)
|
local node = minetest.get_node_or_nil(self.beehive)
|
||||||
if node and node.name == "petz:beehive" then
|
if node and node.name == "petz:beehive" then
|
||||||
behive_exists = true
|
beehive_exists = true
|
||||||
else
|
else
|
||||||
behive_exists = false
|
beehive_exists = false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
behive_exists = false
|
beehive_exists = false
|
||||||
end
|
end
|
||||||
if behive_exists then
|
if beehive_exists then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
self.behive = nil
|
self.beehive = nil
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
petz.get_behive_stats = function(pos)
|
petz.get_beehive_stats = function(pos)
|
||||||
if not(pos) then
|
if not(pos) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local honey_count = meta:get_int("honey_count") or 0
|
local honey_count = meta:get_int("honey_count")
|
||||||
local bee_count = meta:get_int("bee_count") or 0
|
local bee_count = meta:get_int("bee_count")
|
||||||
return meta, honey_count, bee_count
|
local owner = meta:get_string("owner")
|
||||||
|
return meta, honey_count, bee_count, owner
|
||||||
end
|
end
|
||||||
|
|
||||||
petz.spawn_bee_pos = function(pos) --Check a pos close to a behive to spawn a bee
|
petz.spawn_bee_pos = function(pos) --Check a pos close to a beehive to spawn a bee
|
||||||
local pos_1 = {
|
local pos_1 = {
|
||||||
x = pos.x - 1,
|
x = pos.x - 1,
|
||||||
y = pos.y - 1,
|
y = pos.y - 1,
|
||||||
|
@ -60,3 +70,177 @@ petz.spawn_bee_pos = function(pos) --Check a pos close to a behive to spawn a be
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Beehive
|
||||||
|
|
||||||
|
minetest.register_node("petz:beehive", {
|
||||||
|
description = S("Beehive"),
|
||||||
|
tiles = {"petz_beehive.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3,
|
||||||
|
flammable = 3, wool = 1},
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
|
||||||
|
drop = {},
|
||||||
|
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local drops = {
|
||||||
|
{name = "petz:honeycomb", chance = 1, min = 1, max= 6},
|
||||||
|
}
|
||||||
|
meta:set_string("drops", minetest.serialize(drops))
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(2.0) -- in seconds
|
||||||
|
local honey_count = petz.settings.initial_honey_beehive
|
||||||
|
meta:set_int("honey_count", honey_count)
|
||||||
|
local bee_count = petz.settings.max_bees_beehive
|
||||||
|
meta:set_int("total_bees", bee_count)
|
||||||
|
meta:set_int("bee_count", bee_count)
|
||||||
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local honey_count
|
||||||
|
local bee_count
|
||||||
|
if placer:is_player() then
|
||||||
|
honey_count = 0
|
||||||
|
bee_count = 0
|
||||||
|
if petz.settings.protect_beehive then
|
||||||
|
meta:set_string("owner", placer:get_player_name())
|
||||||
|
end
|
||||||
|
minetest.after(petz.settings.worker_bee_delay, function()
|
||||||
|
local node =minetest.get_node_or_nil(pos)
|
||||||
|
if not(node and node.name == "petz:beehive") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
meta = minetest.get_meta(pos)
|
||||||
|
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_beehive
|
||||||
|
if total_bees < petz.settings.max_bees_beehive then
|
||||||
|
bee_count = meta:get_int("bee_count")
|
||||||
|
bee_count = bee_count + 1
|
||||||
|
total_bees = total_bees + 1
|
||||||
|
meta:set_int('bee_count', bee_count)
|
||||||
|
meta:set_int('total_bees', total_bees)
|
||||||
|
honey_count = meta:get_int('honey_count')
|
||||||
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
|
end
|
||||||
|
end, pos)
|
||||||
|
else
|
||||||
|
honey_count = petz.settings.initial_honey_beehive
|
||||||
|
bee_count = petz.settings.max_bees_beehive
|
||||||
|
end
|
||||||
|
meta:set_int("honey_count", honey_count)
|
||||||
|
meta:set_int("bee_count", bee_count)
|
||||||
|
meta:set_int("total_bees", bee_count)
|
||||||
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_destruct = function(pos)
|
||||||
|
minetest.add_entity(pos, "petz:queen_bee")
|
||||||
|
kitz.node_drop_items(pos)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos)
|
||||||
|
local meta, honey_count, bee_count, owner = petz.get_beehive_stats(pos)
|
||||||
|
if bee_count > 0 then --if bee inside
|
||||||
|
local tpos = {
|
||||||
|
x = pos. x,
|
||||||
|
y = pos.y - 4,
|
||||||
|
z = pos.z,
|
||||||
|
}
|
||||||
|
local ray = minetest.raycast(pos, tpos, false, false) --check if fire/torch (igniter) below
|
||||||
|
local igniter_below = false
|
||||||
|
for thing in ray do
|
||||||
|
if thing.type == "node" then
|
||||||
|
local node_name = minetest.get_node(thing.under).name
|
||||||
|
--minetest.chat_send_player("singleplayer", node_name)
|
||||||
|
if minetest.get_item_group(node_name, "igniter") >0 or minetest.get_item_group(node_name, "torch") > 0 then
|
||||||
|
igniter_below = true
|
||||||
|
--minetest.chat_send_player("singleplayer", S("igniter"))
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local bee_outing_ratio
|
||||||
|
if igniter_below == false then
|
||||||
|
bee_outing_ratio = petz.settings.bee_outing_ratio
|
||||||
|
else
|
||||||
|
bee_outing_ratio = 1
|
||||||
|
end
|
||||||
|
if math.random(1, bee_outing_ratio) == 1 then --opportunitty to go out
|
||||||
|
local spawn_bee_pos = petz.spawn_bee_pos(pos)
|
||||||
|
if spawn_bee_pos then
|
||||||
|
local bee = minetest.add_entity(spawn_bee_pos, "petz:bee")
|
||||||
|
local bee_entity = bee:get_luaentity()
|
||||||
|
bee_entity.beehive = kitz.remember(bee_entity, "beehive", pos)
|
||||||
|
bee_count = bee_count - 1
|
||||||
|
meta:set_int("bee_count", bee_count)
|
||||||
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||||
|
local wielded_item = player:get_wielded_item()
|
||||||
|
local wielded_item_name = wielded_item:get_name()
|
||||||
|
local meta, honey_count, bee_count, owner = petz.get_beehive_stats(pos)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if petz.settings.protect_beehive then
|
||||||
|
local owner_name = meta:get_string("owner")
|
||||||
|
if not(owner_name == "") and (owner_name ~= player_name) then
|
||||||
|
minetest.chat_send_player(player_name, S("This beehive belongs to").." "..owner_name)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if wielded_item_name == "vessels:glass_bottle" then
|
||||||
|
if honey_count > 0 then
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
if inv:room_for_item("main", "petz:honey_bottle") then
|
||||||
|
local itemstack_name = itemstack:get_name()
|
||||||
|
local stack = ItemStack("petz:honey_bottle 1")
|
||||||
|
if (itemstack_name == "petz:honey_bottle" or itemstack_name == "") and (itemstack:get_count() < itemstack:get_stack_max()) then
|
||||||
|
itemstack:add_item(stack)
|
||||||
|
else
|
||||||
|
inv:add_item("main", stack)
|
||||||
|
end
|
||||||
|
itemstack:take_item()
|
||||||
|
honey_count = honey_count - 1
|
||||||
|
meta:set_int("honey_count", honey_count)
|
||||||
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
|
return itemstack
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, S("No room in your inventory for the honey bottle."))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, S("No honey in the beehive."))
|
||||||
|
end
|
||||||
|
elseif wielded_item_name == "petz:bee_set" then
|
||||||
|
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_beehive
|
||||||
|
if total_bees < petz.settings.max_bees_beehive then
|
||||||
|
bee_count = bee_count + 1
|
||||||
|
total_bees = total_bees + 1
|
||||||
|
meta:set_int("bee_count", bee_count)
|
||||||
|
meta:set_int("total_bees", total_bees)
|
||||||
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
|
itemstack:take_item()
|
||||||
|
return itemstack
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, S("This beehive already has").." "
|
||||||
|
..tostring(petz.settings.max_bees_beehive).." "..S("bees inside."))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output = "petz:beehive",
|
||||||
|
recipe = {
|
||||||
|
{"petz:honeycomb", "petz:honeycomb", "petz:honeycomb"},
|
||||||
|
{"petz:honeycomb", "petz:queen_bee_set", "petz:honeycomb"},
|
||||||
|
{"petz:honeycomb", "petz:honeycomb", "petz:honeycomb"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -127,10 +127,10 @@ petz.capture = function(self, clicker, put_in_inventory)
|
||||||
minetest.add_item(clicker:get_pos(), new_stack)
|
minetest.add_item(clicker:get_pos(), new_stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.type == "bee" and self.behive then
|
if self.type == "bee" and self.beehive then
|
||||||
petz.decrease_total_bee_count(self.behive)
|
petz.decrease_total_bee_count(self.beehive)
|
||||||
local meta, honey_count, bee_count = petz.get_behive_stats(self.behive)
|
local meta, honey_count, bee_count, owner = petz.get_beehive_stats(self.beehive)
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
end
|
end
|
||||||
petz.remove_tamed_by_owner(self, false)
|
petz.remove_tamed_by_owner(self, false)
|
||||||
kitz.remove_mob(self)
|
kitz.remove_mob(self)
|
||||||
|
|
|
@ -8,7 +8,10 @@ petz.dyn_prop = {
|
||||||
anthill_founded = {type= "boolean", default = false},
|
anthill_founded = {type= "boolean", default = false},
|
||||||
back_home = {type= "boolean", default = false},
|
back_home = {type= "boolean", default = false},
|
||||||
beaver_oil_applied = {type= "boolean", default = false},
|
beaver_oil_applied = {type= "boolean", default = false},
|
||||||
|
--DELETE THIS BLOCK IN A FUTURE UPDATE -- behive changed to beehive>>>
|
||||||
behive = {type= "pos", default = nil},
|
behive = {type= "pos", default = nil},
|
||||||
|
--<
|
||||||
|
beehive = {type= "pos", default = nil},
|
||||||
brushed = {type= "boolean", default = false},
|
brushed = {type= "boolean", default = false},
|
||||||
captured = {type= "boolean", default = false},
|
captured = {type= "boolean", default = false},
|
||||||
child = {type= "boolean", default = false},
|
child = {type= "boolean", default = false},
|
||||||
|
@ -152,7 +155,7 @@ petz.load_vars = function(self)
|
||||||
petz.calculate_sleep_times(self)
|
petz.calculate_sleep_times(self)
|
||||||
end
|
end
|
||||||
petz.insert_tamed_by_owner(self)
|
petz.insert_tamed_by_owner(self)
|
||||||
petz.cleanup_prop(self) --Reset some vars
|
petz.cleanup_prop(self) --Reset some vars
|
||||||
end
|
end
|
||||||
|
|
||||||
function petz.set_initial_properties(self, staticdata, dtime_s)
|
function petz.set_initial_properties(self, staticdata, dtime_s)
|
||||||
|
@ -160,14 +163,6 @@ function petz.set_initial_properties(self, staticdata, dtime_s)
|
||||||
local static_data_table = minetest.deserialize(staticdata)
|
local static_data_table = minetest.deserialize(staticdata)
|
||||||
local captured_mob = false
|
local captured_mob = false
|
||||||
local baby_born = false
|
local baby_born = false
|
||||||
--TO DELETE IN FUTURE VERSIONS-->
|
|
||||||
local static_table_name
|
|
||||||
if static_data_table and static_data_table["memory"] then
|
|
||||||
static_table_name = "memory"
|
|
||||||
else
|
|
||||||
static_table_name = "fields"
|
|
||||||
end
|
|
||||||
--<
|
|
||||||
if static_data_table and static_data_table[static_table_name] and static_data_table[static_table_name]["captured"] then
|
if static_data_table and static_data_table[static_table_name] and static_data_table[static_table_name]["captured"] then
|
||||||
captured_mob = true
|
captured_mob = true
|
||||||
elseif static_data_table and static_data_table["baby_born"] then
|
elseif static_data_table and static_data_table["baby_born"] then
|
||||||
|
@ -322,11 +317,11 @@ function petz.set_initial_properties(self, staticdata, dtime_s)
|
||||||
petz.colorize(self, self.colorized)
|
petz.colorize(self, self.colorized)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--DELETE THIS BLOCK IN THE NEXT UPDATE -- FOR COMPATIBIITY PURPOSES FOR OLD CHICKENS ONLY>>>
|
--<<<
|
||||||
if self.type == "chicken" then
|
--DELETE THIS BLOCK IN A FUTURE UPDATE -- behive changed to beehive>>>
|
||||||
self.is_baby = kitz.remember(self, "is_baby", true)
|
if self.behive then
|
||||||
self.texture_no = kitz.remember(self, "texture_no", 1)
|
self.beehive = kitz.remember(self, "beehive", self.behive)
|
||||||
petz.set_properties(self, {textures = {self.textures[1]}})
|
self.behive = nil
|
||||||
end
|
end
|
||||||
--<<<
|
--<<<
|
||||||
if self.horseshoes and not captured_mob then
|
if self.horseshoes and not captured_mob then
|
||||||
|
|
|
@ -63,22 +63,22 @@ function petz.lq_search_flower(self, tpos)
|
||||||
kitz.queue_low(self, func)
|
kitz.queue_low(self, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
function petz.hq_gotobehive(self, prty, pos)
|
function petz.hq_gotobeehive(self, prty, pos)
|
||||||
local func = function()
|
local func = function()
|
||||||
if not(self.pollen) or not(self.behive) then
|
if not(self.pollen) or not(self.beehive) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
kitz.animate(self, "fly")
|
kitz.animate(self, "fly")
|
||||||
petz.lq_search_behive(self)
|
petz.lq_search_beehive(self)
|
||||||
end
|
end
|
||||||
kitz.queue_high(self, func, prty)
|
kitz.queue_high(self, func, prty)
|
||||||
end
|
end
|
||||||
|
|
||||||
function petz.lq_search_behive(self)
|
function petz.lq_search_beehive(self)
|
||||||
local func = function()
|
local func = function()
|
||||||
local tpos
|
local tpos
|
||||||
if self.behive then
|
if self.beehive then
|
||||||
tpos = self.behive
|
tpos = self.beehive
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -89,14 +89,14 @@ function petz.lq_search_behive(self)
|
||||||
petz.set_velocity(self, {x= 0.0, y= y_distance, z= 0.0})
|
petz.set_velocity(self, {x= 0.0, y= y_distance, z= 0.0})
|
||||||
end
|
end
|
||||||
if kitz.drive_to_pos(self, tpos, 1.5, 6.28, 1.01) then
|
if kitz.drive_to_pos(self, tpos, 1.5, 6.28, 1.01) then
|
||||||
if petz.behive_exists(self) then
|
if petz.beehive_exists(self) then
|
||||||
kitz.remove_mob(self)
|
kitz.remove_mob(self)
|
||||||
local meta, honey_count, bee_count = petz.get_behive_stats(self.behive)
|
local meta, honey_count, bee_count, owner = petz.get_beehive_stats(self.beehive)
|
||||||
bee_count = bee_count + 1
|
bee_count = bee_count + 1
|
||||||
meta:set_int("bee_count", bee_count)
|
meta:set_int("bee_count", bee_count)
|
||||||
honey_count = honey_count + 1
|
honey_count = honey_count + 1
|
||||||
meta:set_int("honey_count", honey_count)
|
meta:set_int("honey_count", honey_count)
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
self.pollen = false
|
self.pollen = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -104,23 +104,24 @@ function petz.lq_search_behive(self)
|
||||||
kitz.queue_low(self, func)
|
kitz.queue_low(self, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
function petz.hq_approach_behive(self, pos, prty)
|
function petz.hq_approach_beehive(self, pos, prty)
|
||||||
local func = function()
|
local func = function()
|
||||||
if math.abs(pos.x - self.behive.x) <= (self.view_range / 2) or math.abs(pos.z - self.behive.z) <= (self.view_range / 2) then
|
if math.abs(pos.x - self.beehive.x) <= (self.view_range / 2)
|
||||||
kitz.clear_queue_low(self)
|
or math.abs(pos.z - self.beehive.z) <= (self.view_range / 2) then
|
||||||
kitz.clear_queue_high(self)
|
kitz.clear_queue_low(self)
|
||||||
return true
|
kitz.clear_queue_high(self)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
petz.lq_approach_behive(self)
|
petz.lq_approach_beehive(self)
|
||||||
end
|
end
|
||||||
kitz.queue_high(self, func, prty)
|
kitz.queue_high(self, func, prty)
|
||||||
end
|
end
|
||||||
|
|
||||||
function petz.lq_approach_behive(self)
|
function petz.lq_approach_beehive(self)
|
||||||
local func = function()
|
local func = function()
|
||||||
local tpos
|
local tpos
|
||||||
if self.behive then
|
if self.beehive then
|
||||||
tpos = self.behive
|
tpos = self.beehive
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,28 +9,28 @@ function petz.bee_brain(self)
|
||||||
|
|
||||||
self.object:set_acceleration({x=0, y=0, z=0})
|
self.object:set_acceleration({x=0, y=0, z=0})
|
||||||
|
|
||||||
local behive_exists = petz.behive_exists(self)
|
local beehive_exists = petz.beehive_exists(self)
|
||||||
local meta, honey_count, bee_count
|
local meta, honey_count, bee_count
|
||||||
if behive_exists then
|
if beehive_exists then
|
||||||
meta, honey_count, bee_count = petz.get_behive_stats(self.behive)
|
meta, honey_count, bee_count, owner = petz.get_beehive_stats(self.beehive)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.hp <= 0) or (not(self.queen) and not(petz.behive_exists(self))) then
|
if (self.hp <= 0) or (not(self.queen) and not(petz.beehive_exists(self))) then
|
||||||
if behive_exists then --decrease the total bee count
|
if beehive_exists then --decrease the total bee count
|
||||||
petz.decrease_total_bee_count(self.behive)
|
petz.decrease_total_bee_count(self.beehive)
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
end
|
end
|
||||||
petz.on_die(self) -- Die Behaviour
|
petz.on_die(self) -- Die Behaviour
|
||||||
return
|
return
|
||||||
elseif (petz.is_night() and not(self.queen)) then --all the bees sleep in their beehive
|
elseif (petz.is_night() and not(self.queen)) then --all the bees sleep in their beehive
|
||||||
if behive_exists then
|
if beehive_exists then
|
||||||
bee_count = bee_count + 1
|
bee_count = bee_count + 1
|
||||||
meta:set_int("bee_count", bee_count)
|
meta:set_int("bee_count", bee_count)
|
||||||
if self.pollen and (honey_count < petz.settings.max_honey_behive) then
|
if self.pollen and (honey_count < petz.settings.max_honey_beehive) then
|
||||||
honey_count = honey_count + 1
|
honey_count = honey_count + 1
|
||||||
meta:set_int("honey_count", honey_count)
|
meta:set_int("honey_count", honey_count)
|
||||||
end
|
end
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
petz.set_infotext_beehive(meta, honey_count, bee_count)
|
||||||
kitz.remove_mob(self)
|
kitz.remove_mob(self)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -54,8 +54,8 @@ function petz.bee_brain(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
--search for flowers
|
--search for flowers
|
||||||
if prty < 20 and behive_exists then
|
if prty < 20 and beehive_exists then
|
||||||
if not(self.queen) and not(self.pollen) and (honey_count < petz.settings.max_honey_behive) then
|
if not(self.queen) and not(self.pollen) and (honey_count < petz.settings.max_honey_beehive) then
|
||||||
local view_range = self.view_range
|
local view_range = self.view_range
|
||||||
local nearby_flowers = minetest.find_nodes_in_area(
|
local nearby_flowers = minetest.find_nodes_in_area(
|
||||||
{x = pos.x - view_range, y = pos.y - view_range, z = pos.z - view_range},
|
{x = pos.x - view_range, y = pos.y - view_range, z = pos.z - view_range},
|
||||||
|
@ -69,23 +69,24 @@ function petz.bee_brain(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--search for the bee behive when pollen
|
--search for the bee beehive when pollen
|
||||||
if prty < 18 and behive_exists then
|
if prty < 18 and beehive_exists then
|
||||||
if not(self.queen) and self.pollen and (honey_count < petz.settings.max_honey_behive) then
|
if not(self.queen) and self.pollen and (honey_count < petz.settings.max_honey_beehive) then
|
||||||
if vector.distance(pos, self.behive) <= self.view_range then
|
if vector.distance(pos, self.beehive) <= self.view_range then
|
||||||
petz.hq_gotobehive(self, 18, pos)
|
petz.hq_gotobeehive(self, 18, pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--stay close behive
|
--stay close beehive
|
||||||
if prty < 15 and behive_exists then
|
if prty < 15 and beehive_exists then
|
||||||
if not(self.queen) then
|
if not(self.queen) then
|
||||||
--minetest.chat_send_player("singleplayer", "testx")
|
--minetest.chat_send_player("singleplayer", "testx")
|
||||||
if math.abs(pos.x - self.behive.x) > self.view_range and math.abs(pos.z - self.behive.z) > self.view_range then
|
if math.abs(pos.x - self.beehive.x) > self.view_range
|
||||||
petz.hq_approach_behive(self, pos, 15)
|
and math.abs(pos.z - self.beehive.z) > self.view_range then
|
||||||
return
|
petz.hq_approach_beehive(self, pos, 15)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -437,7 +437,7 @@ max_bees_behive = 3 (by default)
|
||||||
- Outing rate: A "bee_outing_ratio=1" means that a bee inmediatelly go out the behive for pollen
|
- Outing rate: A "bee_outing_ratio=1" means that a bee inmediatelly go out the behive for pollen
|
||||||
bee_outing_ratio = 20 (by default)
|
bee_outing_ratio = 20 (by default)
|
||||||
Note: Take into account that if there are flowers close the behive a bee will go to them to collect pollen and inmediatelly will return back to the behive. If you want to see bees flying surrounding the behive, the behive should be full of honey so the bees can go for a walk far away. Also bees remain inside the behive at night.
|
Note: Take into account that if there are flowers close the behive a bee will go to them to collect pollen and inmediatelly will return back to the behive. If you want to see bees flying surrounding the behive, the behive should be full of honey so the bees can go for a walk far away. Also bees remain inside the behive at night.
|
||||||
- Initial honey behive: It indicates the initial honey amount on a created behive.
|
- Initial honey beehive: It indicates the initial honey amount on a created behive.
|
||||||
initial_honey_behive = 3 (by default)
|
initial_honey_behive = 3 (by default)
|
||||||
|
|
||||||
### Bonemeal
|
### Bonemeal
|
||||||
|
|
|
@ -143,7 +143,7 @@ No room in your inventory for the egg.=Não há espaço no seu inventário para
|
||||||
No room in your inventory for the honey bottle.=Você não tem espaço no seu inventário para o pote de mel.
|
No room in your inventory for the honey bottle.=Você não tem espaço no seu inventário para o pote de mel.
|
||||||
No room in your inventory to buy it.=Você não tem espaço no seu inventário para o pote de mel.
|
No room in your inventory to buy it.=Você não tem espaço no seu inventário para o pote de mel.
|
||||||
No room in your inventory to capture it.=Não há espaço em seu inventário para capturá-lo.
|
No room in your inventory to capture it.=Não há espaço em seu inventário para capturá-lo.
|
||||||
No honey in the behive.=Não há mel na colmeia.
|
No honey in the beehive.=Não há mel na colmeia.
|
||||||
Muted=Silenciado
|
Muted=Silenciado
|
||||||
Not brushed=Não escovado
|
Not brushed=Não escovado
|
||||||
One-Pony Open Wagon=Vagão Aberto de um Pónei
|
One-Pony Open Wagon=Vagão Aberto de um Pónei
|
||||||
|
@ -223,7 +223,8 @@ The wolf turn into puppy.=O lobo virou um cachorro.
|
||||||
There are still=Ainda há
|
There are still=Ainda há
|
||||||
There's already a bird on top.=Já tem um pássaro no topo.
|
There's already a bird on top.=Já tem um pássaro no topo.
|
||||||
There's already a kitty in the basket.=Já tem um gatinho dentro.
|
There's already a kitty in the basket.=Já tem um gatinho dentro.
|
||||||
This behive already has=Esta colmeia já tem
|
This beehive already has=Esta colmeia já tem
|
||||||
|
This beehive belongs to=Esta colmeia pertence a
|
||||||
This animal is already pregnant.=Este animal já está grávido.
|
This animal is already pregnant.=Este animal já está grávido.
|
||||||
This animal is already rut.=Este animal já está em cio.
|
This animal is already rut.=Este animal já está em cio.
|
||||||
This animal has already been milked.=Este animal já foi ordenhado.
|
This animal has already been milked.=Este animal já foi ordenhado.
|
||||||
|
@ -238,6 +239,7 @@ Tropicalfish=Peixe tropical
|
||||||
turn into=tornou-se
|
turn into=tornou-se
|
||||||
Turtle=Tortuga
|
Turtle=Tortuga
|
||||||
Turtle Shell=Carapaça de tartaruga
|
Turtle Shell=Carapaça de tartaruga
|
||||||
|
Unknown=Desconhecido
|
||||||
use to throw=usar para lançar
|
use to throw=usar para lançar
|
||||||
Vanilla Wool=Lã de baunilha
|
Vanilla Wool=Lã de baunilha
|
||||||
Warrior Ant=Formiga guerreira
|
Warrior Ant=Formiga guerreira
|
||||||
|
|
|
@ -143,7 +143,7 @@ No room in your inventory for the egg.=Kein Platz im Inventar für das Ei.
|
||||||
No room in your inventory for the honey bottle.=Kein Platz im Inventar für das Honigglas.
|
No room in your inventory for the honey bottle.=Kein Platz im Inventar für das Honigglas.
|
||||||
No room in your inventory to buy it.=In Ihrem Inventar ist kein Platz, um es zu kaufen.
|
No room in your inventory to buy it.=In Ihrem Inventar ist kein Platz, um es zu kaufen.
|
||||||
No room in your inventory to capture it.=Kein Platz im Inventar, um es zu fangen.
|
No room in your inventory to capture it.=Kein Platz im Inventar, um es zu fangen.
|
||||||
No honey in the behive.=Kein Honig für den Bienenstock.
|
No honey in the beehive.=Kein Honig für den Bienenstock.
|
||||||
Muted=Stumm
|
Muted=Stumm
|
||||||
Not brushed=Nicht gebürstet
|
Not brushed=Nicht gebürstet
|
||||||
One-Pony Open Wagon=Ein-Pony-Open-Wagen
|
One-Pony Open Wagon=Ein-Pony-Open-Wagen
|
||||||
|
@ -223,7 +223,8 @@ The wolf turn into puppy.=Der Wolf wird zu einem Hündchen.
|
||||||
There are still=Es gibt immer noch
|
There are still=Es gibt immer noch
|
||||||
There's already a bird on top.=Da ist schon ein Vogel.
|
There's already a bird on top.=Da ist schon ein Vogel.
|
||||||
There's already a kitty in the basket.=Da ist schon ein Kätzchen im Korb.
|
There's already a kitty in the basket.=Da ist schon ein Kätzchen im Korb.
|
||||||
This behive already has=Dieser Bienenstock hat bereits
|
This beehive already has=Dieser Bienenstock hat bereits
|
||||||
|
This beehive belongs to=Dieser Bienenstock gehört zu
|
||||||
This animal is already pregnant.=Dieses Tier ist schon trächtig.
|
This animal is already pregnant.=Dieses Tier ist schon trächtig.
|
||||||
This animal is already rut.=Dieses Tier ist schon brünftig.
|
This animal is already rut.=Dieses Tier ist schon brünftig.
|
||||||
This animal has already been milked.=Dieses Tier wurde schon gemolken.
|
This animal has already been milked.=Dieses Tier wurde schon gemolken.
|
||||||
|
@ -238,6 +239,7 @@ Tropicalfish=Tropenfisch
|
||||||
turn into=verwandeln zu
|
turn into=verwandeln zu
|
||||||
Turtle=Schildkröte
|
Turtle=Schildkröte
|
||||||
Turtle Shell=Schildkrötenpanzer
|
Turtle Shell=Schildkrötenpanzer
|
||||||
|
Unknown=Unbekannt
|
||||||
use to throw=benutzen zum Werfen
|
use to throw=benutzen zum Werfen
|
||||||
Vanilla Wool=Vanillewolle
|
Vanilla Wool=Vanillewolle
|
||||||
Warrior Ant=Kriegerameise
|
Warrior Ant=Kriegerameise
|
||||||
|
|
|
@ -143,7 +143,7 @@ No room in your inventory for the egg.=No hay sitio en tu inventario para el hue
|
||||||
No room in your inventory for the honey bottle.=No hay sitio en tu inventario para el tarro de miel.
|
No room in your inventory for the honey bottle.=No hay sitio en tu inventario para el tarro de miel.
|
||||||
No room in your inventory to buy it.=No hay espacio en tu inventario para comprarlo.
|
No room in your inventory to buy it.=No hay espacio en tu inventario para comprarlo.
|
||||||
No room in your inventory to capture it.=No hay espacio en tu inventario para capturarlo.
|
No room in your inventory to capture it.=No hay espacio en tu inventario para capturarlo.
|
||||||
No honey in the behive.=No hay miel en la colmena.
|
No honey in the beehive.=No hay miel en la colmena.
|
||||||
Muted=Silenciado
|
Muted=Silenciado
|
||||||
Not brushed=No cepillado
|
Not brushed=No cepillado
|
||||||
One-Pony Open Wagon=Carromato abierto para poni
|
One-Pony Open Wagon=Carromato abierto para poni
|
||||||
|
@ -223,7 +223,8 @@ The wolf turn into puppy.=El lobo se ha convertido en cachorrito.
|
||||||
There are still=Todavía faltan
|
There are still=Todavía faltan
|
||||||
There's already a bird on top.=Ya hay un pájaro encima.
|
There's already a bird on top.=Ya hay un pájaro encima.
|
||||||
There's already a kitty in the basket.=Ya hay un gatito dentro.
|
There's already a kitty in the basket.=Ya hay un gatito dentro.
|
||||||
This behive already has=Esta colmena ya tiene
|
This beehive already has=Esta colmena ya tiene
|
||||||
|
This beehive belongs to=Esta colmena pertenece
|
||||||
This animal is already pregnant.=Este animal ya está preñado.
|
This animal is already pregnant.=Este animal ya está preñado.
|
||||||
This animal is already rut.=Este animal ya está en celo.
|
This animal is already rut.=Este animal ya está en celo.
|
||||||
This animal has already been milked.=Este animal ya ha sido ordeñado.
|
This animal has already been milked.=Este animal ya ha sido ordeñado.
|
||||||
|
@ -238,6 +239,7 @@ Tropicalfish=Pez tropical
|
||||||
turn into=se convirtió
|
turn into=se convirtió
|
||||||
Turtle=Tortuga
|
Turtle=Tortuga
|
||||||
Turtle Shell=Caparazón de tortuga
|
Turtle Shell=Caparazón de tortuga
|
||||||
|
Unknown=Desconocido
|
||||||
use to throw=úsala para lanzar
|
use to throw=úsala para lanzar
|
||||||
Vanilla Wool=Lana vainilla
|
Vanilla Wool=Lana vainilla
|
||||||
Warrior Ant=Hormiga guerrero
|
Warrior Ant=Hormiga guerrero
|
||||||
|
|
|
@ -143,7 +143,7 @@ No room in your inventory for the egg.=Pas de place dans l'inventaire pour l'œu
|
||||||
No room in your inventory for the honey bottle.=Pas de place dans l'inventaire pour la bouteille de miel.
|
No room in your inventory for the honey bottle.=Pas de place dans l'inventaire pour la bouteille de miel.
|
||||||
No room in your inventory to buy it.=Pas de place dans votre inventaire pour l'acheter.
|
No room in your inventory to buy it.=Pas de place dans votre inventaire pour l'acheter.
|
||||||
No room in your inventory to capture it.=Pas de place dans votre inventaire pour le saisir.
|
No room in your inventory to capture it.=Pas de place dans votre inventaire pour le saisir.
|
||||||
No honey in the behive.=Pas de miel dans la ruche.
|
No honey in the beehive.=Pas de miel dans la ruche.
|
||||||
Muted=Muet
|
Muted=Muet
|
||||||
Not brushed=Non brossé
|
Not brushed=Non brossé
|
||||||
One-Pony Open Wagon=Wagon ouvert à un seul poney
|
One-Pony Open Wagon=Wagon ouvert à un seul poney
|
||||||
|
@ -223,7 +223,8 @@ The wolf turn into puppy.=Le loup est devenu un chien.
|
||||||
There are still=Il y a encore
|
There are still=Il y a encore
|
||||||
There's already a bird on top.=Il y a déjà un oiseau dessus.
|
There's already a bird on top.=Il y a déjà un oiseau dessus.
|
||||||
There's already a kitty in the basket.=Il y a déjà un chaton dans le panier.
|
There's already a kitty in the basket.=Il y a déjà un chaton dans le panier.
|
||||||
This behive already has=Ce nid d'abeille à déjà
|
This beehive already has=Ce nid d'abeille à déjà
|
||||||
|
This beehive belongs to=Cette nid d'abeille appartient à
|
||||||
This animal is already pregnant.=Animal déjà enceinte.
|
This animal is already pregnant.=Animal déjà enceinte.
|
||||||
This animal is already rut.=Animal déjà en rut.
|
This animal is already rut.=Animal déjà en rut.
|
||||||
This animal has already been milked.=Animal déjà trait.
|
This animal has already been milked.=Animal déjà trait.
|
||||||
|
@ -238,6 +239,7 @@ Tropicalfish=Poisson tropical
|
||||||
turn into=est devenu
|
turn into=est devenu
|
||||||
Turtle=Tortue
|
Turtle=Tortue
|
||||||
Turtle Shell=Caparace de tortue
|
Turtle Shell=Caparace de tortue
|
||||||
|
Unknown=Inconnu
|
||||||
use to throw=utiliser pour lancer
|
use to throw=utiliser pour lancer
|
||||||
Vanilla Wool=Laine vanille
|
Vanilla Wool=Laine vanille
|
||||||
Warrior Ant=Fourmi guerrière
|
Warrior Ant=Fourmi guerrière
|
||||||
|
|
|
@ -143,7 +143,7 @@ No room in your inventory for the egg.=В вашем инвентаре нет
|
||||||
No room in your inventory for the honey bottle.=В вашем инвентаре нет места для баночки меда.
|
No room in your inventory for the honey bottle.=В вашем инвентаре нет места для баночки меда.
|
||||||
No room in your inventory to buy it.=No room in your inventory to buy it.
|
No room in your inventory to buy it.=No room in your inventory to buy it.
|
||||||
No room in your inventory to capture it.=No room in your inventory to capture it.
|
No room in your inventory to capture it.=No room in your inventory to capture it.
|
||||||
No honey in the behive.=Мёда больше нет в улье!
|
No honey in the beehive.=Мёда больше нет в улье!
|
||||||
Muted=Приглушённый
|
Muted=Приглушённый
|
||||||
Not brushed=Не причёсанный
|
Not brushed=Не причёсанный
|
||||||
One-Pony Open Wagon=Открытый вагон для одного пони
|
One-Pony Open Wagon=Открытый вагон для одного пони
|
||||||
|
@ -223,7 +223,8 @@ The wolf turn into puppy.=Волк превращается в щенка.
|
||||||
There are still=Они все еще пропали без вести.
|
There are still=Они все еще пропали без вести.
|
||||||
There's already a bird on top.=Там уже птица наверху.
|
There's already a bird on top.=Там уже птица наверху.
|
||||||
There's already a kitty in the basket.=There's already a kitty in the basket.
|
There's already a kitty in the basket.=There's already a kitty in the basket.
|
||||||
This behive already has=Улей уже есть.
|
This beehive already has=Улей уже есть.
|
||||||
|
This beehive belongs to=Этот улей принадлежит
|
||||||
This animal is already pregnant.=Это животное уже беременно.
|
This animal is already pregnant.=Это животное уже беременно.
|
||||||
This animal is already rut.=Это животное и так уже не в себе.
|
This animal is already rut.=Это животное и так уже не в себе.
|
||||||
This animal has already been milked.=Это животное уже доилось.
|
This animal has already been milked.=Это животное уже доилось.
|
||||||
|
@ -238,6 +239,7 @@ Tropicalfish=Тропические рыбы
|
||||||
turn into=превращаться в
|
turn into=превращаться в
|
||||||
Turtle=Черепаха
|
Turtle=Черепаха
|
||||||
Turtle Shell=Панцирь черепахи
|
Turtle Shell=Панцирь черепахи
|
||||||
|
Unknown=Неизвестно
|
||||||
Vanilla Wool=Ванильная шерсть
|
Vanilla Wool=Ванильная шерсть
|
||||||
use to throw=для того чтобы бросить
|
use to throw=для того чтобы бросить
|
||||||
Warrior Ant=Муравей Воитель
|
Warrior Ant=Муравей Воитель
|
||||||
|
|
|
@ -348,162 +348,6 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--Beehive
|
|
||||||
minetest.register_node("petz:beehive", {
|
|
||||||
description = S("Beehive"),
|
|
||||||
tiles = {"petz_beehive.png"},
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3,
|
|
||||||
flammable = 3, wool = 1},
|
|
||||||
sounds = default.node_sound_defaults(),
|
|
||||||
drop = {},
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local drops = {
|
|
||||||
{name = "petz:honeycomb", chance = 1, min = 1, max= 6},
|
|
||||||
}
|
|
||||||
meta:set_string("drops", minetest.serialize(drops))
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
timer:start(2.0) -- in seconds
|
|
||||||
local honey_count = petz.settings.initial_honey_behive
|
|
||||||
meta:set_int("honey_count", honey_count)
|
|
||||||
local bee_count = petz.settings.max_bees_behive
|
|
||||||
meta:set_int("total_bees", bee_count)
|
|
||||||
meta:set_int("bee_count", bee_count)
|
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
|
||||||
end,
|
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local honey_count
|
|
||||||
local bee_count
|
|
||||||
if placer:is_player() then
|
|
||||||
honey_count = 0
|
|
||||||
bee_count = 0
|
|
||||||
minetest.after(petz.settings.worker_bee_delay, function()
|
|
||||||
local node =minetest.get_node_or_nil(pos)
|
|
||||||
if not(node and node.name == "petz:beehive") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
meta = minetest.get_meta(pos)
|
|
||||||
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_behive
|
|
||||||
if total_bees < petz.settings.max_bees_behive then
|
|
||||||
bee_count = meta:get_int("bee_count")
|
|
||||||
bee_count = bee_count + 1
|
|
||||||
total_bees = total_bees + 1
|
|
||||||
meta:set_int('bee_count', bee_count)
|
|
||||||
meta:set_int('total_bees', total_bees)
|
|
||||||
honey_count = meta:get_int('honey_count')
|
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
|
||||||
end
|
|
||||||
end, pos)
|
|
||||||
else
|
|
||||||
honey_count = petz.settings.initial_honey_behive
|
|
||||||
bee_count = petz.settings.max_bees_behive
|
|
||||||
end
|
|
||||||
meta:set_int("honey_count", honey_count)
|
|
||||||
meta:set_int("bee_count", bee_count)
|
|
||||||
meta:set_int("total_bees", bee_count)
|
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
|
||||||
end,
|
|
||||||
on_destruct = function(pos)
|
|
||||||
minetest.add_entity(pos, "petz:queen_bee")
|
|
||||||
kitz.node_drop_items(pos)
|
|
||||||
end,
|
|
||||||
on_timer = function(pos)
|
|
||||||
local meta, honey_count, bee_count = petz.get_behive_stats(pos)
|
|
||||||
if bee_count > 0 then --if bee inside
|
|
||||||
local tpos = {
|
|
||||||
x = pos. x,
|
|
||||||
y = pos.y - 4,
|
|
||||||
z = pos.z,
|
|
||||||
}
|
|
||||||
local ray = minetest.raycast(pos, tpos, false, false) --check if fire/torch (igniter) below
|
|
||||||
local igniter_below = false
|
|
||||||
for thing in ray do
|
|
||||||
if thing.type == "node" then
|
|
||||||
local node_name = minetest.get_node(thing.under).name
|
|
||||||
--minetest.chat_send_player("singleplayer", node_name)
|
|
||||||
if minetest.get_item_group(node_name, "igniter") >0 or minetest.get_item_group(node_name, "torch") > 0 then
|
|
||||||
igniter_below = true
|
|
||||||
--minetest.chat_send_player("singleplayer", S("igniter"))
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local bee_outing_ratio
|
|
||||||
if igniter_below == false then
|
|
||||||
bee_outing_ratio = petz.settings.bee_outing_ratio
|
|
||||||
else
|
|
||||||
bee_outing_ratio = 1
|
|
||||||
end
|
|
||||||
if math.random(1, bee_outing_ratio) == 1 then --opportunitty to go out
|
|
||||||
local spawn_bee_pos = petz.spawn_bee_pos(pos)
|
|
||||||
if spawn_bee_pos then
|
|
||||||
local bee = minetest.add_entity(spawn_bee_pos, "petz:bee")
|
|
||||||
local bee_entity = bee:get_luaentity()
|
|
||||||
bee_entity.behive = kitz.remember(bee_entity, "behive", pos)
|
|
||||||
bee_count = bee_count - 1
|
|
||||||
meta:set_int("bee_count", bee_count)
|
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
||||||
local wielded_item = player:get_wielded_item()
|
|
||||||
local wielded_item_name = wielded_item:get_name()
|
|
||||||
local meta, honey_count, bee_count = petz.get_behive_stats(pos)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if wielded_item_name == "vessels:glass_bottle" then
|
|
||||||
if honey_count > 0 then
|
|
||||||
local inv = player:get_inventory()
|
|
||||||
if inv:room_for_item("main", "petz:honey_bottle") then
|
|
||||||
local itemstack_name = itemstack:get_name()
|
|
||||||
local stack = ItemStack("petz:honey_bottle 1")
|
|
||||||
if (itemstack_name == "petz:honey_bottle" or itemstack_name == "") and (itemstack:get_count() < itemstack:get_stack_max()) then
|
|
||||||
itemstack:add_item(stack)
|
|
||||||
else
|
|
||||||
inv:add_item("main", stack)
|
|
||||||
end
|
|
||||||
itemstack:take_item()
|
|
||||||
honey_count = honey_count - 1
|
|
||||||
meta:set_int("honey_count", honey_count)
|
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
|
||||||
return itemstack
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player_name, S("No room in your inventory for the honey bottle."))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player_name, S("No honey in the behive."))
|
|
||||||
end
|
|
||||||
elseif wielded_item_name == "petz:bee_set" then
|
|
||||||
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_behive
|
|
||||||
if total_bees < petz.settings.max_bees_behive then
|
|
||||||
bee_count = bee_count + 1
|
|
||||||
total_bees = total_bees + 1
|
|
||||||
meta:set_int("bee_count", bee_count)
|
|
||||||
meta:set_int("total_bees", total_bees)
|
|
||||||
petz.set_infotext_behive(meta, honey_count, bee_count)
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player_name, S("This behive already has").." "..tostring(petz.settings.max_bees_behive).." "..S("bees inside."))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shaped",
|
|
||||||
output = "petz:beehive",
|
|
||||||
recipe = {
|
|
||||||
{"petz:honeycomb", "petz:honeycomb", "petz:honeycomb"},
|
|
||||||
{"petz:honeycomb", "petz:queen_bee_set", "petz:honeycomb"},
|
|
||||||
{"petz:honeycomb", "petz:honeycomb", "petz:honeycomb"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
--Halloween Update
|
--Halloween Update
|
||||||
|
|
||||||
if minetest.get_modpath("farming") ~= nil and farming.mod == "redo" then
|
if minetest.get_modpath("farming") ~= nil and farming.mod == "redo" then
|
||||||
|
|
|
@ -166,15 +166,16 @@ herding_members_distance = 5
|
||||||
herding_shepherd_distance = 5
|
herding_shepherd_distance = 5
|
||||||
|
|
||||||
#Bee stuff
|
#Bee stuff
|
||||||
initial_honey_behive = 3
|
initial_honey_beehive = 3
|
||||||
max_honey_behive = 10
|
max_honey_beehive = 10
|
||||||
max_bees_behive = 3
|
max_bees_beehive = 3
|
||||||
#bees_outing_rate=1 means that a bee inmediatelly go out the behive for pollen
|
protect_beehive = false
|
||||||
|
#bees_outing_rate=1 means that a bee inmediatelly go out the beehive for pollen
|
||||||
bee_outing_ratio = 20
|
bee_outing_ratio = 20
|
||||||
#The time between a Beehive is created by a pger and a worker bee is automatically created
|
#The time between a Beehive is created by a pger and a worker bee is automatically created
|
||||||
worker_bee_delay = 300
|
worker_bee_delay = 300
|
||||||
#behive_spawn_chance = 0.6
|
#beehive_spawn_chance = 0.6
|
||||||
#max_behives_in_area = 3
|
#max_beehives_in_area = 3
|
||||||
|
|
||||||
#Lycanthropy stuff
|
#Lycanthropy stuff
|
||||||
lycanthropy = true
|
lycanthropy = true
|
||||||
|
|
|
@ -390,17 +390,17 @@ local settings_def = {
|
||||||
},
|
},
|
||||||
--Bee Stuff
|
--Bee Stuff
|
||||||
{
|
{
|
||||||
name = "initial_honey_behive",
|
name = "initial_honey_beehive",
|
||||||
type = "number",
|
type = "number",
|
||||||
default = 3,
|
default = 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "max_honey_behive",
|
name = "max_honey_beehive",
|
||||||
type = "number",
|
type = "number",
|
||||||
default = 10,
|
default = 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "max_bees_behive",
|
name = "max_bees_beehive",
|
||||||
type = "number",
|
type = "number",
|
||||||
default = 3,
|
default = 3,
|
||||||
},
|
},
|
||||||
|
@ -414,6 +414,11 @@ local settings_def = {
|
||||||
type = "number",
|
type = "number",
|
||||||
default = 300,
|
default = 300,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "protect_beehive",
|
||||||
|
type = "boolean",
|
||||||
|
default = false,
|
||||||
|
},
|
||||||
--Weapons
|
--Weapons
|
||||||
{
|
{
|
||||||
name = "pumpkin_grenade_damage",
|
name = "pumpkin_grenade_damage",
|
||||||
|
|
Loading…
Reference in New Issue