From 665936e0c0085c7991c4dfebf386d30c6469418c Mon Sep 17 00:00:00 2001 From: Izzy Date: Wed, 12 Jun 2019 19:33:26 -0600 Subject: [PATCH] cleanup dead code, add basic seasons support --- depends.txt | 1 + gourd_gen.lua | 173 -------------------------------------------------- init.lua | 1 - node_def.lua | 32 +++++++++- 4 files changed, 31 insertions(+), 176 deletions(-) delete mode 100644 gourd_gen.lua diff --git a/depends.txt b/depends.txt index 4ad96d5..8927eab 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ default +seasons? diff --git a/gourd_gen.lua b/gourd_gen.lua deleted file mode 100644 index 4b52040..0000000 --- a/gourd_gen.lua +++ /dev/null @@ -1,173 +0,0 @@ - - - - - -local function register_gourd(info) - - local name = info.name - - -- done - minetest.register_craftitem(":gourds:"..name.."_seed", { - description = name.." Seed", - inventory_image = "gourds_"..name.."_seed.png", - on_place = function(itemstack, placer, pointed_thing) - local above = minetest.env:get_node(pointed_thing.above) - if above.name == "air" then - above.name = "gourds:"..name.."_root" - minetest.env:set_node(pointed_thing.above, above) - itemstack:take_item(1) - return itemstack - end - end - }) - - minetest.register_node("gourds:"..name.."_sapling", { - paramtype = "light", - walkable = false, - drawtype = "plantlike", - drop = "", - tiles = {"gourds_"..name.."_sapling.png"}, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5} - }, - }, - groups = {snappy=3, flammable=2,plant=1, gourd_root=1, gourd_vines=1 }, - sounds = default.node_sound_leaves_defaults(), - - on_construct = function(pos) - -- set the initial growth limit - end, - }) - - minetest.register_node("gourds:"..name.."_root", { - paramtype = "light", - walkable = false, - sunlight_propagates = true, - drawtype = "nodebox", - drop = ":gourds:"..name.."_sapling", - tiles = {"gourds_"..name.."_vines.png"}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.1, 0.5} - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.1, 0.5} - }, - }, - groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1, gourd_vines=1 }, - sounds = default.node_sound_leaves_defaults(), - - on_construct = function(pos) - -- set the initial growth limit - -- set meta info on it - end, - }) - minetest.register_node("gourds:"..name.."_vines", { - paramtype = "light", - walkable = false, - sunlight_propagates = true, - drawtype = "nodebox", - drop = ":gourds:cut_vines 2", - tiles = {"gourds_"..name.."_vines.png"}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5} - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5} - }, - }, - groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1, gourd_vines=1 }, - sounds = default.node_sound_leaves_defaults(), - - on_construct = function(pos) - -- set the initial growth limit - -- set meta info on it - end, - }) - - - minetest.register_node("gourds:"..name.."_vines_flowering", { - paramtype = "light", - walkable = false, - sunlight_propagates = true, - drawtype = "nodebox", - drop = ":gourds:cut_vines 2", - tiles = {"gourds_"..name.."_vines.png"}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5} - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5} - }, - }, - groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1, gourd_vines=1 }, - sounds = default.node_sound_leaves_defaults(), - - on_construct = function(pos) - -- set the initial growth limit - -- set meta info on it - end, - }) - - - minetest.register_node("gourds:"..name, { - paramtype = "light", - walkable = false, - sunlight_propagates = true, - drawtype = "nodebox", - tiles = {"gourds_"..name..".png"}, - node_box = { - type = "fixed", - fixed = { - {-0.45, -0.5, -0.45, 0.45, 0.35, 0.45} - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.45, -0.5, -0.45, 0.45, 0.35, 0.45} - }, - }, - groups = {snappy=3, flammable=2, ,plant=1, gourd=1 }, - sounds = default.node_sound_leaves_defaults(), - - on_construct = function(pos) - -- set the initial growth limit - -- set meta info on it - end, - }) - - minetest.register_craftitem(":gourds:"..name.."_flesh", { - description = name.." Flesh", - inventory_image = "gourds_"..name.."_flesh.png", - }) - - minetest.register_craft({ - type = "shapeless", - output = "gourds:"..name.."_flesh 2", - recipe = {"gourds:"..name} - }) - - -end - - - - diff --git a/init.lua b/init.lua index 948a864..65a65a4 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,6 @@ local modpath = minetest.get_modpath("gourds") gourds = {} -- dofile(modpath.."/config.lua") --- dofile(modpath.."/gourd_gen.lua") dofile(modpath.."/node_def.lua") dofile(modpath.."/crafts.lua") dofile(modpath.."/mapgen.lua") diff --git a/node_def.lua b/node_def.lua index 3cf0436..3be1379 100644 --- a/node_def.lua +++ b/node_def.lua @@ -490,12 +490,40 @@ gourds.register_gourd = function(def) -- vine roots die eventually minetest.register_abm({ nodenames = {root_name}, - interval = 60, - chance = base_speed * 50, + interval = 120, + chance = base_speed * 70, action = function(pos) minetest.set_node(pos, {name="air"}) end }) + + + if minetest.global_exists("seasons") then + + -- vines die off completely in the winter + +-- seasons.reg_custom("spring", vine_name, vine_name) +-- seasons.reg_custom("summer", vine_name, vine_name) + seasons.reg_custom("fall", vine_name, dead_vine_name) + seasons.reg_custom("winter", vine_name, "air") + +-- seasons.reg_custom("spring", vine_name_flowers, vine_name_flowers) +-- seasons.reg_custom("summer", vine_name_flowers, vine_name_flowers) + seasons.reg_custom("fall", vine_name_flowers, dead_vine_name) + seasons.reg_custom("winter", vine_name_flowers, "air") + + seasons.reg_custom("winter", dead_vine_name, "air") + + seasons.reg_custom("winter", ripe_fruit_name, rotting_fruit_name) + for i = 1,7 do + seasons.reg_custom("winter", "gourds:"..def.name.."_"..i, "air") + end + + + end + + + end