From fa4c551dcf169ecbd1c0fb934e936a96f5d51811 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Thu, 16 Mar 2017 12:40:49 -0600 Subject: [PATCH] split up plants.lua, add some drops --- init.lua | 10 +- plants.lua | 391 +--------------------------------------- plants/cave_wheat.lua | 60 ++++++ plants/dimple_cup.lua | 43 +++++ plants/pig_tail.lua | 62 +++++++ plants/plump_helmet.lua | 208 +++++++++++++++++++++ plants/quarry_bush.lua | 61 +++++++ plants/sweet_pod.lua | 30 +++ 8 files changed, 475 insertions(+), 390 deletions(-) create mode 100644 plants/cave_wheat.lua create mode 100644 plants/dimple_cup.lua create mode 100644 plants/pig_tail.lua create mode 100644 plants/plump_helmet.lua create mode 100644 plants/quarry_bush.lua create mode 100644 plants/sweet_pod.lua diff --git a/init.lua b/init.lua index 8c2fe9c..8365e78 100644 --- a/init.lua +++ b/init.lua @@ -11,7 +11,15 @@ local modpath = minetest.get_modpath(minetest.get_current_modname()) dofile(modpath.."/config.lua") dofile(modpath.."/ground_cover.lua") -dofile(modpath.."/plants.lua") + +-- Plants +dofile(modpath.."/plants.lua") -- general functions +dofile(modpath.."/plants/cave_wheat.lua") +dofile(modpath.."/plants/dimple_cup.lua") +dofile(modpath.."/plants/pig_tail.lua") +dofile(modpath.."/plants/plump_helmet.lua") +dofile(modpath.."/plants/quarry_bush.lua") +dofile(modpath.."/plants/sweet_pod.lua") -- Trees dofile(modpath.."/trees/blood_thorn.lua") diff --git a/plants.lua b/plants.lua index b7ef5b2..53f8c96 100644 --- a/plants.lua +++ b/plants.lua @@ -28,7 +28,7 @@ minetest.register_craft({ burntime = 2 }) -local register_seed = function(name, description, image, stage_one) +dfcaverns.register_seed = function(name, description, image, stage_one) local def = { description = description, tiles = {image}, @@ -54,7 +54,7 @@ local register_seed = function(name, description, image, stage_one) }) end -local register_grow_abm = function(names, interval, chance) +dfcaverns.register_grow_abm = function(names, interval, chance) minetest.register_abm({ nodenames = names, interval = interval, @@ -74,390 +74,3 @@ local register_grow_abm = function(names, interval, chance) end }) end --------------------------------------------------- --- Cave wheat - --- stalks. White - -local wheat_names = {} - -local register_cave_wheat = function(number) - local def = { - description = S("Cave Wheat"), - drawtype = "plantlike", - paramtype2 = "meshoptions", - place_param2 = 3, - tiles = {"dfcaverns_cave_wheat_"..tostring(number)..".png"}, - inventory_image = "dfcaverns_cave_wheat_"..tostring(number)..".png", - paramtype = "light", - walkable = false, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, - sounds = default.node_sound_leaves_defaults(), - drop = { - max_items = 1, - items = { - { - items = {'dfcaverns:cave_wheat_seed 2', 'dfcaverns:cave_wheat'}, - rarity = 9-number, - }, - { - items = {'dfcaverns:cave_wheat_seed 1', 'dfcaverns:cave_wheat'}, - rarity = 9-number, - }, - { - items = {'dfcaverns:cave_wheat_seed'}, - rarity = 9-number, - }, - }, - }, - } - - if number < 8 then - def._dfcaverns_next_stage = "dfcaverns:cave_wheat_"..tostring(number+1) - table.insert(wheat_names, "dfcaverns:cave_wheat_"..tostring(number)) - end - - minetest.register_node("dfcaverns:cave_wheat_"..tostring(number), def) -end - -for i = 1,8 do - register_cave_wheat(i) -end - -register_seed("cave_wheat_seed", S("Cave Wheat Seed"), "dfcaverns_cave_wheat_seed.png", "dfcaverns:cave_wheat_1") -table.insert(wheat_names, "dfcaverns:cave_wheat_seed") - -register_grow_abm(wheat_names, 10, 1) - -minetest.register_craftitem("dfcaverns:cave_wheat", { - description = S("Cave Wheat"), - inventory_image = "dfcaverns_cave_wheat.png", - stack_max = 99, -}) -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:cave_wheat", - burntime = 2 -}) - --------------------------------------------------- --- Dimple cup - --- royal blue - -local dimple_names = {} - -local register_dimple_cup = function(number) - local def = { - description = S("Dimple Cup"), - drawtype = "plantlike", - tiles = {"dfcaverns_dimple_cup_"..tostring(number)..".png"}, - inventory_image = "dfcaverns_dimple_cup_"..tostring(number)..".png", - paramtype = "light", - walkable = false, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, - sounds = default.node_sound_leaves_defaults(), - } - - if number < 4 then - def._dfcaverns_next_stage = "dfcaverns:dimple_cup_"..tostring(number+1) - table.insert(dimple_names, "dfcaverns:dimple_cup_"..tostring(number)) - end - - minetest.register_node("dfcaverns:dimple_cup_"..tostring(number), def) -end - -for i = 1,4 do - register_dimple_cup(i) -end - -register_seed("dimple_cup_seed", S("Dimple Cup Spores"), "dfcaverns_dimple_cup_seed.png", "dfcaverns:dimple_cup_1") -table.insert(dimple_names, "dfcaverns:dimple_cup_seed") - -register_grow_abm(dimple_names, 10, 1) - --------------------------------------------------- --- Pig tail - --- Twisting stalks. Gray - -local pig_tail_names = {} - -local register_pig_tail = function(number) - local def = { - description = S("Pig Tail"), - drawtype = "plantlike", - paramtype2 = "meshoptions", - place_param2 = 3, - tiles = {"dfcaverns_pig_tail_"..tostring(number)..".png"}, - inventory_image = "dfcaverns_pig_tail_"..tostring(number)..".png", - paramtype = "light", - walkable = false, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, - sounds = default.node_sound_leaves_defaults(), - } - - if number < 8 then - def._dfcaverns_next_stage = "dfcaverns:pig_tail_"..tostring(number+1) - table.insert(pig_tail_names, "dfcaverns:pig_tail_"..tostring(number)) - end - - minetest.register_node("dfcaverns:pig_tail_"..tostring(number), def) -end - -for i = 1,8 do - register_pig_tail(i) -end - -register_seed("pig_tail_seed", S("Pig Tail Spore"), "dfcaverns_pig_tail_seed.png", "dfcaverns:pig_tail_1") -table.insert(pig_tail_names, "dfcaverns:pig_tail_seed") - -register_grow_abm(pig_tail_names, 10, 1) - --------------------------------------------------- --- Plump helmet - --- Purple, rounded tops - - -local displace_x = 0.125 -local displace_z = 0.125 - -minetest.register_node("dfcaverns:plump_helmet_spawn", { - description = S("Plump Helmet Spawn"), - tiles = { - "dfcaverns_plump_helmet_cap.png", - }, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, - _dfcaverns_next_stage = "dfcaverns:plump_helmet_1", - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - node_box = { - type = "fixed", - fixed = { - {-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.375, 0.0625 + displace_z}, - } - }, - on_construct = function(pos) - minetest.swap_node(pos, {name="dfcaverns:plump_helmet_spawn", param2 = math.random(0,3)}) - end, -}) - -minetest.register_node("dfcaverns:plump_helmet_1", { - description = S("Plump Helmet"), - tiles = { - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png^[lowpart:5:dfcaverns_plump_helmet_stem.png", - }, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, - _dfcaverns_next_stage = "dfcaverns:plump_helmet_2", - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - node_box = { - type = "fixed", - fixed = { - {-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.25, 0.0625 + displace_z}, -- stalk - {-0.125 + displace_x, -0.4375, -0.1875 + displace_z, 0.1875 + displace_x, -0.3125, 0.125 + displace_z}, -- cap - } - }, - on_construct = function(pos) - minetest.swap_node(pos, {name="dfcaverns:plump_helmet_1", param2 = math.random(0,3)}) - end, -}) - - -minetest.register_node("dfcaverns:plump_helmet_2", { - description = S("Plump Helmet"), - tiles = { - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png^[lowpart:15:dfcaverns_plump_helmet_stem.png", - }, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, - _dfcaverns_next_stage = "dfcaverns:plump_helmet_3", - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - node_box = { - type = "fixed", - fixed = { - {-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, 0, 0.0625 + displace_z}, -- stalk - {-0.125 + displace_x, -0.3125, -0.1875 + displace_z, 0.1875 + displace_x, -0.0625, 0.125 + displace_z}, -- cap - } - }, - on_construct = function(pos) - minetest.swap_node(pos, {name="dfcaverns:plump_helmet_2", param2 = math.random(0,3)}) - end, -}) - -minetest.register_node("dfcaverns:plump_helmet_3", { - description = S("Plump Helmet"), - tiles = { - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png^[lowpart:35:dfcaverns_plump_helmet_stem.png", - }, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, - _dfcaverns_next_stage = "dfcaverns:plump_helmet_4", - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - node_box = { - type = "fixed", - fixed = { - {-0.125 + displace_x, -0.5, -0.1875 + displace_z, 0.1875 + displace_x, 0.25, 0.125 + displace_z}, -- stalk - {-0.1875 + displace_x, -0.125, -0.25 + displace_z, 0.25 + displace_x, 0.1875, 0.1875 + displace_z}, -- cap - } - }, - on_construct = function(pos) - minetest.swap_node(pos, {name="dfcaverns:plump_helmet_3", param2 = math.random(0,3)}) - end, -}) - -minetest.register_node("dfcaverns:plump_helmet_4", { - description = S("Plump Helmet"), - tiles = { - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png", - "dfcaverns_plump_helmet_cap.png^[lowpart:40:dfcaverns_plump_helmet_stem.png", - }, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - node_box = { - type = "fixed", - fixed = { - {-0.125 + displace_x, -0.5, -0.1875 + displace_z, 0.1875 + displace_x, 0.375, 0.125 + displace_z}, -- stalk - {-0.25 + displace_x, -0.0625, -0.3125 + displace_z, 0.3125 + displace_x, 0.25, 0.25 + displace_z}, -- cap - {-0.1875 + displace_x, 0.25, -0.25 + displace_z, 0.25 + displace_x, 0.3125, 0.1875 + displace_z}, -- cap rounding - } - }, - on_construct = function(pos) - minetest.swap_node(pos, {name="dfcaverns:plump_helmet_4", param2 = math.random(0,3)}) - end, -}) - -local plump_names = {"dfcaverns:plump_helmet_spawn", "dfcaverns:plump_helmet_1", "dfcaverns:plump_helmet_2", "dfcaverns:plump_helmet_3"} -register_grow_abm(plump_names, 10, 1) - -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:plump_helmet_spawn", - burntime = 1 -}) -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:plump_helmet_1", - burntime = 2 -}) -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:plump_helmet_2", - burntime = 3 -}) -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:plump_helmet_3", - burntime = 4 -}) -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:plump_helmet_4", - burntime = 5 -}) - --------------------------------------------------- --- Quarry Bush - --- Gray leaves --- Produces rock nuts - -local quarry_names = {} - -local register_quarry_bush = function(number) - local def = { - description = S("Quarry Bush"), - drawtype = "plantlike", - paramtype2 = "meshoptions", - place_param2 = 4, - tiles = {"dfcaverns_quarry_bush_"..tostring(number)..".png"}, - inventory_image = "dfcaverns_quarry_bush_"..tostring(number)..".png", - paramtype = "light", - walkable = false, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, - sounds = default.node_sound_leaves_defaults(), - } - - if number < 5 then - def._dfcaverns_next_stage = "dfcaverns:quarry_bush_"..tostring(number+1) - table.insert(quarry_names, "dfcaverns:quarry_bush_"..tostring(number)) - end - - minetest.register_node("dfcaverns:quarry_bush_"..tostring(number), def) -end - -for i = 1,5 do - register_quarry_bush(i) -end - -register_seed("quarry_bush_seed", S("Rock Nuts"), "dfcaverns_rock_nuts.png", "dfcaverns:quarry_bush_1") -table.insert(quarry_names, "dfcaverns:quarry_bush_seed") - -register_grow_abm(quarry_names, 10, 1) - -minetest.register_craftitem("dfcaverns:quarry_bush_leaves", { - description = S("Quarry Bush Leaves"), - inventory_image = "dfcaverns_quarry_bush_leaves.png", - stack_max = 99, -}) -minetest.register_craft({ - type = "fuel", - recipe = "dfcaverns:quarry_bush_leaves", - burntime = 4 -}) - - --------------------------------------------------- --- Sweet Pod - --- Round shape, red - -local sweet_names = {} - -local register_sweet_pod = function(number) - local def = { - description = S("Sweet Pod"), - drawtype = "plantlike", - tiles = {"dfcaverns_sweet_pod_"..tostring(number)..".png"}, - inventory_image = "dfcaverns_sweet_pod_"..tostring(number)..".png", - paramtype = "light", - walkable = false, - groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, - sounds = default.node_sound_leaves_defaults(), - } - - if number < 6 then - def._dfcaverns_next_stage = "dfcaverns:sweet_pod_"..tostring(number+1) - table.insert(sweet_names, "dfcaverns:sweet_pod_"..tostring(number)) - end - - minetest.register_node("dfcaverns:sweet_pod_"..tostring(number), def) -end - -for i = 1,6 do - register_sweet_pod(i) -end - -register_seed("sweet_pod_seed", S("Sweet Pod Spores"), "dfcaverns_sweet_pod_seed.png", "dfcaverns:sweet_pod_1") -table.insert(sweet_names, "dfcaverns:sweet_pod_seed") - -register_grow_abm(sweet_names, 10, 1) diff --git a/plants/cave_wheat.lua b/plants/cave_wheat.lua new file mode 100644 index 0000000..a509b8f --- /dev/null +++ b/plants/cave_wheat.lua @@ -0,0 +1,60 @@ +local wheat_names = {} + +local register_cave_wheat = function(number) + local def = { + description = S("Cave Wheat"), + drawtype = "plantlike", + paramtype2 = "meshoptions", + place_param2 = 3, + tiles = {"dfcaverns_cave_wheat_"..tostring(number)..".png"}, + inventory_image = "dfcaverns_cave_wheat_"..tostring(number)..".png", + paramtype = "light", + walkable = false, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, + sounds = default.node_sound_leaves_defaults(), + drop = { + max_items = 1, + items = { + { + items = {'dfcaverns:cave_wheat_seed 2', 'dfcaverns:cave_wheat'}, + rarity = 9-number, + }, + { + items = {'dfcaverns:cave_wheat_seed 1', 'dfcaverns:cave_wheat'}, + rarity = 9-number, + }, + { + items = {'dfcaverns:cave_wheat_seed'}, + rarity = 9-number, + }, + }, + }, + } + + if number < 8 then + def._dfcaverns_next_stage = "dfcaverns:cave_wheat_"..tostring(number+1) + table.insert(wheat_names, "dfcaverns:cave_wheat_"..tostring(number)) + end + + minetest.register_node("dfcaverns:cave_wheat_"..tostring(number), def) +end + +for i = 1,8 do + register_cave_wheat(i) +end + +dfcaverns.register_seed("cave_wheat_seed", S("Cave Wheat Seed"), "dfcaverns_cave_wheat_seed.png", "dfcaverns:cave_wheat_1") +table.insert(wheat_names, "dfcaverns:cave_wheat_seed") + +dfcaverns.register_grow_abm(wheat_names, 10, 1) + +minetest.register_craftitem("dfcaverns:cave_wheat", { + description = S("Cave Wheat"), + inventory_image = "dfcaverns_cave_wheat.png", + stack_max = 99, +}) +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:cave_wheat", + burntime = 2 +}) diff --git a/plants/dimple_cup.lua b/plants/dimple_cup.lua new file mode 100644 index 0000000..7c53564 --- /dev/null +++ b/plants/dimple_cup.lua @@ -0,0 +1,43 @@ +local dimple_names = {} + +local register_dimple_cup = function(number) + local def = { + description = S("Dimple Cup"), + drawtype = "plantlike", + tiles = {"dfcaverns_dimple_cup_"..tostring(number)..".png"}, + inventory_image = "dfcaverns_dimple_cup_"..tostring(number)..".png", + paramtype = "light", + walkable = false, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, + sounds = default.node_sound_leaves_defaults(), + drop = { + max_items = 1, + items = { + { + items = {'dfcaverns:dimple_cup_seed 2', 'dfcaverns:dimple_cup_4'}, + rarity = 7-number, + }, + { + items = {'dfcaverns:dimple_cup_seed 1', 'dfcaverns:dimple_cup_4'}, + rarity = 5-number, + }, + }, + }, + } + + if number < 4 then + def._dfcaverns_next_stage = "dfcaverns:dimple_cup_"..tostring(number+1) + table.insert(dimple_names, "dfcaverns:dimple_cup_"..tostring(number)) + end + + minetest.register_node("dfcaverns:dimple_cup_"..tostring(number), def) +end + +for i = 1,4 do + register_dimple_cup(i) +end + +dfcaverns.register_seed("dimple_cup_seed", S("Dimple Cup Spores"), "dfcaverns_dimple_cup_seed.png", "dfcaverns:dimple_cup_1") +table.insert(dimple_names, "dfcaverns:dimple_cup_seed") + +dfcaverns.register_grow_abm(dimple_names, 10, 1) diff --git a/plants/pig_tail.lua b/plants/pig_tail.lua new file mode 100644 index 0000000..a436204 --- /dev/null +++ b/plants/pig_tail.lua @@ -0,0 +1,62 @@ +local pig_tail_names = {} + +local register_pig_tail = function(number) + local def = { + description = S("Pig Tail"), + drawtype = "plantlike", + paramtype2 = "meshoptions", + place_param2 = 3, + tiles = {"dfcaverns_pig_tail_"..tostring(number)..".png"}, + inventory_image = "dfcaverns_pig_tail_"..tostring(number)..".png", + paramtype = "light", + walkable = false, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, + sounds = default.node_sound_leaves_defaults(), + drop = { + max_items = 1, + items = { + { + items = {'dfcaverns:pig_tail_seed 2', 'dfcaverns:pig_tail_thread 2'}, + rarity = 9-number, + }, + { + items = {'dfcaverns:pig_tail_seed 1', 'dfcaverns:pig_tail_thread'}, + rarity = 9-number, + }, + { + items = {'dfcaverns:pig_tail_seed'}, + rarity = 9-number, + }, + }, + }, + } + + if number < 8 then + def._dfcaverns_next_stage = "dfcaverns:pig_tail_"..tostring(number+1) + table.insert(pig_tail_names, "dfcaverns:pig_tail_"..tostring(number)) + end + + minetest.register_node("dfcaverns:pig_tail_"..tostring(number), def) +end + +for i = 1,8 do + register_pig_tail(i) +end + +dfcaverns.register_seed("pig_tail_seed", S("Pig Tail Spore"), "dfcaverns_pig_tail_seed.png", "dfcaverns:pig_tail_1") +table.insert(pig_tail_names, "dfcaverns:pig_tail_seed") + +dfcaverns.register_grow_abm(pig_tail_names, 10, 1) + +minetest.register_craftitem("dfcaverns:pig_tail_thread", { + description = S("Pig tail thread"), + inventory_image = "dfcaverns_pig_tail_thread.png", + groups = {flammable = 1}, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:pig_tail_thread", + burntime = 1, +}) + diff --git a/plants/plump_helmet.lua b/plants/plump_helmet.lua new file mode 100644 index 0000000..8ff66d2 --- /dev/null +++ b/plants/plump_helmet.lua @@ -0,0 +1,208 @@ +local displace_x = 0.125 +local displace_z = 0.125 + +minetest.register_node("dfcaverns:plump_helmet_spawn", { + description = S("Plump Helmet Spawn"), + tiles = { + "dfcaverns_plump_helmet_cap.png", + }, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, + _dfcaverns_next_stage = "dfcaverns:plump_helmet_1", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + node_box = { + type = "fixed", + fixed = { + {-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.375, 0.0625 + displace_z}, + } + }, + on_construct = function(pos) + minetest.swap_node(pos, {name="dfcaverns:plump_helmet_spawn", param2 = math.random(0,3)}) + end, +}) + +minetest.register_node("dfcaverns:plump_helmet_1", { + description = S("Plump Helmet"), + tiles = { + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png^[lowpart:5:dfcaverns_plump_helmet_stem.png", + }, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, + _dfcaverns_next_stage = "dfcaverns:plump_helmet_2", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + node_box = { + type = "fixed", + fixed = { + {-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.25, 0.0625 + displace_z}, -- stalk + {-0.125 + displace_x, -0.4375, -0.1875 + displace_z, 0.1875 + displace_x, -0.3125, 0.125 + displace_z}, -- cap + } + }, + + on_construct = function(pos) + minetest.swap_node(pos, {name="dfcaverns:plump_helmet_1", param2 = math.random(0,3)}) + end, +}) + + +minetest.register_node("dfcaverns:plump_helmet_2", { + description = S("Plump Helmet"), + tiles = { + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png^[lowpart:15:dfcaverns_plump_helmet_stem.png", + }, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, + _dfcaverns_next_stage = "dfcaverns:plump_helmet_3", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + node_box = { + type = "fixed", + fixed = { + {-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, 0, 0.0625 + displace_z}, -- stalk + {-0.125 + displace_x, -0.3125, -0.1875 + displace_z, 0.1875 + displace_x, -0.0625, 0.125 + displace_z}, -- cap + } + }, + + drop = { + max_items = 2, + items = { + { + items = {'dfcaverns:plump_helmet_2'}, + rarity = 1, + }, + { + items = {'dfcaverns:plump_helmet_spawn'}, + rarity = 4, + }, + }, + }, + + on_construct = function(pos) + minetest.swap_node(pos, {name="dfcaverns:plump_helmet_2", param2 = math.random(0,3)}) + end, +}) + +minetest.register_node("dfcaverns:plump_helmet_3", { + description = S("Plump Helmet"), + tiles = { + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png^[lowpart:35:dfcaverns_plump_helmet_stem.png", + }, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, + _dfcaverns_next_stage = "dfcaverns:plump_helmet_4", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + node_box = { + type = "fixed", + fixed = { + {-0.125 + displace_x, -0.5, -0.1875 + displace_z, 0.1875 + displace_x, 0.25, 0.125 + displace_z}, -- stalk + {-0.1875 + displace_x, -0.125, -0.25 + displace_z, 0.25 + displace_x, 0.1875, 0.1875 + displace_z}, -- cap + } + }, + + drop = { + max_items = 2, + items = { + { + items = {'dfcaverns:plump_helmet_3'}, + rarity = 1, + }, + { + items = {'dfcaverns:plump_helmet_spawn'}, + rarity = 2, + }, + }, + }, + + on_construct = function(pos) + minetest.swap_node(pos, {name="dfcaverns:plump_helmet_3", param2 = math.random(0,3)}) + end, +}) + +minetest.register_node("dfcaverns:plump_helmet_4", { + description = S("Plump Helmet"), + tiles = { + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png", + "dfcaverns_plump_helmet_cap.png^[lowpart:40:dfcaverns_plump_helmet_stem.png", + }, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + node_box = { + type = "fixed", + fixed = { + {-0.125 + displace_x, -0.5, -0.1875 + displace_z, 0.1875 + displace_x, 0.375, 0.125 + displace_z}, -- stalk + {-0.25 + displace_x, -0.0625, -0.3125 + displace_z, 0.3125 + displace_x, 0.25, 0.25 + displace_z}, -- cap + {-0.1875 + displace_x, 0.25, -0.25 + displace_z, 0.25 + displace_x, 0.3125, 0.1875 + displace_z}, -- cap rounding + } + }, + + drop = { + max_items = 4, + items = { + { + items = {'dfcaverns:plump_helmet_4'}, + rarity = 1, + }, + { + items = {'dfcaverns:plump_helmet_spawn'}, + rarity = 1, + }, + { + items = {'dfcaverns:plump_helmet_spawn'}, + rarity = 2, + }, + { + items = {'dfcaverns:plump_helmet_spawn'}, + rarity = 2, + }, + }, + }, + + on_construct = function(pos) + minetest.swap_node(pos, {name="dfcaverns:plump_helmet_4", param2 = math.random(0,3)}) + end, +}) + +local plump_names = {"dfcaverns:plump_helmet_spawn", "dfcaverns:plump_helmet_1", "dfcaverns:plump_helmet_2", "dfcaverns:plump_helmet_3"} +dfcaverns.register_grow_abm(plump_names, 10, 1) + +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:plump_helmet_spawn", + burntime = 1 +}) +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:plump_helmet_1", + burntime = 1 +}) +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:plump_helmet_2", + burntime = 2 +}) +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:plump_helmet_3", + burntime = 3 +}) +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:plump_helmet_4", + burntime = 4 +}) diff --git a/plants/quarry_bush.lua b/plants/quarry_bush.lua new file mode 100644 index 0000000..e4372f0 --- /dev/null +++ b/plants/quarry_bush.lua @@ -0,0 +1,61 @@ +local quarry_names = {} + +local register_quarry_bush = function(number) + local def = { + description = S("Quarry Bush"), + drawtype = "plantlike", + paramtype2 = "meshoptions", + place_param2 = 4, + tiles = {"dfcaverns_quarry_bush_"..tostring(number)..".png"}, + inventory_image = "dfcaverns_quarry_bush_"..tostring(number)..".png", + paramtype = "light", + walkable = false, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, + sounds = default.node_sound_leaves_defaults(), + + drop = { + max_items = 2, + items = { + { + items = {'dfcaverns:quarry_bush_seed 2', 'dfcaverns:quarry_bush_leaves 2'}, + rarity = 6-number, + }, + { + items = {'dfcaverns:quarry_bush_seed 1', 'dfcaverns:quarry_bush_leaves'}, + rarity = 6-number, + }, + { + items = {'dfcaverns:quarry_bush_seed'}, + rarity = 6-number, + }, + }, + }, + } + + if number < 5 then + def._dfcaverns_next_stage = "dfcaverns:quarry_bush_"..tostring(number+1) + table.insert(quarry_names, "dfcaverns:quarry_bush_"..tostring(number)) + end + + minetest.register_node("dfcaverns:quarry_bush_"..tostring(number), def) +end + +for i = 1,5 do + register_quarry_bush(i) +end + +dfcaverns.register_seed("quarry_bush_seed", S("Rock Nuts"), "dfcaverns_rock_nuts.png", "dfcaverns:quarry_bush_1") +table.insert(quarry_names, "dfcaverns:quarry_bush_seed") + +dfcaverns.register_grow_abm(quarry_names, 10, 1) + +minetest.register_craftitem("dfcaverns:quarry_bush_leaves", { + description = S("Quarry Bush Leaves"), + inventory_image = "dfcaverns_quarry_bush_leaves.png", + stack_max = 99, +}) +minetest.register_craft({ + type = "fuel", + recipe = "dfcaverns:quarry_bush_leaves", + burntime = 4 +}) diff --git a/plants/sweet_pod.lua b/plants/sweet_pod.lua new file mode 100644 index 0000000..19de0f2 --- /dev/null +++ b/plants/sweet_pod.lua @@ -0,0 +1,30 @@ +local sweet_names = {} + +local register_sweet_pod = function(number) + local def = { + description = S("Sweet Pod"), + drawtype = "plantlike", + tiles = {"dfcaverns_sweet_pod_"..tostring(number)..".png"}, + inventory_image = "dfcaverns_sweet_pod_"..tostring(number)..".png", + paramtype = "light", + walkable = false, + groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11}, + sounds = default.node_sound_leaves_defaults(), + } + + if number < 6 then + def._dfcaverns_next_stage = "dfcaverns:sweet_pod_"..tostring(number+1) + table.insert(sweet_names, "dfcaverns:sweet_pod_"..tostring(number)) + end + + minetest.register_node("dfcaverns:sweet_pod_"..tostring(number), def) +end + +for i = 1,6 do + register_sweet_pod(i) +end + +dfcaverns.register_seed("sweet_pod_seed", S("Sweet Pod Spores"), "dfcaverns_sweet_pod_seed.png", "dfcaverns:sweet_pod_1") +table.insert(sweet_names, "dfcaverns:sweet_pod_seed") + +dfcaverns.register_grow_abm(sweet_names, 10, 1)