diff options
Diffstat (limited to 'bees')
-rw-r--r-- | bees/init.lua | 64 | ||||
-rw-r--r-- | bees/license.txt | 21 | ||||
-rw-r--r-- | bees/readme.txt | 3 |
3 files changed, 61 insertions, 27 deletions
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!')) diff --git a/bees/license.txt b/bees/license.txt new file mode 100644 index 0000000..ab1c816 --- /dev/null +++ b/bees/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 TenPlus1 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/bees/readme.txt b/bees/readme.txt index 45e0bad..0920e0f 100644 --- a/bees/readme.txt +++ b/bees/readme.txt @@ -9,6 +9,9 @@ FEATURES - protection check when removing items from extractor - Intllib support (template added) - Wild hives are removed if found floating in mid air +- Change compatibility abm to lbm +- Change from WTFPL to MIT license +- Make wild hive abm less intensive (thanks VanessaE) 2.2.2 - Pipeworks compatibility (Industrial beehive) |