remove whitespaces: for i in */*.lua; do sed -i 's/[ \t]*$//' workers/init.lua ; done

This commit is contained in:
HybridDog 2015-05-29 12:11:17 +02:00
parent d2e7ce77ba
commit 819f2d6cfb
12 changed files with 105 additions and 105 deletions

View File

@ -24,12 +24,12 @@ http://github.com/Splizard/minetest-mod-snow/
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
@ -57,7 +57,7 @@ dofile(minetest.get_modpath("snow").."/src/snowball.lua")
-- The formspec menu didn't work when util.lua was the very first "dofile" so I moved -- The formspec menu didn't work when util.lua was the very first "dofile" so I moved
-- it and all the other original "dofiles", in order, to the bottom of the list. ~ LazyJ -- it and all the other original "dofiles", in order, to the bottom of the list. ~ LazyJ
-- Minetest would crash if the mapgen was called upon before the rest of other snow lua files so -- Minetest would crash if the mapgen was called upon before the rest of other snow lua files so
-- I put it lower on the list and that seems to do the trick. ~ LazyJ -- I put it lower on the list and that seems to do the trick. ~ LazyJ
dofile(minetest.get_modpath("snow").."/src/util.lua") dofile(minetest.get_modpath("snow").."/src/util.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.
@ -81,7 +81,7 @@ end
--This also takes into account sourrounding snow and makes snow even. --This also takes into account sourrounding snow and makes snow even.
function snow.place(pos) function snow.place(pos)
local node = minetest.get_node_or_nil(pos) local node = minetest.get_node_or_nil(pos)
--Oops, maybe there is no node? --Oops, maybe there is no node?
if not node if not node
or not minetest.registered_nodes[node.name] then or not minetest.registered_nodes[node.name] then

View File

@ -52,7 +52,7 @@ minetest.register_abm({
elseif intensity == 2 then elseif intensity == 2 then
minetest.add_node(pos,{name="default:water_flowing", param2=7}) minetest.add_node(pos,{name="default:water_flowing", param2=7})
--[[ LazyJ, you need to add param2, which defines the amount of the flowing water ~ HybridDog 2015_03_06 --[[ LazyJ, you need to add param2, which defines the amount of the flowing water ~ HybridDog 2015_03_06
This was causing "melts=2" nodes to just disappear so I changed it to replace the This was causing "melts=2" nodes to just disappear so I changed it to replace the
node with a water_source for a couple seconds and then replace the water_source with node with a water_source for a couple seconds and then replace the water_source with
air. This way it made a watery mess that quickly evaporated. ~ LazyJ 2014_04_24 air. This way it made a watery mess that quickly evaporated. ~ LazyJ 2014_04_24
local check_place = function(pos,node) local check_place = function(pos,node)
@ -70,7 +70,7 @@ minetest.register_abm({
minetest.add_node(pos,{name="default:water_source"}) minetest.add_node(pos,{name="default:water_source"})
minetest.after(2, function() -- 2 seconds gives just enough time for minetest.after(2, function() -- 2 seconds gives just enough time for
-- the water to flow and spread before the -- the water to flow and spread before the
-- water_source is changed to air. ~ LazyJ -- water_source is changed to air. ~ LazyJ
if minetest.get_node(pos).name == "default:water_source" then if minetest.get_node(pos).name == "default:water_source" then
minetest.add_node(pos,{name="air"}) minetest.add_node(pos,{name="air"})
end end
@ -150,7 +150,7 @@ minetest.register_abm({
minetest.register_abm({ minetest.register_abm({
nodenames = {"snow:sapling_pine"}, nodenames = {"snow:sapling_pine"},
interval = 10, interval = 10,
chance = 50, chance = 50,
action = function(pos, node) action = function(pos, node)
-- Check if there is enough vertical-space for the sapling to grow without -- Check if there is enough vertical-space for the sapling to grow without
@ -169,7 +169,7 @@ minetest.register_abm({
if minetest.get_node(pos).name == "snow:sapling_pine" then if minetest.get_node(pos).name == "snow:sapling_pine" then
-- This switches the sapling to a tree trunk. ~ LazyJ -- This switches the sapling to a tree trunk. ~ LazyJ
minetest.set_node(pos, {name="default:pinetree"}) minetest.set_node(pos, {name="default:pinetree"})
-- This is more for testing but it may be useful info to some admins when -- This is more for testing but it may be useful info to some admins when
-- grepping the server logs too. ~ LazyJ -- grepping the server logs too. ~ LazyJ
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos)) minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos))
end end

View File

@ -9,7 +9,7 @@
snow_stairs = {} -- This is a little trick. Without it Minetest will complain snow_stairs = {} -- This is a little trick. Without it Minetest will complain
-- "attempt to index global 'snow' (a nil value)" and -- "attempt to index global 'snow' (a nil value)" and
-- refuse to load. So a value without definition "={}"is assigned to snow. -- refuse to load. So a value without definition "={}"is assigned to snow.
@ -66,11 +66,11 @@ function snow_stairs.register_stair(subname, recipeitem, groups, images, descrip
return minetest.item_place(itemstack, placer, pointed_thing, param2) return minetest.item_place(itemstack, placer, pointed_thing, param2)
end, end,
on_construct = function(pos) on_construct = function(pos)
pos.y = pos.y - 1 pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass" if minetest.get_node(pos).name == "default:dirt_with_grass"
-- Thinking in terms of layers, dirt_with_snow could also double as -- 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 -- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
or minetest.get_node(pos).name == "default:dirt" then or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"}) minetest.set_node(pos, {name="default:dirt_with_snow"})
@ -168,7 +168,7 @@ function snow_stairs.register_slab(subname, recipeitem, groups, images, descript
end end
return itemstack return itemstack
end end
-- Upside down slabs -- Upside down slabs
if p0.y-1 == p1.y then if p0.y-1 == p1.y then
-- Turn into full block if pointing at a existing slab -- Turn into full block if pointing at a existing slab
@ -203,17 +203,17 @@ function snow_stairs.register_slab(subname, recipeitem, groups, images, descript
return minetest.item_place(itemstack, placer, pointed_thing, param2) return minetest.item_place(itemstack, placer, pointed_thing, param2)
end, end,
on_construct = function(pos) on_construct = function(pos)
pos.y = pos.y - 1 pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass" if minetest.get_node(pos).name == "default:dirt_with_grass"
-- Thinking in terms of layers, dirt_with_snow could also double as -- 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 -- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
or minetest.get_node(pos).name == "default:dirt" then or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"}) minetest.set_node(pos, {name="default:dirt_with_snow"})
end end
end end
}) })
--[[ --[[
-- for replace ABM -- for replace ABM
@ -296,7 +296,7 @@ for _, row in ipairs(list_of_snow_stuff) do
true true
) )
end -- End the "list of snow stuff" part of the above section. ~ LazyJ end -- End the "list of snow stuff" part of the above section. ~ LazyJ
-- Snow stairs and slabs should be easier to break than the more dense and -- Snow stairs and slabs should be easier to break than the more dense and

View File

@ -48,11 +48,11 @@ minetest.register_craft({
-- 2. Cooking -- 2. Cooking
--[[ --[[
"Cooks_into_ice" is a custom group I assigned to full-sized, snow-stuff nodes "Cooks_into_ice" is a custom group I assigned to full-sized, snow-stuff nodes
(snow bricks, snow cobble, snow blocks, etc.) so I wouldn't have to write an individual cooking (snow bricks, snow cobble, snow blocks, etc.) so I wouldn't have to write an individual cooking
recipe for each one. recipe for each one.
~ LazyJ ~ LazyJ
--]] --]]
minetest.register_craft({ minetest.register_craft({

View File

@ -158,7 +158,7 @@ local function snow_fall(pos, player, animate)
end end
pos = {x=pos.x, y=ground_y, z=pos.z} pos = {x=pos.x, y=ground_y, z=pos.z}
if get_snow(pos) then if get_snow(pos) then
if animate then if animate then
local spos = {x=pos.x, y=ground_y+10, z=pos.z} local spos = {x=pos.x, y=ground_y+10, z=pos.z}
@ -213,7 +213,7 @@ local function calc_snowfall()
animate = true animate = true
end end
if math.random(1,5) == 4 then if math.random(1,5) == 4 then
snow_fall( snow_fall(
randpos( randpos(
addvectors(ppos, {x=-20, y=0, z=-20}), addvectors(ppos, {x=-20, y=0, z=-20}),

View File

@ -1,8 +1,8 @@
--[[ --[[
If you want to run PlantLife and mods that depend on it, i.e. MoreTrees, Disable the mapgen by If you want to run PlantLife and mods that depend on it, i.e. MoreTrees, Disable the mapgen by
commenting-out the lines starting with "local mgname = " through "end" (I left a note were to start commenting-out the lines starting with "local mgname = " through "end" (I left a note were to start
and stop) Disabling "Snow's" mapgen allows MoreTrees and PlantLife to do their thing until the and stop) Disabling "Snow's" mapgen allows MoreTrees and PlantLife to do their thing until the
issue is figured out. However, the pine and xmas tree code is still needed for when those issue is figured out. However, the pine and xmas tree code is still needed for when those
saplings grow into trees. --]] saplings grow into trees. --]]
--The *starting* comment looks like this: --[[ --The *starting* comment looks like this: --[[
--The *closing* comment looks like this: --]] --The *closing* comment looks like this: --]]
@ -120,7 +120,7 @@ function snow.voxelmanip_pine(pos,a,data)
local c_pinetree = minetest.get_content_id("default:pinetree") local c_pinetree = minetest.get_content_id("default:pinetree")
local c_air = minetest.get_content_id("air") local c_air = minetest.get_content_id("air")
local perlin1 = minetest.get_perlin(112,3, 0.5, 150) local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
for z = -1,1 do for z = -1,1 do
local z = pos.z + z local z = pos.z + z
for x = -1,1 do for x = -1,1 do

View File

@ -41,7 +41,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local z0 = minp.z local z0 = minp.z
local x1 = maxp.x local x1 = maxp.x
local z1 = maxp.z local z1 = maxp.z
local spawn_pine = snow.voxelmanip_pine local spawn_pine = snow.voxelmanip_pine
local smooth = snow.smooth_biomes local smooth = snow.smooth_biomes
@ -125,7 +125,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
if ground_y then if ground_y then
local vi = area:index(x, ground_y, z) local vi = area:index(x, ground_y, z)
if data[vi] == c_leaves or data[vi] == c_jungleleaves then if data[vi] == c_leaves or data[vi] == c_jungleleaves then
for y = ground_y, -16, -1 do for y = ground_y, -16, -1 do
local vi = area:index(x, y, z) local vi = area:index(x, y, z)
local id = data[vi] local id = data[vi]
@ -141,9 +141,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end end
end end
end end
end end
end end
elseif in_biome then elseif in_biome then
write_to_map = true write_to_map = true
local icetype = nvals_ice[ni] local icetype = nvals_ice[ni]
@ -161,7 +161,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
break break
end end
end end
if ground_y then if ground_y then
local node = area:index(x, ground_y, z) local node = area:index(x, ground_y, z)
local abovenode = area:index(x, ground_y+1, z) local abovenode = area:index(x, ground_y+1, z)

View File

@ -55,12 +55,12 @@ minetest.register_biome({
minetest.register_biome({ minetest.register_biome({
name = "snow_biome_sand", name = "snow_biome_sand",
node_top = "default:sand", node_top = "default:sand",
depth_top = 3, depth_top = 3,
node_filler = "default:stone", node_filler = "default:stone",
depth_filler = 0, depth_filler = 0,
height_min = -31000, height_min = -31000,
height_max = 2, height_max = 2,
heat_point = 10.0, heat_point = 10.0,

View File

@ -35,10 +35,10 @@ The Xmas tree needles are registred and defined a farther down in this nodes.lua
~ LazyJ ~ LazyJ
--]] --]]
if snow.christmas_content then if snow.christmas_content then
--Christmas trees --Christmas trees
minetest.override_item("snow:needles", { minetest.override_item("snow:needles", {
drop = { drop = {
max_items = 1, max_items = 1,
@ -61,9 +61,9 @@ if snow.christmas_content then
} }
} }
}) })
end end
--Christmas easter egg --Christmas easter egg
minetest.register_on_mapgen_init( function() minetest.register_on_mapgen_init( function()
if rawget(_G, "skins") then if rawget(_G, "skins") then
@ -75,7 +75,7 @@ end
--[[ --[[
Original, static Xmas lights. Keep so people can "turn off" the Original, static Xmas lights. Keep so people can "turn off" the
animation if it is too much for them. ~ LazyJ animation if it is too much for them. ~ LazyJ
--Decorated Pine leaves --Decorated Pine leaves
@ -179,7 +179,7 @@ minetest.register_node("snow:sapling_pine", {
walkable = false, walkable = false,
groups = {snappy=2,dig_immediate=3}, groups = {snappy=2,dig_immediate=3},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })
@ -266,9 +266,9 @@ minetest.register_node("snow:snow_brick", {
liquidtype = "none", liquidtype = "none",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "facedir", -- Allow blocks to be rotated with the screwdriver or paramtype2 = "facedir", -- Allow blocks to be rotated with the screwdriver or
-- by player position. ~ LazyJ -- by player position. ~ LazyJ
-- I made this a little harder to dig than snow blocks because -- I made this a little harder to dig than snow blocks because
-- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ -- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1}, groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1},
--Let's use the new snow sounds instead of the old grass sounds. ~ LazyJ --Let's use the new snow sounds instead of the old grass sounds. ~ LazyJ
@ -278,7 +278,7 @@ minetest.register_node("snow:snow_brick", {
dug = {name="default_snow_footstep", gain=0.75}, dug = {name="default_snow_footstep", gain=0.75},
place = {name="default_place_node", gain=1.0} place = {name="default_place_node", gain=1.0}
}), }),
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could also -- 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 -- double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = snow_onto_dirt on_construct = snow_onto_dirt
}) })
@ -293,9 +293,9 @@ minetest.register_node("snow:snow_cobble", {
is_ground_content = true, is_ground_content = true,
liquidtype = "none", liquidtype = "none",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = "facedir", paramtype2 = "facedir",
-- I made this a little harder to dig than snow blocks because -- I made this a little harder to dig than snow blocks because
-- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ -- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1}, groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1},
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
@ -304,7 +304,7 @@ minetest.register_node("snow:snow_cobble", {
dug = {name="default_snow_footstep", gain=0.75}, dug = {name="default_snow_footstep", gain=0.75},
place = {name="default_place_node", gain=1.0} place = {name="default_place_node", gain=1.0}
}), }),
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could also -- 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 -- double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = snow_onto_dirt on_construct = snow_onto_dirt
}) })
@ -315,7 +315,7 @@ minetest.register_node("snow:snow_cobble", {
-- This adds code to the existing default ice. ~ LazyJ -- This adds code to the existing default ice. ~ LazyJ
minetest.override_item("default:ice", { minetest.override_item("default:ice", {
-- The Lines: 1. Alpah to make semi-transparent ice, 2 to work with -- The Lines: 1. Alpah to make semi-transparent ice, 2 to work with
-- the dirt_with_grass/snow/just dirt ABMs. ~ LazyJ, 2014_03_09 -- the dirt_with_grass/snow/just dirt ABMs. ~ LazyJ, 2014_03_09
use_texture_alpha = true, -- 1 use_texture_alpha = true, -- 1
param2 = 0, param2 = 0,
@ -346,6 +346,6 @@ minetest.override_item("default:snowblock", {
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=1, icemaker=1, cooks_into_ice=1, falling_node=1}, groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=1, icemaker=1, cooks_into_ice=1, falling_node=1},
--drop = "snow:snow_cobble", --drop = "snow:snow_cobble",
on_construct = snow_onto_dirt on_construct = snow_onto_dirt
-- Thinking in terms of layers, dirt_with_snow could also double as -- 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 -- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
}) })

View File

@ -15,9 +15,9 @@ THE LIST OF CHANGES I'VE MADE
* The HUD message that displayed when a player sat on the sled would not go away after the player * The HUD message that displayed when a player sat on the sled would not go away after the player
got off the sled. I spent hours on trial-and-error while reading the lua_api.txt and scrounging got off the sled. I spent hours on trial-and-error while reading the lua_api.txt and scrounging
the Internet for a needle-in-the-haystack solution as to why the hud_remove wasn't working. the Internet for a needle-in-the-haystack solution as to why the hud_remove wasn't working.
Turns out Splizard's code was mostly correct, just not assembled in the right order. Turns out Splizard's code was mostly correct, just not assembled in the right order.
The key to the solution was found in the code of leetelate's scuba mod: The key to the solution was found in the code of leetelate's scuba mod:
@ -30,13 +30,13 @@ http://forum.minetest.net/viewtopic.php?id=7175
TODO TODO
~~~~~~ ~~~~~~
* Figure out why the player avatars remain in a seated position, even after getting off the sled, * Figure out why the player avatars remain in a seated position, even after getting off the sled,
if they flew while on the sled. 'default.player_set_animation', where is a better explanation if they flew while on the sled. 'default.player_set_animation', where is a better explanation
for this and what are it's available options? for this and what are it's available options?
* Go through, clean-up my notes and get them better sorted. Some are in the code, some are * Go through, clean-up my notes and get them better sorted. Some are in the code, some are
scattered in my note-taking program. This "Oh, I'll just make a little tweak here and a scattered in my note-taking program. This "Oh, I'll just make a little tweak here and a
little tweak there" project has evolved into something much bigger and more complex little tweak there" project has evolved into something much bigger and more complex
than I originally planned. :p ~ LazyJ than I originally planned. :p ~ LazyJ
@ -68,7 +68,7 @@ local sled = {
mesh = "sled.x", mesh = "sled.x",
textures = {"sled.png"}, textures = {"sled.png"},
nil, nil,
driver = nil, driver = nil,
sliding = false, sliding = false,
} }
@ -87,7 +87,7 @@ function sled:on_rightclick(clicker)
gravity = 1 gravity = 1
}) })
--[[ --[[
local HUD = local HUD =
{ {
hud_elem_type = "text", -- see HUD element types hud_elem_type = "text", -- see HUD element types
position = {x=0.5, y=0.89}, position = {x=0.5, y=0.89},
@ -96,7 +96,7 @@ function sled:on_rightclick(clicker)
text = "You are sledding, hold sneak to stop.", text = "You are sledding, hold sneak to stop.",
direction = 0, direction = 0,
} }
clicker:hud_add(HUD) clicker:hud_add(HUD)
--]] --]]
@ -109,7 +109,7 @@ function sled:on_rightclick(clicker)
text = "You are on the sled! Press the sneak key to get off the sled.", -- LazyJ text = "You are on the sled! Press the sneak key to get off the sled.", -- LazyJ
direction = 0, direction = 0,
}) })
-- End part 1 -- End part 1
end end
end end
@ -190,7 +190,7 @@ minetest.register_craftitem("snow:sled", {
wield_scale = {x=2, y=2, z=1}, wield_scale = {x=2, y=2, z=1},
liquids_pointable = true, liquids_pointable = true,
stack_max = 1, stack_max = 1,
on_use = function(itemstack, placer) on_use = function(itemstack, placer)
if players_sled[placer:get_player_name()] then if players_sled[placer:get_player_name()] then
return return

View File

@ -3,7 +3,7 @@
--============ --============
-- Snowballs were destroying nodes if the snowballs landed just right. -- Snowballs were destroying nodes if the snowballs landed just right.
-- Quite a bit of trial-and-error learning here and it boiled down to a -- Quite a bit of trial-and-error learning here and it boiled down to a
-- small handful of code lines making the difference. ~ LazyJ -- small handful of code lines making the difference. ~ LazyJ
local snowball_GRAVITY=9 local snowball_GRAVITY=9
@ -47,20 +47,20 @@ snow_snowball_ENTITY.on_step = function(self, dtime)
local findwhatisabove = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name local findwhatisabove = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
-- If the node above is air, then it's OK to go on to the next step. ~ LazyJ, 2014_04_08 -- If the node above is air, then it's OK to go on to the next step. ~ LazyJ, 2014_04_08
if findwhatisabove == "air" then if findwhatisabove == "air" then
-- If the node where the snow is going is anything except air, then it's OK to put -- If the node where the snow is going is anything except air, then it's OK to put
-- the snow on it. ~ Original line of code by Splizard, comment by LazyJ so I can -- the snow on it. ~ Original line of code by Splizard, comment by LazyJ so I can
-- keep track of what this code does. ~ LazyJ, 2014_04_07 -- keep track of what this code does. ~ LazyJ, 2014_04_07
if node.name ~= "air" then if node.name ~= "air" then
snow.place(pos) -- this is the original code, I replaced it with snow.place(pos) -- this is the original code, I replaced it with
-- minetest.place_node and bumped the y position up by 2 (make the snow drop -- minetest.place_node and bumped the y position up by 2 (make the snow drop
-- from a node above and pile up). ~ LazyJ, 2014_04_07 -- from a node above and pile up). ~ LazyJ, 2014_04_07
--minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"}) --minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"})
self.object:remove() self.object:remove()
end end
else -- If findwhatisabove is not equal to "air" then cancel the snowball else -- If findwhatisabove is not equal to "air" then cancel the snowball
-- with self.object:remove() ~ LazyJ, 2014_04_08 -- with self.object:remove() ~ LazyJ, 2014_04_08
self.object:remove() self.object:remove()
end end
end end
self.lastpos = vector.new(pos) self.lastpos = vector.new(pos)
end end
@ -73,8 +73,8 @@ minetest.register_entity("snow:snowball_entity", snow_snowball_ENTITY)
-- Snowball and Default Snowball Merged -- Snowball and Default Snowball Merged
-- They both look the same, they do basically the same thing (except one is a leftclick throw -- They both look the same, they do basically the same thing (except one is a leftclick throw
-- and the other is a rightclick drop),... Why not combine snow:snowball with default:snow and -- and the other is a rightclick drop),... Why not combine snow:snowball with default:snow and
-- benefit from both? ~ LazyJ, 2014_04_08 -- benefit from both? ~ LazyJ, 2014_04_08
--[[ Save this for reference and occasionally compare to the default code for any updates. --[[ Save this for reference and occasionally compare to the default code for any updates.
@ -184,15 +184,15 @@ minetest.override_item("default:snow", {
local under = pointed_thing.under local under = pointed_thing.under
local oldnode_under = minetest.get_node_or_nil(under) local oldnode_under = minetest.get_node_or_nil(under)
local above = pointed_thing.above local above = pointed_thing.above
if not oldnode_under if not oldnode_under
or not above then or not above then
return return
end end
local olddef_under = ItemStack({name=oldnode_under.name}):get_definition() local olddef_under = ItemStack({name=oldnode_under.name}):get_definition()
olddef_under = olddef_under or minetest.nodedef_default olddef_under = olddef_under or minetest.nodedef_default
local place_to local place_to
-- If node under is buildable_to, place into it instead (eg. snow) -- If node under is buildable_to, place into it instead (eg. snow)
if olddef_under.buildable_to then if olddef_under.buildable_to then
@ -201,24 +201,24 @@ minetest.override_item("default:snow", {
-- Place above pointed node -- Place above pointed node
place_to = above place_to = above
end end
local level = minetest.get_node_level(place_to) local level = minetest.get_node_level(place_to)
if level == 63 then if level == 63 then
minetest.set_node(place_to, {name="default:snowblock"}) minetest.set_node(place_to, {name="default:snowblock"})
else else
minetest.set_node_level(place_to, level+7) minetest.set_node_level(place_to, level+7)
end end
if minetest.get_node(place_to).name ~= "default:snow" then if minetest.get_node(place_to).name ~= "default:snow" then
local itemstack, placed = minetest.item_place_node(itemstack, placer, pointed_thing) local itemstack, placed = minetest.item_place_node(itemstack, placer, pointed_thing)
return itemstack, placed return itemstack, placed
end end
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end, end,
on_use = snow_shoot_snowball -- This line is from the 'Snow' mod, on_use = snow_shoot_snowball -- This line is from the 'Snow' mod,
-- the reset is default Minetest. ~ LazyJ -- the reset is default Minetest. ~ LazyJ
}) })
@ -231,16 +231,16 @@ On servers where buckets are disabled, snow and ice stuff is used to set water f
water stuff like fountains, pools, ponds, ect.. It is a common practice to set a default torch on water stuff like fountains, pools, ponds, ect.. It is a common practice to set a default torch on
the snow placed where the players want water to be. the snow placed where the players want water to be.
If you place a default torch *on* default snow to melt it, instead of melting the snow is If you place a default torch *on* default snow to melt it, instead of melting the snow is
*replaced* by the torch. Using "buildable_to = false" would fix this but then the snow would no *replaced* by the torch. Using "buildable_to = false" would fix this but then the snow would no
longer pile-up in layers; the snow would stack like thin shelves in a vertical column. longer pile-up in layers; the snow would stack like thin shelves in a vertical column.
I tinkered with the default torch's code (see below) to check for snow at the position and one I tinkered with the default torch's code (see below) to check for snow at the position and one
node above (layered snow logs as the next y position above) but default snow's node above (layered snow logs as the next y position above) but default snow's
"buildable_to = true" always happened first. An interesting exercise to better learn how Minetest "buildable_to = true" always happened first. An interesting exercise to better learn how Minetest
works, but otherwise not worth it. If you set a regular torch near snow, the snow will melt works, but otherwise not worth it. If you set a regular torch near snow, the snow will melt
and disappear leaving you with nearly the same end result anyway. I say "nearly the same" and disappear leaving you with nearly the same end result anyway. I say "nearly the same"
because if you set a default torch on layered snow, the torch will replace the snow and be because if you set a default torch on layered snow, the torch will replace the snow and be
lit on the ground. If you were able to set a default torch *on* layered snow, the snow would lit on the ground. If you were able to set a default torch *on* layered snow, the snow would
melt and the torch would become a dropped item. melt and the torch would become a dropped item.
@ -256,7 +256,7 @@ local can_place_torch_on_top = function(pos)
or minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "default:snow" then or minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "default:snow" then
minetest.override_item("default:snow", {buildable_to = false,}) minetest.override_item("default:snow", {buildable_to = false,})
end end
end end
--]] --]]

View File

@ -47,7 +47,7 @@ There is one in each of the "stairsplus.register_all" sections.
-- First, let's run a check to see if MoreBlocks is installed; we're going to need it for the -- 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 -- next section of stairsplus stuff. ~LazyJ
if (minetest.get_modpath("moreblocks")) if (minetest.get_modpath("moreblocks"))
@ -70,7 +70,7 @@ end
-- Leave commented out. Another, possible piece of the puzzle, as to why the placement of -- 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. -- stairsplus nodes aren't recorded in the logs. Shelved till I can concentrate on it again.
-- ~ LazyJ -- ~ LazyJ
@ -134,7 +134,7 @@ end
end end
return itemstack return itemstack
end end
-- Upside down slabs -- Upside down slabs
if p0.y-1 == p1.y then if p0.y-1 == p1.y then
-- Turn into full block if pointing at a existing slab -- Turn into full block if pointing at a existing slab
@ -175,10 +175,10 @@ end
--[[ --[[
Below, in the "groups" line there is a "melts" category. Back in the ABMs lua file, melting 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 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 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 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. a melts value of 2 instead of 1 because they are not full blocks.
~ LazyJ ~ LazyJ
@ -189,26 +189,26 @@ a melts value of 2 instead of 1 because they are not full blocks.
local ndef = minetest.registered_nodes["default:ice"] local ndef = minetest.registered_nodes["default:ice"]
local groups = {} local groups = {}
for k, v in pairs(ndef.groups) do groups[k] = v end for k, v in pairs(ndef.groups) do groups[k] = v end
stairsplus:register_all("moreblocks", "ice", "default:ice", { stairsplus:register_all("moreblocks", "ice", "default:ice", {
description = ndef.description, description = ndef.description,
paramtype2 = "facedir", paramtype2 = "facedir",
-- Added "icemaker=1" in groups. This ties into the freezing -- Added "icemaker=1" in groups. This ties into the freezing
-- function in the ABMs.lua file. ~ LazyJ -- function in the ABMs.lua file. ~ LazyJ
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, melts=2, icemaker=1}, groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, melts=2, icemaker=1},
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
tiles = ndef.tiles, tiles = ndef.tiles,
-- Because of the "use_texture_alpha" line, that gives ice transparency, I couldn't combine -- 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 -- default ice and default snowblocks in a list like MoreBlocks does. ~ LazyJ
use_texture_alpha = true, use_texture_alpha = true,
sunlight_propagates = true, sunlight_propagates = true,
-- This "on_place" line makes placing these nodes recorded in the logs. -- This "on_place" line makes placing these nodes recorded in the logs.
-- Useful for investigating griefings and determining ownership -- Useful for investigating griefings and determining ownership
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ -- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
--on_place = minetest.item_place, --on_place = minetest.item_place,
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could -- 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 -- also double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos) on_construct = function(pos)
pos.y = pos.y - 1 pos.y = pos.y - 1
@ -224,11 +224,11 @@ a melts value of 2 instead of 1 because they are not full blocks.
local ndef = minetest.registered_nodes["default:snowblock"] local ndef = minetest.registered_nodes["default:snowblock"]
local groups = {} local groups = {}
for k, v in pairs(ndef.groups) do groups[k] = v end for k, v in pairs(ndef.groups) do groups[k] = v end
stairsplus:register_all("moreblocks", "snowblock", "default:snowblock", { stairsplus:register_all("moreblocks", "snowblock", "default:snowblock", {
description = ndef.description, description = ndef.description,
paramtype2 = "facedir", paramtype2 = "facedir",
-- Added "icemaker=1" in groups. This ties into the freezing function -- Added "icemaker=1" in groups. This ties into the freezing function
-- in the ABMs.lua file. ~ LazyJ -- in the ABMs.lua file. ~ LazyJ
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=2, icemaker=1}, groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=2, icemaker=1},
tiles = ndef.tiles, tiles = ndef.tiles,
@ -244,8 +244,8 @@ a melts value of 2 instead of 1 because they are not full blocks.
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ -- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
--on_place = minetest.item_place, --on_place = minetest.item_place,
-- The "on_construct" part below, thinking in terms of layers, -- The "on_construct" part below, thinking in terms of layers,
-- dirt_with_snow could also double as dirt_with_frost -- dirt_with_snow could also double as dirt_with_frost
-- which adds subtlety to the winterscape. ~ LazyJ -- which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos) on_construct = function(pos)
@ -313,7 +313,7 @@ for _, name in pairs(snow_nodes) do
-- Picking up were we left off... ~ LazyJ -- Picking up were we left off... ~ LazyJ
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could -- 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 -- also double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos) on_construct = function(pos)
pos.y = pos.y - 1 pos.y = pos.y - 1
@ -336,7 +336,7 @@ for _, name in pairs(snow_nodes) do
}) })
end end
else -- from clear up at the top, the MoreBlocks check. "Else", if MoreBlocks wasn't found, skip else -- 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 -- down to here, "return" nothing and "end" this script. ~ LazyJ
return return
end end