1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-12-28 23:40:17 +01:00

Rewrite stairs code.

- Handle stairsplus stairs and MTG stairs in the same file.
 - Only create stairs using stairsplus or MTG stairs, not both.
 - Handle map switching from MTG stairs to stairsplus automatically.
 - If using stairsplus:
   - Move stairsplus nodes to proper namespace.
   - Alias stairsplus nodes that moved to a new namespace.
   - Alias duplicated ice and snowblock stairs and slabs to their new namespace.
   - Make ice_brick sawable too.
   - Unify stairsplus cut ice and default:ice texture brightness.
 - If using MTG stairs:
   - Move stairs and slabs to MTG stairs namespace.
   - Alias stairs and slabs that moved to the new namespace.
This commit is contained in:
Foz 2018-01-07 02:30:57 -05:00 committed by you
parent 0dcf9b5f0e
commit 898c7e313b
5 changed files with 99 additions and 654 deletions

View File

@ -66,6 +66,7 @@ dofile(srcpath.."snowball.lua")
-- To get Xmas tree saplings, the "christmas_content", true or false, in "util.lua" has to be determined first. -- To get Xmas tree saplings, the "christmas_content", true or false, in "util.lua" has to be determined first.
-- That means "nodes.lua", where the saplings are controlled, has to come after "util.lua". ~ LazyJ -- That means "nodes.lua", where the saplings are controlled, has to come after "util.lua". ~ LazyJ
dofile(srcpath.."nodes.lua") dofile(srcpath.."nodes.lua")
dofile(srcpath.."stairs.lua")
dofile(srcpath.."mapgen.lua") dofile(srcpath.."mapgen.lua")
dofile(srcpath.."sled.lua") dofile(srcpath.."sled.lua")
dofile(srcpath.."falling_snow.lua") dofile(srcpath.."falling_snow.lua")

View File

@ -1,302 +0,0 @@
-- Based on
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.
-- ADD CHECK FOR MOREBLOCKS/SKIP IF NOT FOUND CODE STUFF HERE
-- what of the recipeitem can be copied
local recipe_values = {
"description", "tiles", "groups", "sounds", "use_texture_alpha", "sunlight_propagates",
"freezemelt", "liquidtype", "sunlight_propagates",
"stair_desc", "slab_desc"
}
local stairdef = {
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = true,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_snow_footstep", gain=0.25},
dig = {name="default_dig_crumbly", gain=0.4},
dug = {name="default_snow_footstep", gain=0.75},
place = {name="default_place_node", gain=1.0}
}),
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:getpos()
if placer_pos then
local dir = {
x = p1.x - placer_pos.x,
y = p1.y - placer_pos.y,
z = p1.z - placer_pos.z
}
param2 = minetest.dir_to_facedir(dir)
end
if p0.y-1 == p1.y then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
on_construct = function(pos)
pos.y = pos.y - 1
local node = minetest.get_node(pos)
if node.name == "default:dirt_with_grass"
-- Thinking in terms of layers, dirt_with_snow could also double as
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
or node.name == "default:dirt" then
node.name = "default:dirt_with_snow"
minetest.set_node(pos, node)
end
end
}
-- Node will be called snow:stair_<subname>
local function register_stair(subname, recipeitem, newdef)
local def = table.copy(stairdef)
for n,i in pairs(newdef) do
def[n] = i
end
local name = "snow:stair_" .. subname
minetest.register_node(name, def)
--[[
-- for replace ABM
minetest.register_node("snow:stair_" .. subname.."upside_down", {
replace_name = "snow:stair_" .. subname,
groups = {slabs_replace=1},
})
--]]
minetest.register_craft({
output = name .. " 6",
recipe = {
{recipeitem, "", ""},
{recipeitem, recipeitem, ""},
{recipeitem, recipeitem, recipeitem},
},
})
-- Flipped recipe
minetest.register_craft({
output = name .. " 6",
recipe = {
{"", "", recipeitem},
{"", recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
end
local slabdef = table.copy(stairdef)
slabdef.node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
}
slabdef.on_place = nil
-- Node will be called snow:slab_<subname>
local function register_slab(subname, recipeitem, newdef)
local def = table.copy(slabdef)
local name = "snow:slab_" .. subname
def.on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
-- If it's being placed on an another similar one, replace it with
-- a full block
local slabpos, slabnode
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local n0 = minetest.get_node(p0)
local n1 = minetest.get_node(p1)
local n0_is_upside_down = (n0.name == name and
n0.param2 >= 20)
if n0.name == name
and not n0_is_upside_down
and p0.y+1 == p1.y then
slabpos = p0
slabnode = n0
elseif n1.name == name then
slabpos = p1
slabnode = n1
end
if slabpos then
-- Remove the slab at slabpos
minetest.remove_node(slabpos)
-- Make a fake stack of a single item and try to place it
local fakestack = ItemStack(recipeitem)
fakestack:set_count(itemstack:get_count())
pointed_thing.above = slabpos
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
-- Else put old node back
else
minetest.set_node(slabpos, slabnode)
end
return itemstack
end
local param2
-- Upside down slabs
if p0.y-1 == p1.y then
-- Turn into full block if pointing at a existing slab
if n0_is_upside_down then
-- Remove the slab at the position of the slab
minetest.remove_node(p0)
-- Make a fake stack of a single item and try to place it
local fakestack = ItemStack(recipeitem)
fakestack:set_count(itemstack:get_count())
pointed_thing.above = p0
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
-- Else put old node back
else
minetest.set_node(p0, n0)
end
return itemstack
end
-- Place upside down slab
param2 = 20
elseif n0_is_upside_down
and p0.y+1 ~= p1.y then
-- If pointing at the side of a upside down slab
param2 = 20
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end
for n,i in pairs(newdef) do
def[n] = i
end
minetest.register_node(name, def)
--[[
-- for replace ABM
minetest.register_node("snow:slab_" .. subname.."upside_down", {
replace_name = "snow:slab_"..subname,
groups = {slabs_replace=1},
})
--]]
minetest.register_craft({
output = name .. " 6",
recipe = {
{recipeitem, recipeitem, recipeitem},
},
})
end
--[[
-- Replace old "upside_down" nodes with new param2 versions
minetest.register_abm({
nodenames = {"group:slabs_replace"},
interval = 1,
chance = 1,
action = function(pos, node)
node.name = minetest.registered_nodes[node.name].replace_name
node.param2 = node.param2 + 20
if node.param2 == 21 then
node.param2 = 23
elseif node.param2 == 23 then
node.param2 = 21
end
minetest.set_node(pos, node)
end,
})
--]]
-- Snow stairs and slabs require extra definitions because of their extra
-- features (freezing, melting, and how they change dirt and dirt_with_grass). ~ LazyJ
-- Nodes will be called snow:{stair,slab}_<subname>
local function register_stair_and_slab(subname, recipeitem, def)
local recipedef = minetest.registered_nodes[recipeitem]
for _,i in pairs(recipe_values) do
if def[i] == nil
and recipedef[i] ~= nil then
def[i] = recipedef[i]
end
end
local groups = table.copy(def.groups)
groups.cooks_into_ice = nil
if groups.melts then
groups.melts = math.min(groups.melts+1, 3)
end
def.groups = groups
local stair_desc = def.stair_desc
def.stair_desc = nil
local slab_desc = def.slab_desc
def.slab_desc = nil
def.description = stair_desc
register_stair(subname, recipeitem, def)
def.description = slab_desc
register_slab(subname, recipeitem, def)
end
list_of_snow_stuff = {
--{"row[1] = first item in row",
-- "row[2] = second item in row",
-- "row[3] = third item in row", and so on, and so on...}, ~ LazyJ
{"ice", "default:ice", "Ice Stairs", "Ice Slabs"},
{"snowblock", "default:snowblock", "Snowblock Stairs", "Snowblock Slabs"},
{"snow_cobble", "snow:snow_cobble", "Snow Cobble Stairs", "Snow Cobble Slabs"},
{"snow_brick", "snow:snow_brick", "Snow Brick Stair", "Snow Brick Slab"},
{"ice_brick", "snow:ice_brick", "Ice Brick Stair", "Ice Brick Slab"},
}
for _, row in pairs(list_of_snow_stuff) do
register_stair_and_slab(row[1], row[2], {
stair_desc = row[3],
slab_desc = row[4],
})
end

View File

@ -352,7 +352,7 @@ minetest.override_item("default:ice", {
param2 = 0, --param2 is reserved for how much ice will freezeover. param2 = 0, --param2 is reserved for how much ice will freezeover.
sunlight_propagates = true, -- necessary for dirt_with_grass/snow/just dirt ABMs sunlight_propagates = true, -- necessary for dirt_with_grass/snow/just dirt ABMs
drawtype = "glasslike", drawtype = "glasslike",
inventory_image = minetest.inventorycube"default_ice.png".."^[brighten", tiles = {"default_ice.png^[brighten"},
liquidtype = "none", liquidtype = "none",
-- I made this a lot harder to dig than snow blocks because ice is much more dense -- I made this a lot harder to dig than snow blocks because ice is much more dense
-- and solid than fluffy snow. ~ LazyJ -- and solid than fluffy snow. ~ LazyJ
@ -468,16 +468,3 @@ minetest.override_item("default:snow", {
end, end,
on_use = snow.shoot_snowball on_use = snow.shoot_snowball
}) })
-- Do stairs files
local path = minetest.get_modpath"snow".."/src/"
dofile(path.."basic_stairs_slabs.lua")
if minetest.global_exists"stairsplus"
and minetest.get_modpath"moreblocks" then
dofile(path.."stairsplus.lua")
end

97
src/stairs.lua Normal file
View File

@ -0,0 +1,97 @@
local snow_nodes = {
snow = { "ice_brick", "snow_brick", "snow_cobble" },
default = { "ice", "snowblock" }
}
if minetest.get_modpath("moreblocks") and
minetest.global_exists("stairsplus") then
-- For users converting from MTG stairs to stairsplus, these nodes are aliased
-- from the stairs namespace to their source mod.
local was_in_stairs = {
ice_brick = true,
snow_brick = true,
snow_cobble = true,
ice = false, -- moreblocks will take care of this one, and
snowblock = false, -- this one, because they are in the default namespace.
}
-- Some nodes were incorrectly placed into the snow namespace. Alias these to
-- their proper namespace (default).
local was_in_snow = {
ice_brick = false,
snow_brick = false,
snow_cobble = false,
ice = true,
snowblock = true,
}
-- Some nodes were incorrectly placed into the moreblocks namespace. Alias
-- these to their proper namespace (either snow or default).
local was_in_moreblocks = {
ice_brick = false,
snow_brick = true,
snow_cobble = true,
ice = true,
snowblock = true,
}
for mod, nodes in pairs(snow_nodes) do
for _, name in pairs(nodes) do
local nodename = mod .. ":" .. name
local ndef = table.copy(minetest.registered_nodes[nodename])
ndef.sunlight_propagates = true
ndef.groups.melts = 2
ndef.groups.icemaker = nil
ndef.groups.cooks_into_ice = nil
ndef.after_place_node = nil
stairsplus:register_all(mod, name, nodename, ndef)
if was_in_stairs[name] then
minetest.register_alias("stairs:stair_" .. name, mod .. ":stair_" .. name)
minetest.register_alias("stairs:slab_" .. name, mod .. ":slab_" .. name)
end
if was_in_snow[name] then
minetest.register_alias("snow:stair_" .. name, mod .. ":stair_" .. name)
minetest.register_alias("snow:slab_" .. name, mod .. ":slab_" .. name)
end
if was_in_moreblocks[name] then
stairsplus:register_alias_all("moreblocks", name, mod, name)
end
end
end
elseif minetest.global_exists("stairs") then -- simple stairs and slabs only
for mod, nodes in pairs(snow_nodes) do
for _, name in pairs(nodes) do
local nodename = mod .. ":" .. name
local ndef = table.copy(minetest.registered_nodes[nodename])
local desc_stair = ndef.description .. " Stair"
local desc_slab = ndef.description .. " Slab"
local images = ndef.tiles
local sounds = ndef.sounds
local groups = ndef.groups
groups.melts = 2
groups.icemaker = nil
groups.cooks_into_ice = nil
stairs.register_stair_and_slab(name, nodename,
groups, images, desc_stair, desc_slab, sounds)
-- Add transparency if used (e.g. ice and ice_brick).
minetest.override_item("stairs:stair_" .. name,
{use_texture_alpha = ndef.use_texture_alpha})
minetest.override_item("stairs:slab_" .. name,
{use_texture_alpha = ndef.use_texture_alpha})
-- Alias all stairs and slabs from snow to the stairs namespace.
minetest.register_alias("snow:stair_" .. name, "stairs:stair_" .. name)
minetest.register_alias("snow:slab_" .. name, "stairs:slab_" .. name)
end
end
end

View File

@ -1,338 +0,0 @@
-- ===============================================================================
-- StairsPlus Bonus!
-- ===============================================================================
--[[
This section of code that makes blocks compatible with MoreBlocks' circular saw.
I've added circular saw compatible code for default snowblocks and ice. :D
A big thanks to Calinou and ShadowNinja for making this possible.
Because StairsPlus creates partial blocks, it didn't seem quite right that the
smallest microblocks would produce a full-sized water_source node when melted.
So I toned them down a bit by changing their melt to a temporary,
2-second water_source. See "melts" in abms.lua file for the various intensities.
___...::: ATTENTION MINETEST SERVER OPERATORS :::...___
You may or may not have noticed in your server logs that MoreBlocks stairs/slabs/
panels/microblocks are not recorded as to when, who, what, and where. This is
important information when trying to determine if a player who dug these blocks
is the owner (the player who placed the block) or is a griefer stealing the block.
There is an option that will log when these blocks are placed but it comes at the
cost of losing the auto-rotation of those blocks when placed. They can still be
rotated with a screwdriver but if screwdrivers are disabled on your server your
players won't be able to position MoreBlocks, saw-made blocks.
To enable logging the placement of these blocks, un-comment these lines:
--on_place = minetest.item_place
There is one in each of the "stairsplus.register_all" sections.
~ LazyJ
-- ===============================================================================
--]]
--snow_stairsplus = {}
-- Check for infinite stacks
--if minetest.get_modpath("unified_inventory") or not minetest.settigetbool("creative_mode") then
-- snow_stairsplus.expect_infinite_stacks = false
--else
-- snow_stairsplus.expect_infinite_stacks = true
--end
-- First, let's run a check to see if MoreBlocks is installed; we're going to need it for the
-- next section of stairsplus stuff. ~LazyJ
-- 'If' MoreBlocks was found and stairsplus is available, well, 'then' go ahead with this next part:
--[[ Leave commented out - For reference only. ~ LazyJ
function stairsplus.register_all(modname, subname, recipeitem, fields)
--stairsplus.register_stair_slab_panel_micro(modname, subname, recipeitem, fields)
stairsplus:register_stair(modname, subname, recipeitem, fields)
stairsplus:register_slab(modname, subname, recipeitem, fields)
stairsplus:register_panel(modname, subname, recipeitem, fields)
stairsplus:register_micro(modname, subname, recipeitem, fields)
end
Leave commented out
--]]
-- Leave commented out. Another, possible piece of the puzzle, as to why the placement of
-- stairsplus nodes aren't recorded in the logs. Shelved till I can concentrate on it again.
-- ~ LazyJ
--ItemStack({name=nodename}):get_definition()
--itemstack ={}
--[[
local def = itemstack:get_definition()
function minetest.item_place_node(itemstack, placer, pointed_thing, param2)
minetest.log("action", placer:get_player_name() .. " places node "
.. def.name .. " at " .. minetest.pos_to_string(place_to))
end
Leave commented out
--]]
-- Leave commented out
--[[ FIGURE OUT HOW TO GET THE SLABS TO SHOW UP IN THE LOG ON PLACEMENT
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
-- If it's being placed on an another similar one, replace it with
-- a full block
local slabpos = nil
local slabnode = nil
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local n0 = minetest.get_node(p0)
local n1 = minetest.get_node(p1)
local param2 = 0
local n0_is_upside_down = (n0.name == "snow:slab_" .. subname and
n0.param2 >= 20)
if n0.name == "snow:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
slabpos = p0
slabnode = n0
elseif n1.name == "snow:slab_" .. subname then
slabpos = p1
slabnode = n1
end
if slabpos then
-- Remove the slab at slabpos
minetest.remove_node(slabpos)
-- Make a fake stack of a single item and try to place it
local fakestack = ItemStack(recipeitem)
fakestack:set_count(itemstack:get_count())
pointed_thing.above = slabpos
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
-- Else put old node back
else
minetest.set_node(slabpos, slabnode)
end
return itemstack
end
-- Upside down slabs
if p0.y-1 == p1.y then
-- Turn into full block if pointing at a existing slab
if n0_is_upside_down then
-- Remove the slab at the position of the slab
minetest.remove_node(p0)
-- Make a fake stack of a single item and try to place it
local fakestack = ItemStack(recipeitem)
fakestack:set_count(itemstack:get_count())
pointed_thing.above = p0
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
-- Else put old node back
else
minetest.set_node(p0, n0)
end
return itemstack
end
-- Place upside down slab
param2 = 20
end
-- If pointing at the side of a upside down slab
if n0_is_upside_down and p0.y+1 ~= p1.y then
param2 = 20
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end
Leave commented out
--]]
--[[
Below, in the "groups" line there is a "melts" category. Back in the ABMs lua file, melting
code, melts=1 will produce a water_source when the full-sized snow/ice block is melted making
a big, watery mess. melts=2 will produce a water_source only for a moment, then it changes back
to water_flowing and then dries-up and disappears. I gave these stairs/slabs/panels/microblocks
a melts value of 2 instead of 1 because they are not full blocks.
~ LazyJ
--]]
-- Default snowblock and ice stairs/slabs/panels/microblocks.
local ndef = minetest.registered_nodes["default:ice"]
local groups = {}
for k, v in pairs(ndef.groups) do groups[k] = v end
stairsplus:register_all("moreblocks", "ice", "default:ice", {
description = ndef.description,
paramtype2 = "facedir",
-- Added "icemaker=1" in groups. This ties into the freezing
-- function in the ABMs.lua file. ~ LazyJ
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, melts=2, icemaker=1},
sounds = default.node_sound_glass_defaults(),
tiles = ndef.tiles,
-- Because of the "use_texture_alpha" line, that gives ice transparency, I couldn't combine
-- default ice and default snowblocks in a list like MoreBlocks does. ~ LazyJ
use_texture_alpha = true,
sunlight_propagates = true,
-- This "on_place" line makes placing these nodes recorded in the logs.
-- Useful for investigating griefings and determining ownership
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
--on_place = minetest.item_place,
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could
-- also double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"})
end
end
})
--end
local ndef = minetest.registered_nodes["default:snowblock"]
local groups = {}
for k, v in pairs(ndef.groups) do groups[k] = v end
stairsplus:register_all("moreblocks", "snowblock", "default:snowblock", {
description = ndef.description,
paramtype2 = "facedir",
-- Added "icemaker=1" in groups. This ties into the freezing function
-- in the ABMs.lua file. ~ LazyJ
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=2, icemaker=1},
tiles = ndef.tiles,
sunlight_propagates = true,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_snow_footstep", gain=0.25},
dig = {name="default_dig_crumbly", gain=0.4},
dug = {name="default_snow_footstep", gain=0.75},
place = {name="default_place_node", gain=1.0}
}),
-- This "on_place" line makes placing these nodes recorded in the logs.
-- Useful for investigating griefings and determining ownership
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
--on_place = minetest.item_place,
-- The "on_construct" part below, thinking in terms of layers,
-- dirt_with_snow could also double as dirt_with_frost
-- which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"})
end
end
})
-- Snow stairs/slabs/panels/microblocks.
local snow_nodes = {
"snow_brick",
"snow_cobble",
}
for _, name in pairs(snow_nodes) do
local nodename = "snow:"..name
local ndef = minetest.registered_nodes[nodename]
local groups = {}
for k, v in pairs(ndef.groups) do groups[k] = v end
stairsplus:register_all("moreblocks", name, nodename, {
description = ndef.description,
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=2, icemaker=1},
tiles = ndef.tiles,
--paramtype2 = "facedir",
sunlight_propagates = true,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_snow_footstep", gain=0.25},
dig = {name="default_dig_crumbly", gain=0.4},
dug = {name="default_snow_footstep", gain=0.75},
place = {name="default_place_node", gain=1.0}
}),
-- This "on_place" line makes placing these nodes recorded in the logs.
-- Useful for investigating griefings and determining ownership
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
--on_place = minetest.item_place,
-- Some attempts to have both, the recording in the logs of the placing of
-- the stairplus stuff *and* have the auto-rotation work. No luck yet.
-- ~ LazyJ
--[[
on_place = function (i, p, t)
minetest.item_place(i, p, t, 0)
minetest.rotate_node(i, p, t)
end,
--]]
--[[
on_place = function (i, p, t)
minetest.rotate_node(i, p, t, 0)
minetest.item_place(i, p, t)
end,
--]]
-- Picking up were we left off... ~ LazyJ
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could
-- also double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
or minetest.get_node(pos).name == "default:dirt"
then minetest.set_node(pos, {name="default:dirt_with_snow"})
end
-- Some ideas I've tried. Leaving for future reference till I can figure out a workable solution. ~ LazyJ
--minetest.log("action", sender:get_player_name().." places" ..minetest.get_node(pos).name.. "at" ..minetest.pos_to_string(pos))
--minetest.log("action", minetest.get_player_name().." places" ..minetest.get_node(pos).name.. "at" ..minetest.pos_to_string(pos))
--minetest.log("action", "BINGO places "..minetest.get_name().." at "..minetest.pos_to_string(pos))
--minetest.log("action", minetest.get_player_name().." places "..minetest.get_name().." at "..minetest.pos_to_string(pos))
--minetest.log("action", placer:get_player_name().." places moreblocks-something at "..minetest.pos_to_string(pos))
--minetest.log("action", " BINGO places "..minetest.get_pointed_thing().." at "..minetest.pos_to_string(pos))
--minetest.log("action", "BINGO places moreblocks"..ndef.." at "..minetest.pos_to_string(pos))
--minetest.log("action", "A pine sapling grows into a Christmas tree at "..minetest.pos_to_string(pos))
--return minetest.item_place(itemstack, placer, pointed_thing, param2)
--return minetest.item_place(itemstack, pointed_thing, param2)
end,
})
end
-- from clear up at the top, the MoreBlocks check. "Else", if MoreBlocks wasn't found, skip
-- down to here, "return" nothing and "end" this script. ~ LazyJ