diff --git a/init.lua b/init.lua index d85e6fe..2f30fff 100644 --- a/init.lua +++ b/init.lua @@ -1,12 +1,23 @@ --Bees mod by bas080 +--[[TODO +Smoker +Grafting Tool + +]] local sound = {} local particles = {} --nodes minetest.register_node("bees:bees", { description = "Wild Bees", - drawtype = "airlike", + drawtype = "plantlike", paramtype = "light", + tiles = { + { + name="bees_strip.png", + animation={type="vertical_frames", aspect_w=16,aspect_h=16, length=2.0} + } + }, damage_per_second = 1, walkable = false, buildable_to = true, @@ -25,7 +36,7 @@ minetest.register_node("bees:bees", { minetest.register_node("bees:hive", { description = "Wild Bee Hive", - tile_images = {"bees_hive_wild_bottom.png","bees_hive_wild_bottom.png", "bees_hive_wild.png","bees_hive_wild_s.png", "bees_hive_wild_s.png", "bees_hive_wild_s.png"}, + tile_images = {"bees_hive_wild.png","bees_hive_wild.png","bees_hive_wild.png", "bees_hive_wild.png", "bees_hive_wild_bottom.png"}, --Neuromancer's base texture drawtype = "nodebox", paramtype = "light", paramtype2 = 'wallmounted', @@ -48,13 +59,6 @@ minetest.register_node("bees:hive", { {-0.062500,-0.500000,-0.062500,0.062500,0.500000,0.062500}, --NodeBox 6 } }, - on_destruct = function(pos) - if sound["x"..pos.x.."y"..pos.y.."z"..pos.z] ~= nil then - minetest.sound_stop(sound["x"..pos.x.."y"..pos.y.."z"..pos.z]) - sound["x"..pos.x.."y"..pos.y.."z"..pos.z] = nil - end - remove_bees(pos) - end, on_construct = function(pos) spawn_bees(pos) minetest.get_node(pos).param2 = 0 @@ -62,8 +66,16 @@ minetest.register_node("bees:hive", { on_punch = function(pos, node, puncher) local health = puncher:get_hp() puncher:set_hp(health-2) - spawn_bees(pos) end, + after_dig_node = function(pos, oldnode, oldmetadata, user) + local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end + if 'bees:grafting_tool' == wielded:get_name() then + local inv = user:get_inventory() + if inv then + inv:add_item("main", ItemStack("bees:queen")) + end + end + end }) minetest.register_node("bees:hive_artificial", { @@ -147,9 +159,6 @@ minetest.register_node("bees:hive_artificial_inhabited", { meta:set_int("honey", 0) meta:set_string('infotext','0%'); end, - on_destruct = function(pos) - remove_bees(pos) - end, on_punch = function(pos, node, puncher) local health = puncher:get_hp() puncher:set_hp(health-2) @@ -169,6 +178,15 @@ minetest.register_node("bees:hive_artificial_inhabited", { tmr:start(60) end end, + after_dig_node = function(pos, oldnode, oldmetadata, user) + local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end + if 'bees:grafting_tool' == wielded:get_name() then + local inv = user:get_inventory() + if inv then + inv:add_item("main", ItemStack("bees:queen")) + end + end + end }) --abms @@ -211,7 +229,7 @@ playername ) ]] function spawn_bees(pos) - local id = minetest.pos_to_string(pos) + --[[local id = minetest.pos_to_string(pos) if particles[id] ~= nil then return end particles[id] = minetest.add_particlespawner( 2, @@ -224,12 +242,14 @@ function spawn_bees(pos) true, "bees_particle_bee.png" ) + ]] end function remove_bees(pos) - local id = particles[minetest.pos_to_string(pos)] + --[[local id = particles[minetest.pos_to_string(pos)] if id == nil then return end minetest.delete_particlespawner(id) + ]] end minetest.register_abm({ --spawn abm @@ -314,3 +334,25 @@ minetest.register_craft({ {'group:wood','default:stick','group:wood'}, } }) + +minetest.register_tool("bees:grafting_tool", { + description = "Grafting Tool", + inventory_image = "bees_grafting_tool.png", + tool_capabilities = { + full_punch_interval = 3.0, + max_drop_level=0, + groupcaps={ + choppy = {times={[2]=3.00, [3]=2.00}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, +}) + +minetest.register_craft({ + output = 'bees:grafting_tool', + recipe = { + {'', '', 'default:steel_ingot'}, + {'', 'default:stick', ''}, + {'', '', ''}, + } +}) diff --git a/readme.txt b/readme.txt index ae06e64..4d6c4a5 100644 --- a/readme.txt +++ b/readme.txt @@ -2,20 +2,21 @@ Bees ---- Wild bees that spawn near flowers and in trees that can be harvested and domesticated -Version +version ------- -0.6 +0.5 -Contributors +contributors ------------ bas080 VanessaE +Neuromancer Minetest community -Forum +forum ----- https://forum.minetest.net/viewtopic.php?pid=102905 -License +license ------- WTFPL diff --git a/textures/bees_comb.png b/textures/bees_comb.png index 386c97a..7f1fda2 100644 Binary files a/textures/bees_comb.png and b/textures/bees_comb.png differ diff --git a/textures/bees_grafting_tool.png b/textures/bees_grafting_tool.png new file mode 100644 index 0000000..c0da709 Binary files /dev/null and b/textures/bees_grafting_tool.png differ diff --git a/textures/bees_hive_artificial.png b/textures/bees_hive_artificial.png index f216f0c..12a15e0 100644 Binary files a/textures/bees_hive_artificial.png and b/textures/bees_hive_artificial.png differ diff --git a/textures/bees_hive_wild.png b/textures/bees_hive_wild.png index 5f413ff..961a416 100644 Binary files a/textures/bees_hive_wild.png and b/textures/bees_hive_wild.png differ diff --git a/textures/bees_hive_wild_bottom.png b/textures/bees_hive_wild_bottom.png index 865b663..08efeaa 100644 Binary files a/textures/bees_hive_wild_bottom.png and b/textures/bees_hive_wild_bottom.png differ diff --git a/textures/bees_strip.png b/textures/bees_strip.png new file mode 100644 index 0000000..1afe28e Binary files /dev/null and b/textures/bees_strip.png differ