season = {} season.current = "spring" -- Spring Leaves minetest.register_node(":default:leaves", { description = "Leaves", drawtype = "allfaces_optional", visual_scale = 1.1, tiles = {"default_leaves.png"}, inventory_image = "default_leaves.png", paramtype = "light", waving = 1, groups = {snappy=3, leafdecay=3, leaves=1, season=1}, drop = { max_items = 1, items = { {items = {"default:sapling"}, rarity = 20}, {items = {"default:leaves"}} } }, --sounds = default.node_sound_leaves_defaults(), }) -- End of Summer Leaves minetest.register_node("season:leaves_summer", { description = "Leaves", drawtype = "allfaces_optional", visual_scale = 1.1, tiles = {"season_leaves_summer.png"}, inventory_image = "season_leaves_summer.png", paramtype = "light", waving = 1, groups = {snappy=3, leafdecay=3, leaves=1, season=1}, drop = { max_items = 1, items = { {items = {"default:sapling"}, rarity = 20}, {items = {"default:leaves"}} } }, --sounds = default.node_sound_leaves_defaults(), }) -- Autumn Leaves minetest.register_node("season:leaves_autumn", { description = "Leaves", drawtype = "allfaces_optional", visual_scale = 1.1, tiles = {"season_leaves_autumn.png"}, inventory_image = "season_leaves_autumn.png", paramtype = "light", waving = 1, groups = {snappy=3, leafdecay=3, leaves=1, season=1}, drop = { max_items = 1, items = { {items = {"default:sapling"}, rarity = 20}, {items = {"default:leaves"}} } }, --sounds = default.node_sound_leaves_defaults(), }) -- Winter Leaves minetest.register_node("season:leaves_winter", { description = "Leaves", drawtype = "allfaces_optional", visual_scale = 1.1, tiles = {"season_leaves_winter.png"}, inventory_image = "season_leaves_winter.png", paramtype = "light", waving = 1, groups = {snappy=3, leafdecay=3, leaves=1 ,season=1}, drop = { max_items = 1, items = { {items = {"default:sapling"}, rarity = 20}, {items = {"default:leaves"}} } }, --sounds = default.node_sound_leaves_defaults(), }) -- Change Season Command minetest.register_chatcommand("season", { params = "", description = "Changes season ", privs = {server=true}, func = function(name, param) if not param or param == "" then return end local ssn = string.match(param, "([^ ]+)") if not ssn then return end season.current = ssn print("Season changed to:", season.current) end, }) -- Spring Grass minetest.register_node(":default:dirt_with_grass", { description = "Dirt with Grass and Footsteps", tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, is_ground_content = true, groups = {crumbly=3,soil=1,season=1}, drop = 'default:dirt', --sounds = default.node_sound_dirt_defaults({ -- footstep = {name="default_grass_footstep", gain=0.25}, -- }), }) -- Summer Grass minetest.register_node("season:dirt_summer", { description = "Dirt with Grass", tiles = {"season_summer_grass.png", "default_dirt.png", "default_dirt.png^season_summer_grass_side.png"}, is_ground_content = true, groups = {crumbly=3,soil=1 ,season=1}, drop = 'default:dirt', --sounds = default.node_sound_dirt_defaults({ -- footstep = {name="default_grass_footstep", gain=0.25}, -- }), }) -- Autumn Grass minetest.register_node("season:dirt_autumn", { description = "Dirt with Grass", tiles = {"season_autumn_grass.png", "default_dirt.png", "default_dirt.png^season_autumn_grass_side.png"}, is_ground_content = true, groups = {crumbly=3,soil=1 ,season=1}, drop = 'default:dirt', -- sounds = default.node_sound_dirt_defaults({ --footstep = {name="default_grass_footstep", gain=0.25}, --}), }) -- Winter Grass minetest.register_node(":default:dirt_with_snow", { description = "Dirt with Snow", tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"}, is_ground_content = true, groups = {crumbly=3 ,season=1}, drop = 'default:dirt', --sounds = default.node_sound_dirt_defaults({ -- footstep = {name="default_snow_footstep", gain=0.25}, -- }), }) -- Abm that switches leaves depending on Season minetest.register_abm({ nodenames = {"group:season"}, interval = 20, chance = 4, action = function(pos, node, active_object_count, active_object_count_wider) local data = nil data = string.split(node.name, ":", 2) local mod = data[1]..":" local nod = data[2] data = string.split(nod, "_", 2) local typ = data[1] --print ("TYPE:", mod, nod, typ) if typ == "leaves" then if season.current == "spring" then minetest.add_node(pos, {name="default:leaves"}) elseif season.current == "summer" then minetest.add_node(pos, {name="season:leaves_summer"}) elseif season.current == "autumn" then minetest.add_node(pos, {name="season:leaves_autumn"}) elseif season.current == "winter" then minetest.add_node(pos, {name="season:leaves_winter"}) end elseif typ == "dirt" then if season.current == "spring" then minetest.add_node(pos, {name="default:dirt_with_grass"}) elseif season.current == "summer" then minetest.add_node(pos, {name="season:dirt_summer"}) elseif season.current == "autumn" then minetest.add_node(pos, {name="season:dirt_autumn"}) elseif season.current == "winter" then minetest.add_node(pos, {name="default:dirt_with_snow"}) end end end, })