From 69ae9cccb6e4dac0a50b3287a2c12b9daa3292b2 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Thu, 4 Oct 2018 00:27:08 -0400 Subject: update bees and street signs --- bees/init.lua | 64 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 27 deletions(-) (limited to 'bees/init.lua') diff --git a/bees/init.lua b/bees/init.lua index 02cf7ca..95ff21e 100644 --- a/bees/init.lua +++ b/bees/init.lua @@ -1,6 +1,6 @@ -- Mod: BEES -- Author: Bas080 (Tweaked by TenPlus1) --- License: WTFPL +-- License: MIT -- Intllib support @@ -12,7 +12,7 @@ else end ---FUNCTIONS +-- FUNCTIONS local hive_wild = function(pos, grafting) @@ -58,7 +58,7 @@ local polinate_flower = function(pos, flower) end ---NODES +-- NODES minetest.register_node('bees:extractor', { description = S('Honey Extractor'), @@ -206,8 +206,9 @@ minetest.register_node('bees:extractor', { local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - if inv:get_stack(listname, 1):get_count() == stack:get_count() then -- inv was empty -> start the timer - timer:start(5) --create a honey bottle and empty frame and wax every 5 seconds + -- if inventory empty start timer for honey bottle, empty frame and wax + if inv:get_stack(listname, 1):get_count() == stack:get_count() then + timer:start(5) end end, @@ -637,7 +638,7 @@ minetest.register_node('bees:hive_artificial', { end, }) ---ABMS +-- ABMS minetest.register_abm({ nodenames = {'bees:hive_artificial', 'bees:hive_wild', 'bees:hive_industrial'}, @@ -681,28 +682,35 @@ minetest.register_abm({ }) ---spawn abm. This should be changed to a more realistic type of spawning +local floor = math.floor + +-- spawn abm. This should be changed to a more realistic type of spawning minetest.register_abm({ nodenames = {'group:leaves'}, - neighbors = {''}, - interval = 1600, - chance = 20, + neighbors = {'air'}, + interval = 800,--1600, + chance = 10,--20, - action = function(pos, node, _, _) + action = function(pos, node) + + if floor(pos.x / 40) ~= pos.x / 40 + or floor(pos.z / 40) ~= pos.z / 40 + or floor(pos.y / 5) ~= pos.y / 5 then return end local p = {x = pos.x, y = pos.y - 1, z = pos.z} + local nod = minetest.get_node_or_nil(p) + local def = minetest.registered_nodes[nod.name] - if minetest.get_node(p).walkable == false then return end + if not def or def.walkable then return end - if (minetest.find_node_near(p, 5, 'group:flora') ~= nil - and minetest.find_node_near(p, 40, 'bees:hive_wild') == nil) then + if minetest.find_node_near(p, 5, 'group:flora') then minetest.add_node(p, {name = 'bees:hive_wild'}) end end, }) ---spawning bees around bee hive +-- spawning bees around bee hive minetest.register_abm({ nodenames = {'bees:hive_wild', 'bees:hive_artificial', 'bees:hive_industrial'}, neighbors = {'group:flowers', 'group:leaves'}, @@ -724,7 +732,7 @@ minetest.register_abm({ }) ---remove bees +-- remove bees minetest.register_abm({ nodenames = {'bees:bees'}, interval = 30, @@ -736,7 +744,7 @@ minetest.register_abm({ }) ---ITEMS +-- ITEMS minetest.register_craftitem('bees:frame_empty', { description = S('Empty hive frame'), @@ -777,7 +785,7 @@ minetest.register_craftitem('bees:queen', { }) ---CRAFTS +-- CRAFTS minetest.register_craft({ output = 'bees:extractor', @@ -835,7 +843,7 @@ if minetest.get_modpath('bushes_classic') then end ---TOOLS +-- TOOLS minetest.register_tool('bees:smoker', { description = S('smoker'), @@ -893,18 +901,19 @@ 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') ---BACKWARDS COMPATIBILITY WITH OLDER VERSION +-- BACKWARDS COMPATIBILITY WITH OLDER VERSION minetest.register_alias('bees:honey_bottle', 'bees:bottle_honey') -minetest.register_abm({ +minetest.register_lbm({ nodenames = {'bees:hive', 'bees:hive_artificial_inhabited'}, - interval = 0, - chance = 1, + name = 'bees:replace_old_hives', + label = 'Replace old hives', + run_at_every_load = true, action = function(pos, node) @@ -931,11 +940,11 @@ minetest.register_abm({ timer:start(60) end - end, + end }) ---PIPEWORKS +-- PIPEWORKS if minetest.get_modpath("pipeworks") then @@ -1185,4 +1194,5 @@ if minetest.get_modpath("pipeworks") then }) end + print(S('[MOD] Bees Loaded!')) -- cgit v1.2.3