cleanup dead code,

add basic seasons support
master
Izzy 2019-06-12 19:33:26 -06:00
parent 3808342e15
commit 665936e0c0
4 changed files with 31 additions and 176 deletions

View File

@ -1 +1,2 @@
default
seasons?

View File

@ -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

View File

@ -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")

View File

@ -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