commit
caf683fb29
68 changed files with 4247 additions and 0 deletions
@ -0,0 +1,74 @@
|
||||
This version of 'Snow' is based off of Splizard's 2013_12_25 release. |
||||
|
||||
I started out making a couple tweaks here-and-there and then it just |
||||
progressed into something more complex. Since then several things have been |
||||
fixed and a few others added. |
||||
|
||||
There is still more to do. |
||||
|
||||
What follows below is a partial and very rough draft of the README.txt file's |
||||
contents. I still have to get my scattered notes sorted to make a better |
||||
documentation. If things get too wordy, I'll try splitting them off |
||||
into seperate files and see if that makes things easier to consume and maintain. |
||||
|
||||
~ LazyJ, 2014_06_01 |
||||
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ |
||||
List of Changes |
||||
~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
INIT.LUA |
||||
* Moved contents to separate lua files |
||||
* Checks for "MoreBlocks" mod |
||||
|
||||
|
||||
|
||||
FALLING_SNOW.LUA |
||||
* Falling snow would destroy nodes it deposited snow on. I figured out |
||||
that if I switched the 'snow.place' with 'minetest.place_node' and |
||||
increased the y position by 2, then the nodes were nolonger destroyed and |
||||
the snow would start to pile up. |
||||
|
||||
|
||||
|
||||
MAPGEN.LUA |
||||
* Replaced snow:snow with default:snow and snow:snow_block |
||||
with default:snowblock. |
||||
|
||||
|
||||
|
||||
SLED.LUA |
||||
* 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 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 assembled in the wrong order. |
||||
|
||||
The key to the solution was found in the code of leetelate's scuba mod: |
||||
http://forum.minetest.net/viewtopic.php?id=7175 |
||||
|
||||
* Changed the wording of the HUD message for clarity. |
||||
|
||||
|
||||
|
||||
~~~~~~ |
||||
TODO |
||||
~~~~~~ |
||||
|
||||
Falling Snow: |
||||
* Add code to prevent snowfall from depositing snow on or near torches and lava. |
||||
|
||||
* Add code to prevent snowfall from depositing snow on |
||||
'walkable = false' defined nodes. |
||||
|
||||
|
||||
|
||||
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 for this and what |
||||
are it's available options? |
||||
|
||||
|
@ -0,0 +1,175 @@
|
||||
--Backwards Compatability. |
||||
minetest.register_abm({ |
||||
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"}, |
||||
interval = 1, |
||||
chance = 1, |
||||
action = function(pos, node, active_object_count, active_object_count_wider) |
||||
local level = 7*(tonumber(node.name:sub(-1))) |
||||
minetest.add_node(pos,{name="default:snow"}) |
||||
minetest.set_node_level(pos, level) |
||||
end, |
||||
}) |
||||
|
||||
|
||||
|
||||
-- Added to change dirt_with_snow to dirt if covered with blocks that don't let light through (sunlight_propagates) or have a light paramtype and liquidtype combination. ~ LazyJ, 2014_03_08 |
||||
|
||||
minetest.register_abm({ |
||||
nodenames = {"default:dirt_with_snow"}, |
||||
interval = 2, |
||||
chance = 20, |
||||
action = function(pos, node) |
||||
local above = {x=pos.x, y=pos.y+1, z=pos.z} |
||||
local name = minetest.get_node(above).name |
||||
local nodedef = minetest.registered_nodes[name] |
||||
if name ~= "ignore" and nodedef |
||||
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light") |
||||
and nodedef.liquidtype == "none") then |
||||
minetest.set_node(pos, {name = "default:dirt"}) |
||||
end |
||||
end |
||||
}) |
||||
|
||||
|
||||
|
||||
--Melting |
||||
--Any node part of the group melting will melt when near warm nodes such as lava, fire, torches, etc. |
||||
--The amount of water that replaces the node is defined by the number on the group: |
||||
--1: one water_source |
||||
--2: four water_flowings |
||||
--3: one water_flowing |
||||
|
||||
minetest.register_abm({ |
||||
nodenames = {"group:melts"}, |
||||
neighbors = {"group:igniter","default:torch","default:furnace_active","group:hot"}, |
||||
interval = 2, |
||||
chance = 2, |
||||
action = function(pos, node, active_object_count, active_object_count_wider) |
||||
local intensity = minetest.get_item_group(node.name,"melts") |
||||
if intensity == 1 then |
||||
minetest.add_node(pos,{name="default:water_source"}) |
||||
elseif intensity == 2 then |
||||
--[[ 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 |
||||
air. This way it made a watery mess that quickly evaporated. ~ LazyJ 2014_04_24 |
||||
local check_place = function(pos,node) |
||||
if minetest.get_node(pos).name == "air" then |
||||
minetest.place_node(pos,node) |
||||
end |
||||
end |
||||
minetest.add_node(pos,{name="default:water_flowing"}) |
||||
check_place({x=pos.x+1,y=pos.y,z=pos.z},{name="default:water_flowing"}) |
||||
check_place({x=pos.x-1,y=pos.y,z=pos.z},{name="default:water_flowing"}) |
||||
check_place({x=pos.x,y=pos.y+1,z=pos.z},{name="default:water_flowing"}) |
||||
check_place({x=pos.x,y=pos.y-1,z=pos.z},{name="default:water_flowing"}) |
||||
elseif intensity == 3 then |
||||
--]] |
||||
minetest.add_node(pos,{name="default:water_source"}) |
||||
minetest.after(2, function() -- 2 seconds gives just enough time for |
||||
-- the water to flow and spread before the |
||||
-- water_source is changed to air. ~ LazyJ |
||||
if minetest.get_node(pos).name == "default:water_source" then |
||||
minetest.add_node(pos,{name="air"}) |
||||
end |
||||
end) |
||||
end |
||||
nodeupdate(pos) |
||||
end, |
||||
}) |
||||
|
||||
|
||||
|
||||
|
||||
--Freezing |
||||
--Water freezes when in contact with snow. |
||||
minetest.register_abm({ |
||||
nodenames = {"default:water_source"}, |
||||
-- Added "group:icemaker" and snowbrick. ~ LazyJ |
||||
neighbors = {"default:snow", "default:snowblock", "snow:snow_brick", "group:icemaker"}, |
||||
interval = 20, |
||||
chance = 4, |
||||
action = function(pos, node, active_object_count, active_object_count_wider) |
||||
minetest.add_node(pos,{name="default:ice"}) |
||||
end, |
||||
}) |
||||
|
||||
|
||||
|
||||
--Spread moss to cobble. |
||||
minetest.register_abm({ |
||||
nodenames = {"default:cobble"}, |
||||
neighbors = {"snow:moss"}, |
||||
interval = 20, |
||||
chance = 6, |
||||
action = function(pos, node, active_object_count, active_object_count_wider) |
||||
minetest.add_node(pos,{name="default:mossycobble"}) |
||||
end, |
||||
}) |
||||
|
||||
|
||||
|
||||
|
||||
--Grow Pine Saplings |
||||
minetest.register_abm({ |
||||
nodenames = {"snow:sapling_pine"}, |
||||
interval = 10, |
||||
chance = 50, |
||||
action = function(pos, node, active_object_count, active_object_count_wider) |
||||
|
||||
-- Check if there is enough vertical-space for the sapling to grow without |
||||
-- hitting anything else. ~ LazyJ, 2014_04_10 |
||||
|
||||
if -- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ |
||||
minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+3, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+4, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+5, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+6, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+7, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+8, z=pos.z}).name == "air" |
||||
then -- 'then' let the sapling grow into a tree. ~ LazyJ |
||||
|
||||
snow.make_pine(pos,false) |
||||
-- This finds the sapling under the grown tree. ~ LazyJ |
||||
if minetest.get_node({x = pos.x, y = pos.y, z = pos.z}).name == "snow:sapling_pine" then |
||||
-- This switches the sapling to a tree trunk. ~ LazyJ |
||||
minetest.set_node(pos, {name="default:tree"}) |
||||
-- This is more for testing but it may be useful info to some admins when |
||||
-- grepping the server logs too. ~ LazyJ |
||||
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos)) |
||||
end |
||||
else |
||||
end |
||||
end |
||||
}) |
||||
|
||||
|
||||
|
||||
|
||||
--Grow Christmas Tree Saplings |
||||
minetest.register_abm({ |
||||
nodenames = {"snow:xmas_tree"}, |
||||
interval = 10, |
||||
chance = 50, |
||||
action = function(pos, node, active_object_count, active_object_count_wider) |
||||
|
||||
if -- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ |
||||
minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+3, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+4, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+5, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+6, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+7, z=pos.z}).name == "air" and |
||||
minetest.get_node({x=pos.x, y=pos.y+8, z=pos.z}).name == "air" |
||||
then -- 'then' let the sapling grow into a tree. ~ LazyJ |
||||
|
||||
snow.make_pine(pos,false,true) |
||||
minetest.log("action", "A pine sapling grows into a Christmas tree at "..minetest.pos_to_string(pos)) -- ~ LazyJ |
||||
else -- 'Else', if there isn't air in each of the 8 nodes above the sapling, |
||||
-- then don't anything; including not allowing the sapling to grow. |
||||
-- ~ LazyJ, 2014_04_10 |
||||
end |
||||
end |
||||
}) |
@ -0,0 +1,106 @@
|
||||
-- Some aliases for compatibility switches and some to make "/give" commands a little easier |
||||
|
||||
minetest.register_alias("snow:snow", "default:snow") |
||||
minetest.register_alias("default_snow", "default:snow") |
||||
minetest.register_alias("snow:snowball", "default:snow") |
||||
minetest.register_alias("snowball", "default:snow") |
||||
minetest.register_alias("snowballs", "default:snow") |
||||
minetest.register_alias("snow_ball", "default:snow") |
||||
minetest.register_alias("snow:ice", "default:ice") |
||||
minetest.register_alias("ice", "default:ice") |
||||
minetest.register_alias("default_ice", "default:ice") |
||||
minetest.register_alias("snow:dirt_with_snow", "default:dirt_with_snow") |
||||
minetest.register_alias("dirtwithsnow", "default:dirt_with_snow") |
||||
minetest.register_alias("snowdirt", "default:dirt_with_snow") |
||||
minetest.register_alias("snowydirt", "default:dirt_with_snow") |
||||
minetest.register_alias("snow:snow_block", "default:snowblock") |
||||
minetest.register_alias("default:snow_block", "default:snowblock") |
||||
--minetest.register_alias("snow_block", "default:snowblock") |
||||
minetest.register_alias("snowblocks", "default:snowblock") |
||||
minetest.register_alias("snowbrick", "snow:snow_brick") |
||||
minetest.register_alias("bricksnow", "snow:snow_brick") |
||||
minetest.register_alias("snowbricks", "snow:snow_brick") |
||||
--minetest.register_alias("snow_brick", "snow:snow_brick") |
||||
--minetest.register_alias("snow_bricks", "snow:snow_brick") |
||||
minetest.register_alias("snowybricks", "snow:snow_brick") |
||||
minetest.register_alias("snowcobble", "snow:snow_cobble") |
||||
--minetest.register_alias("snow_cobble", "snow:snow_cobble") |
||||
minetest.register_alias("snowycobble", "snow:snow_cobble") |
||||
minetest.register_alias("cobblesnow", "snow:snow_cobble") |
||||
|
||||
|
||||
-- To clean up my first stairsplus attempt. |
||||
-- Stair |
||||
minetest.register_alias(":default:stair_snowblock", "moreblocks:stair_snowblock") |
||||
minetest.register_alias(":default:stair_snowblock_half", "moreblocks:stair_snowblock_half") |
||||
minetest.register_alias(":default:stair_snowblock_right_half", "moreblocks:stair_snowblock_right_half") |
||||
minetest.register_alias(":default:stair_snowblock_inner", "moreblocks:stair_snowblock_inner") |
||||
minetest.register_alias(":default:stair_snowblock_outer", "moreblocks:stair_snowblock_outer") |
||||
minetest.register_alias(":default:stair_snowblock_alt", "moreblocks:stair_snowblock_alt") |
||||
minetest.register_alias(":default:stair_snowblock_alt_1", "moreblocks:stair_snowblock_alt_1") |
||||
minetest.register_alias(":default:stair_snowblock_alt_2", "moreblocks:stair_snowblock_2") |
||||
minetest.register_alias(":default:stair_snowblock_alt_4", "moreblocks:stair_snowblock_alt_4") |
||||
|
||||
minetest.register_alias(":default:stair_ice", "moreblocks:stair_ice") |
||||
minetest.register_alias(":default:stair_ice_half", "moreblocks:stair_ice_half") |
||||
minetest.register_alias(":default:stair_ice_right_half", "moreblocks:stair_ice_right_half") |
||||
minetest.register_alias(":default:stair_ice_inner", "moreblocks:stair_ice_inner") |
||||
minetest.register_alias(":default:stair_ice_outer", "moreblocks:stair_ice_outer") |
||||
minetest.register_alias(":default:stair_ice_alt", "moreblocks:stair_ice_alt") |
||||
minetest.register_alias(":default:stair_ice_alt_1", "moreblocks:stair_ice_alt_1") |
||||
minetest.register_alias(":default:stair_ice_alt_2", "moreblocks:stair_ice_2") |
||||
minetest.register_alias(":default:stair_ice_alt_4", "moreblocks:stair_ice_alt_4") |
||||
|
||||
|
||||
-- Slab |
||||
minetest.register_alias(":default:slab_snowblock", "moreblocks:slab_snowblock") |
||||
minetest.register_alias(":default:slab_snowblock_quarter", "moreblocks:slab_snowblock_quarter") |
||||
minetest.register_alias(":default:slab_snowblock_three_quarter", "moreblocks:slab_snowblock_three_quarter") |
||||
minetest.register_alias(":default:slab_snowblock_1", "moreblocks:slab_snowblock_1") |
||||
minetest.register_alias(":default:slab_snowblock_2", "moreblocks:slab_snowblock_2") |
||||
minetest.register_alias(":default:slab_snowblock_14", "moreblocks:slab_snowblock_14") |
||||
minetest.register_alias(":default:slab_snowblock_15", "moreblocks:slab_snowblock_15") |
||||
|
||||
minetest.register_alias(":default:slab_ice", "moreblocks:slab_ice") |
||||
minetest.register_alias(":default:slab_ice_quarter", "moreblocks:slab_ice_quarter") |
||||
minetest.register_alias(":default:slab_ice_three_quarter", "moreblocks:slab_ice_three_quarter") |
||||
minetest.register_alias(":default:slab_ice_1", "moreblocks:slab_ice_1") |
||||
minetest.register_alias(":default:slab_ice_2", "moreblocks:slab_ice_2") |
||||
minetest.register_alias(":default:slab_ice_14", "moreblocks:slab_ice_14") |
||||
minetest.register_alias(":default:slab_ice_15", "moreblocks:slab_ice_15") |
||||
|
||||
|
||||
-- Panel |
||||
minetest.register_alias(":default:panel_snowblock", "moreblocks:panel_snowblock") |
||||
minetest.register_alias(":default:panel_snowblock_1", "moreblocks:panel_snowblock_1") |
||||
minetest.register_alias(":default:panel_snowblock_2", "moreblocks:panel_snowblock_2") |
||||
minetest.register_alias(":default:panel_snowblock_4", "moreblocks:panel_snowblock_4") |
||||
minetest.register_alias(":default:panel_snowblock_12", "moreblocks:panel_snowblock_12") |
||||
minetest.register_alias(":default:panel_snowblock_14", "moreblocks:panel_snowblock_14") |
||||
minetest.register_alias(":default:panel_snowblock_15", "moreblocks:panel_snowblock_15") |
||||
|
||||
minetest.register_alias(":default:panel_ice", "moreblocks:panel_ice") |
||||
minetest.register_alias(":default:panel_ice_1", "moreblocks:panel_ice_1") |
||||
minetest.register_alias(":default:panel_ice_2", "moreblocks:panel_ice_2") |
||||
minetest.register_alias(":default:panel_ice_4", "moreblocks:panel_ice_4") |
||||
minetest.register_alias(":default:panel_ice_12", "moreblocks:panel_ice_12") |
||||
minetest.register_alias(":default:panel_ice_14", "moreblocks:panel_ice_14") |
||||
minetest.register_alias(":default:panel_ice_15", "moreblocks:panel_ice_15") |
||||
|
||||
|
||||
-- Micro |
||||
minetest.register_alias(":default:micro_snowblock", "moreblocks:micro_snowblock") |
||||
minetest.register_alias(":default:micro_snowblock_1", "moreblocks:micro_snowblock_1") |
||||
minetest.register_alias(":default:micro_snowblock_2", "moreblocks:micro_snowblock_2") |
||||
minetest.register_alias(":default:micro_snowblock_4", "moreblocks:micro_snowblock_4") |
||||
minetest.register_alias(":default:micro_snowblock_12", "moreblocks:micro_snowblock_12") |
||||
minetest.register_alias(":default:micro_snowblock_14", "moreblocks:micro_snowblock_14") |
||||
minetest.register_alias(":default:micro_snowblock_15", "moreblocks:micro_snowblock_15") |
||||
|
||||
minetest.register_alias(":default:micro_ice", "moreblocks:micro_ice") |
||||
minetest.register_alias(":default:micro_ice_1", "moreblocks:micro_ice_1") |
||||
minetest.register_alias(":default:micro_ice_2", "moreblocks:micro_ice_2") |
||||
minetest.register_alias(":default:micro_ice_4", "moreblocks:micro_ice_4") |
||||
minetest.register_alias(":default:micro_ice_12", "moreblocks:micro_ice_12") |
||||
minetest.register_alias(":default:micro_ice_14", "moreblocks:micro_ice_14") |
||||
minetest.register_alias(":default:micro_ice_15", "moreblocks:micro_ice_15") |
@ -0,0 +1,326 @@
|
||||
-- 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 |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
snow_stairs = {} -- This is a little trick. Without it Minetest will complain |
||||
-- "attempt to index global 'snow' (a nil value)" and |
||||
-- refuse to load. So a value without definition "={}"is assigned to snow. |
||||
|
||||
-- Node will be called snow:stair_<subname> |
||||
function snow_stairs.register_stair(subname, recipeitem, groups, images, description, sounds) |
||||
minetest.register_node("snow:stair_" .. subname, { |
||||
description = description, |
||||
drawtype = "nodebox", |
||||
tiles = images, |
||||
paramtype = "light", |
||||
paramtype2 = "facedir", |
||||
is_ground_content = true, |
||||
groups = groups, |
||||
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 |
||||
if minetest.get_node(pos).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 minetest.get_node(pos).name == "default:dirt" then |
||||
minetest.set_node(pos, {name="default:dirt_with_snow"}) |
||||
end |
||||
end |
||||
}) |
||||
--[[ |
||||
-- for replace ABM |
||||
minetest.register_node("snow:stair_" .. subname.."upside_down", { |
||||
replace_name = "snow:stair_" .. subname, |
||||
groups = {slabs_replace=1}, |
||||
}) |
||||
--]] |
||||
minetest.register_craft({ |
||||
output = 'snow:stair_' .. subname .. ' 6', |
||||
recipe = { |
||||
{recipeitem, "", ""}, |
||||
{recipeitem, recipeitem, ""}, |
||||
{recipeitem, recipeitem, recipeitem}, |
||||
}, |
||||
}) |
||||
|
||||
-- Flipped recipe |
||||
minetest.register_craft({ |
||||
output = 'snow:stair_' .. subname .. ' 6', |
||||
recipe = { |
||||
{"", "", recipeitem}, |
||||
{"", recipeitem, recipeitem}, |
||||
{recipeitem, recipeitem, recipeitem}, |
||||
}, |
||||
}) |
||||
end |
||||
|
||||
-- Node will be called snow:slab_<subname> |
||||
function snow_stairs.register_slab(subname, recipeitem, groups, images, description, sounds) |
||||
minetest.register_node("snow:slab_" .. subname, { |
||||
description = description, |
||||
drawtype = "nodebox", |
||||
tiles = images, |
||||
paramtype = "light", |
||||
paramtype2 = "facedir", |
||||
is_ground_content = true, |
||||
groups = groups, |
||||
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}, |
||||
}, |
||||
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, |
||||
|
||||
on_construct = function(pos) |
||||
pos.y = pos.y - 1 |
||||
if minetest.get_node(pos).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 minetest.get_node(pos).name == "default:dirt" then |
||||
minetest.set_node(pos, {name="default:dirt_with_snow"}) |
||||
end |
||||
end |
||||
|
||||
}) |
||||
--[[ |
||||
-- for replace ABM |
||||
minetest.register_node("snow:slab_" .. subname.."upside_down", { |
||||
replace_name = "snow:slab_"..subname, |
||||
groups = {slabs_replace=1}, |
||||
}) |
||||
--]] |
||||
|
||||
minetest.register_craft({ |
||||
output = 'snow:slab_' .. subname .. ' 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> |
||||
function snow_stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, freezemelt, liquidtype, paramtype, sunlight_propagates) |
||||
snow_stairs.register_stair(subname, recipeitem, groups, images, desc_stair, freezemelt, liquidtype, paramtype, sunlight_propagates) |
||||
snow_stairs.register_slab(subname, recipeitem, groups, images, desc_slab, freezemelt, liquidtype, paramtype, sunlight_propagates) |
||||
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", "default_ice.png", "Ice Stairs", "Ice Slabs"}, |
||||
{"snowblock", "default:snowblock", "default_snow.png", "Snowblock Stairs", "Snowblock Slabs"}, |
||||
{"snow_cobble", "snow:snow_cobble", "snow_snow_cobble.png", "Snow Cobble Stairs", "Snow Cobble Slabs"}, |
||||
{"snow_brick", "snow:snow_brick", "snow_snow_brick.png", "Snow Brick Stair", "Snow Brick Slab"}, |
||||
} |
||||
|
||||
for _, row in ipairs(list_of_snow_stuff) do |
||||
local snow_subname = row[1] |
||||
local snow_recipeitem = row[2] |
||||
local snow_images = row[3] |
||||
local snow_desc_stair = row[4] |
||||
local snow_desc_slab = row[5] |
||||
|
||||
|
||||
|
||||
|
||||
snow_stairs.register_stair_and_slab(snow_subname, snow_recipeitem, |
||||
{cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1}, |
||||
{snow_images}, |
||||
snow_desc_stair, |
||||
snow_desc_slab, |
||||
"default:water_source", |
||||
"none", |
||||
"light", |
||||
true |
||||
) |
||||
|
||||
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 |
||||
-- manufactured, other snow-type nodes in the list above. ~ lazyJ |
||||
minetest.override_item("snow:stair_snowblock", { |
||||
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=2, icemaker=1}, |
||||
}) |
||||
|
||||
minetest.override_item("snow:slab_snowblock", { |
||||
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=2, icemaker=1}, |
||||
}) |
||||
|
||||
|
||||
|
||||
-- Everything above is made of snow and uses snow sounds, ice, however, should sound more like glass |
||||
-- and be harder to dig. ~ LazyJ |
||||
minetest.override_item("snow:stair_ice", { |
||||
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, melts=2, icemaker=1}, |
||||
use_texture_alpha = true, |
||||
sounds = default.node_sound_glass_defaults(), |
||||
}) |
||||
|
||||
minetest.override_item("snow:slab_ice", { |
||||
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, melts=2, icemaker=1}, |
||||
use_texture_alpha = true, |
||||
sounds = default.node_sound_glass_defaults(), |
||||
}) |
@ -0,0 +1,18 @@
|
||||
# Whether you are running a legacy minetest version (auto-detected). |
||||
legacy = false |
||||
# Enables falling snow. |
||||
enable_snowfall = false |
||||
# Disable this to stop snow from being smoothed. |
||||
smooth_snow = true |
||||
# Disable this to remove christmas saplings from being found. |
||||
christmas_content = true |
||||
# The minumum height a snow biome will generate. |
||||
min_height = 3 |
||||
# Disable this to prevent sleds from being riden. |
||||
sleds = true |
||||
# Enables debug output. |
||||
debug = false |
||||
# Reduces the amount of resources and fps used by snowfall. |
||||
lighter_snowfall = false |
||||
# Enables smooth transition of biomes |
||||
smooth_biomes = true |
@ -0,0 +1,185 @@
|
||||
--[[ |
||||
|
||||
Crafting Sections (in order, top to bottom): |
||||
1. Fuel |
||||
2. Cooking |
||||
3. Crafting and Recycling |
||||
|
||||
The crafting recipe for the sled is in the sled.lua file. |
||||
|
||||
~ LazyJ |
||||
|
||||
--]] |
||||
|
||||
-- 1. Fuel |
||||
|
||||
minetest.register_craft({ |
||||
type = "fuel", |
||||
recipe = "snow:needles", |
||||
burntime = 1, |
||||
}) |
||||
|
||||
|
||||
|
||||
minetest.register_craft({ |
||||
type = "fuel", |
||||
recipe = "snow:sapling_pine", |
||||
burntime = 10, |
||||
}) |
||||
|
||||
|
||||
|
||||
minetest.register_craft({ |
||||
type = "fuel", |
||||
recipe = "snow:needles_decorated", |
||||
burntime = 1, |
||||
}) |
||||
|
||||
|
||||
|
||||
minetest.register_craft({ |
||||
type = "fuel", |
||||
recipe = "snow:xmas_tree", |
||||
burntime = 10, |
||||
}) |
||||
|
||||
|
||||
|
||||
-- 2. Cooking |
||||
|
||||
--[[ |
||||
"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 |
||||
recipe for each one. |
||||
|
||||
~ LazyJ |
||||
--]] |
||||
|
||||
minetest.register_craft({ |
||||
type = "cooking", |
||||
cooktime = 12, |
||||
output = "default:ice", |
||||
recipe = "group:cooks_into_ice", |
||||
}) |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- 3. Crafting and Recycling |
||||
|
||||
-- Let's make moss craftable so players can more easily create mossycobble and |
||||
-- gives another useful purpose to pine needles. ~ LazyJ |
||||
|
||||
minetest.register_craft({ |
||||
output = 'snow:moss', |
||||
recipe = { |
||||
{'snow:needles', 'snow:needles'}, |
||||
{'snow:needles', 'snow:needles'}, |
||||
}, |
||||
}) |
||||
|
||||
|
||||
--[[ |
||||
Most snow biomes are too small to provide enough snow as a building material and |
||||
still have enough landscape snow to create the wintry surroundings of a |
||||
snow village or castle. So I added this snowblock crafting recipe as a way for |
||||
players to increase their snow supply in small increments. I considered making |
||||
the output 9 but that would make it all too quick and easy (especially for griefers) to create lots |
||||
of snowblocks (and then use them to water-grief by melting the snow blocks). |
||||
|
||||
~ LazyJ |
||||
|
||||
--]] |
||||
|
||||
minetest.register_craft({ |
||||
type = "shapeless", |
||||
output = 'default:snowblock 3', |
||||
recipe = { |
||||
'snow:snow_cobble', |
||||
'snow:snow_cobble' |
||||
} |
||||
}) |
||||
|
||||
|
||||
|
||||
minetest.register_craft({ |
||||
type = "shapeless", |
||||
output = 'default:snowblock 3', |
||||
recipe = { |
||||
'default:snowblock', |
||||
'default:snowblock' |
||||
} |
||||
}) |
||||
|
||||
|
||||
|
||||
minetest.register_craft({ |
||||
output = 'snow:snow_brick', |
||||
recipe = { |
||||
{'default:snowblock', 'default:snowblock'}, |
||||
{'default:snowblock', 'default:snowblock'} |
||||
} |
||||
}) |
||||
|
||||
|
||||
|
||||
-- Why not recycle snow_bricks back into snowblocks? ~ LazyJ |
||||
minetest.register_craft({ |
||||
output = 'default:snowblock 4', |
||||
recipe = { |
||||
{'snow:snow_brick'} |
||||
} |
||||
}) |
||||
|
||||
|
||||
|
||||
-- Recycle basic, half-block, slabs back into full blocks |
||||
|
||||
-- A little "list" magic here. Instead of writing four crafts I only have to write two. ~ LazyJ |
||||
local recycle_default_slabs = { |
||||
"ice", |
||||
"snowblock", |
||||
} |
||||
|
||||
for _, name in pairs(recycle_default_slabs) do |
||||
local subname_default = name |
||||
|
||||
-- This craft is for default snowblocks and default ice. |
||||
-- 1 crafting recipe handles 2, default blocks. ~ LazyJ |
||||
minetest.register_craft({ |
||||
type = "shapeless", |
||||
output = "default:"..subname_default, |
||||
recipe = { |
||||
"snow:slab_"..subname_default, |
||||
"snow:slab_"..subname_default, |
||||
} |
||||
}) |
||||
end |
||||
|
||||
|
||||
|
||||
-- Similar list magic here too. I couldn't successfully combine these in the first list |
||||
-- because we are dealing with slabs/blocks from two different mods, the "Snow" mod and |
||||
-- minetest_game's "Default" mod. ~ LazyJ |
||||
|
||||
local recycle_snowmod_slabs = { |
||||
"snow_brick", |
||||
"snow_cobble", |
||||
} |
||||
|
||||
for _, name in pairs(recycle_snowmod_slabs) do |
||||
local subname_snowmod = name |
||||
|
||||
-- This craft is for the Snow mod's full-sized blocks. |
||||
-- 1 crafting recipe handles 2, or more, Snow mod blocks. ~ LazyJ |
||||
minetest.register_craft({ |
||||
type = "shapeless", |
||||
output = "snow:"..subname_snowmod, |
||||
recipe = { |
||||
"snow:slab_"..subname_snowmod, |
||||
"snow:slab_"..subname_snowmod, |
||||
} |
||||
}) |
||||
end |
@ -0,0 +1,201 @@
|
||||
--[[ |
||||
--================= |
||||
--====================================== |
||||
LazyJ's Fork of Splizard's "Snow" Mod |
||||
by LazyJ |
||||
version: Umpteen and 7/5ths something or another. |
||||
2014_04_12 |
||||
--====================================== |
||||
--================= |
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||||
THE LIST OF CHANGES I'VE MADE |
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
|
||||
* Falling snow would destroy nodes it deposited snow on. I figured out that if |
||||
I switched the 'snow.place' with 'minetest.place_node' and increased the |
||||
y position by 2, then the nodes were nolonger destroyed and the snow |
||||
would start to pile up. |
||||
|
||||
|
||||
|
||||
~~~~~~ |
||||
TODO |
||||
~~~~~~ |
||||
|
||||
* Add code to prevent snowfall from depositing snow on or |
||||
near torches and lava. |
||||
|
||||
* Add code to prevent snowfall from depositing snow on |
||||
'walkable = false' defined nodes. |
||||
|
||||
--]] |
||||
|
||||
|
||||
|
||||
--============================================================= |
||||
-- CODE STUFF |
||||
--============================================================= |
||||
|
||||
|
||||
if snow.enable_snowfall then |
||||
|
||||
local weather_legacy |
||||
|
||||
local read_weather_legacy = function () |
||||
local file = io.open(minetest.get_worldpath().."/weather_v6", "r") |
||||
if not file then return end |
||||
local readweather = file:read() |
||||
file:close() |
||||
return readweather |
||||
end |
||||
|
||||
--Weather for legacy versions of minetest. |
||||
local save_weather_legacy = function () |
||||
local file = io.open(minetest.get_worldpath().."/weather_v6", "w+") |
||||
file:write(weather_legacy) |
||||
file:close() |
||||
end |
||||
|
||||
weather_legacy = read_weather_legacy() or "" |
||||
|
||||
minetest.register_globalstep(function(dtime) |
||||
if weather_legacy == "snow" then |
||||
if math.random(1, 10000) == 1 then |
||||
weather_legacy = "none" |
||||
save_weather_legacy() |
||||
end |
||||
else |
||||
if math.random(1, 50000) == 2 then |
||||
weather_legacy = "snow" |
||||
save_weather_legacy() |
||||
end |
||||
end |
||||
end) |
||||
|
||||
--Get snow at position. |
||||
local get_snow = function(pos) |
||||
--Legacy support. |
||||
if weather_legacy == "snow" then |
||||
local perlin1 = minetest.env:get_perlin(112,3, 0.5, 150) |
||||
if perlin1:get2d( {x=pos.x, y=pos.z} ) > 0.53 then |
||||
return true |
||||
else |
||||
return false |
||||
end |
||||
else |
||||
return false |
||||
end |
||||
end |
||||
|
||||
local addvectors = vector and vector.add |
||||
|
||||
--Returns a random position between minp and maxp. |
||||
local randpos = function (minp, maxp) |
||||
local x,y,z |
||||
if minp.x > maxp.x then |
||||
x = math.random(maxp.x,minp.x) else x = math.random(minp.x,maxp.x) end |
||||
y = minp.y |
||||
if minp.z > maxp.z then |
||||
z = math.random(maxp.z,minp.z) else z = math.random(minp.z,maxp.z) end |
||||
return {x=x,y=y,z=z} |
||||
end |
||||
|
||||
local snow_fall=function (pos, player, animate) |
||||
local ground_y = nil |
||||
for y=pos.y+10,pos.y+20,1 do |
||||
local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name |
||||
if n ~= "air" and n ~= "ignore" then |
||||
return |
||||
end |
||||
end |
||||
for y=pos.y+10,pos.y-15,-1 do |
||||
local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name |
||||
if n ~= "air" and n ~= "ignore" then |
||||
ground_y = y |
||||
break |
||||
end |
||||
end |
||||
if not ground_y then return end |
||||
pos = {x=pos.x, y=ground_y, z=pos.z} |
||||
local spos = {x=pos.x, y=ground_y+10, z=pos.z} |
||||
|
||||
|
||||
if get_snow(pos) then |
||||
if animate then |
||||
local minp = addvectors(spos, {x=-9, y=3, z=-9}) |
||||
local maxp = addvectors(spos, {x= 9, y=5, z= 9}) |
||||
local vel = {x=0, y= -1, z=-1} |
||||
local acc = {x=0, y= 0, z=0} |
||||
minetest.add_particlespawner(3, 0.5, |
||||
minp, maxp, |
||||
vel, vel, |
||||
acc, acc, |
||||
5, 5, |
||||
50, 50, |
||||
false, "weather_snow.png", player:get_player_name()) |
||||
end |
||||
--snow.place(pos, true) |
||||
minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"}) -- LazyJ |
||||
end |
||||
end |
||||
|
||||
-- Snow |
||||
minetest.register_globalstep(function(dtime) |
||||
for _, player in ipairs(minetest.get_connected_players()) do |
||||
local ppos = player:getpos() |
||||
|
||||
local sminp = addvectors(ppos, {x=-20, y=0, z=-20}) |
||||
local smaxp = addvectors(ppos, {x= 20, y=0, z= 20}) |
||||
|
||||
-- Make sure player is not in a cave/house... |
||||
if get_snow(ppos) and minetest.env:get_node_light(ppos, 0.5) == 15 then |
||||
|
||||
local minp = addvectors(ppos, {x=-9, y=3, z=-9}) |
||||
local maxp = addvectors(ppos, {x= 9, y=5, z= 9}) |
||||
|
||||
local minp_deep = addvectors(ppos, {x=-5, y=3.2, z=-5}) |
||||
local maxp_deep = addvectors(ppos, {x= 5, y=1.6, z= 5}) |
||||
|
||||
local vel = {x=0, y= -1, z=-1} |
||||
local acc = {x=0, y= 0, z=0} |
||||
|
||||
if not snow.lighter_snowfall then |
||||
minetest.add_particlespawner(5, 0.5, |
||||
minp, maxp, |
||||
vel, vel, |
||||
acc, acc, |
||||
5, 5, |
||||
25, 25, |
||||
false, "weather_snow.png", player:get_player_name()) |
||||
|
||||
minetest.add_particlespawner(4, 0.5, |
||||
minp_deep, maxp_deep, |
||||
vel, vel, |
||||
acc, acc, |
||||
4, 4, |
||||
25, 25, |
||||
false, "weather_snow.png", player:get_player_name()) |
||||
|
||||
if math.random(1,5) == 4 then |
||||
snow_fall(randpos(sminp, smaxp), player) |
||||
end |
||||
else |
||||
if math.random(1,5) == 4 then |
||||
snow_fall(randpos(sminp, smaxp), player, true) |
||||
end |
||||
end |
||||
|
||||
|
||||
else |
||||
|
||||
if math.random(1,5) == 4 then |
||||
snow_fall(randpos(sminp, smaxp), player, true) |
||||
end |
||||
end |
||||
end |
||||
end) |
||||
|
||||
end |
@ -0,0 +1,127 @@
|
||||
--[[ |
||||
--============================== |
||||
--========================================================== |
||||
LazyJ's Fork of Splizard's "Snow Biomes" Mod |
||||
by LazyJ |
||||
version: Umpteen-hundred and 7/5ths something or another. |
||||
2014_04_12 |
||||
|
||||
~~~ |
||||
|
||||
"Snow Biomes" Mod |
||||
By Splizard |
||||
|
||||
Download: |
||||
http//forum.minetest.net/viewtopic.php?id=2290 |
||||
http://github.com/Splizard/minetest-mod-snow/ |
||||
|
||||
--========================================================== |
||||
--============================== |
||||
|
||||
Snow Biomes |
||||
|
||||
This program is free software; you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation; either version 2 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program; if not, write to the Free Software |
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
||||
MA 02110-1301, USA. |
||||
]]-- |
||||
|
||||
|
||||
|
||||
-- Original Lua Files |
||||
--dofile(minetest.get_modpath("snow").."/util.lua") |
||||
--dofile(minetest.get_modpath("snow").."/mapgen.lua") |
||||
--dofile(minetest.get_modpath("snow").."/sled.lua") |
||||
-- "falling_snow.lua" disabled since weather functions minetest.get_heat(pos) and minetest.get_humidity(pos) |
||||
-- have been removed from Minetest. |
||||
-- Until something else can be figured out, use paramat's "Snowdrift" mod instead. |
||||
-- dofile(minetest.get_modpath("snow").."/falling_snow.lua") |
||||
|
||||
-- Original init.lua File Broken into Smaller Files |
||||
dofile(minetest.get_modpath("snow").."/abms.lua") |
||||
dofile(minetest.get_modpath("snow").."/aliases.lua") |
||||
dofile(minetest.get_modpath("snow").."/basic_stairs_slabs.lua") |
||||
dofile(minetest.get_modpath("snow").."/crafting.lua") |
||||
dofile(minetest.get_modpath("snow").."/snowball.lua") |
||||
|
||||
|
||||
-- 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 |
||||
-- 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 |
||||
dofile(minetest.get_modpath("snow").."/util.lua") |
||||
-- 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 |
||||
dofile(minetest.get_modpath("snow").."/nodes.lua") |
||||
dofile(minetest.get_modpath("snow").."/mapgen.lua") |
||||
dofile(minetest.get_modpath("snow").."/sled.lua") |
||||
dofile(minetest.get_modpath("snow").."/falling_snow.lua") |
||||
|
||||
|
||||
|
||||
-- Check for "MoreBlocks". If not found, skip this next "dofile". |
||||
|
||||
if (minetest.get_modpath("moreblocks")) then |
||||
|
||||
dofile(minetest.get_modpath("snow").."/stairsplus.lua") |
||||
|
||||
else |
||||
end |
||||
|
||||
|
||||
|
||||
-- Checks if the snow level is even at any given pos. |
||||
-- Smooth Snow |
||||
local smooth_snow = snow.smooth_snow |
||||
snow.is_uneven = function(pos) |
||||
if smooth_snow then |
||||
local num = minetest.get_node_level(pos) |
||||
local get_node = minetest.get_node |
||||
local add_node = minetest.add_node |
||||
local found |
||||
local foundx |
||||
local foundy |
||||
for x=-1,1 do |
||||
for z=-1,1 do |
||||
local node = get_node({x=pos.x+x,y=pos.y,z=pos.z+z}) |
||||
local bnode = get_node({x=pos.x+x,y=pos.y-1,z=pos.z+z}) |
||||
local drawtype = minetest.registered_nodes[node.name].drawtype |
||||
|
||||
if drawtype == "plantlike" then |
||||
if bnode.name == "default:dirt_with_grass" then |
||||
add_node({x=pos.x+x,y=pos.y-1,z=pos.z+z}, {name="default:dirt_with_snow"}) |
||||
return true |
||||
end |
||||
end |
||||
|
||||
if (not(x == 0 and y == 0)) and node.name == "default:snow" and minetest.get_node_level({x=pos.x+x,y=pos.y,z=pos.z+z}) < num then |
||||
found = true |
||||
foundx = x |
||||
foundz=z |
||||
elseif node.name == "air" and bnode.name ~= "air" then |
||||
if not (bnode.name == "default:snow") then |
||||
snow.place({x=pos.x+x,y=pos.y-1,z=pos.z+z}) |
||||
return true |
||||
end |
||||
end |
||||
end |
||||
end |
||||
if found then |
||||
local node = get_node({x=pos.x+foundx,y=pos.y,z=pos.z+foundz}) |
||||
if snow.is_uneven({x=pos.x+foundx,y=pos.y,z=pos.z+foundz}) ~= true then |
||||
minetest.add_node_level({x=pos.x+foundx,y=pos.y,z=pos.z+foundz}, 7) |
||||
end |
||||
return true |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE |
||||
Version 3, 29 June 2007 |
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
||||
Everyone is permitted to copy and distribute verbatim copies |
||||
of this license document, but changing it is not allowed. |
||||
|
||||
Preamble |
||||
|
||||
The GNU General Public License is a free, copyleft license for |
||||
software and other kinds of works. |
||||
|
||||
The licenses for most software and other practical works are designed |
||||
to take away your freedom to share and change the works. By contrast, |
||||
the GNU General Public License is intended to guarantee your freedom to |
||||
share and change all versions of a program--to make sure it remains free |
||||
software for all its users. We, the Free Software Foundation, use the |
||||
GNU General Public License for most of our software; it applies also to |
||||
any other work released this way by its authors. You can apply it to |
||||
your programs, too. |
||||
|
||||
When we speak of free software, we are referring to freedom, not |
||||
price. Our General Public Licenses are designed to make sure that you |
||||
have the freedom to distribute copies of free software (and charge for |
||||
them if you wish), that you receive source code or can get it if you |
||||
want it, that you can change the software or use pieces of it in new |
||||
free programs, and that you know you can do these things. |
||||
|
||||
To protect your rights, we need to prevent others from denying you |
||||
these rights or asking you to surrender the rights. Therefore, you have |
||||
certain responsibilities if you distribute copies of the software, or if |
||||
you modify it: responsibilities to respect the freedom of others. |
||||
|
||||
For example, if you distribute copies of such a program, whether |
||||
gratis or for a fee, you must pass on to the recipients the same |
||||
freedoms that you received. You must make sure that they, too, receive |
||||
or can get the source code. And you must show them these terms so they |
||||
know their rights. |
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: |
||||
(1) assert copyright on the software, and (2) offer you this License |
||||
giving you legal permission to copy, distribute and/or modify it. |
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains |
||||
that there is no warranty for this free software. For both users' and |
||||
authors' sake, the GPL requires that modified versions be marked as |
||||
changed, so that their problems will not be attributed erroneously to |
||||
authors of previous versions. |
||||
|
||||
Some devices are designed to deny users access to install or run |
||||
modified versions of the software inside them, although the manufacturer |
||||
can do so. This is fundamentally incompatible with the aim of |
||||
protecting users' freedom to change the software. The systematic |
||||
pattern of such abuse occurs in the area of products for individuals to |
||||
use, which is precisely where it is most unacceptable. Therefore, we |
||||
have designed this version of the GPL to prohibit the practice for those |
||||
products. If such problems arise substantially in other domains, we |
||||
stand ready to extend this provision to those domains in future versions |
||||
of the GPL, as needed to protect the freedom of users. |
||||
|
||||
Finally, every program is threatened constantly by software patents. |
||||
States should not allow patents to restrict development and use of |
||||
software on general-purpose computers, but in those that do, we wish to |
||||
avoid the special danger that patents applied to a free program could |
||||
make it effectively proprietary. To prevent this, the GPL assures that |
||||
patents cannot be used to render the program non-free. |
||||
|
||||
The precise terms and conditions for copying, distribution and |
||||
modification follow. |
||||
|
||||
TERMS AND CONDITIONS |
||||
|
||||
0. Definitions. |
||||
|
||||
"This License" refers to version 3 of the GNU General Public License. |
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of |
||||
works, such as semiconductor masks. |
||||
|
||||
"The Program" refers to any copyrightable work licensed under this |
||||
License. Each licensee is addressed as "you". "Licensees" and |
||||
"recipients" may be individuals or organizations. |
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work |
||||
in a fashion requiring copyright permission, other than the making of an |
||||
exact copy. The resulting work is called a "modified version" of the |
||||
earlier work or a work "based on" the earlier work. |
||||
|
||||
A "covered work" means either the unmodified Program or a work based |
||||
on the Program. |
||||
|
||||
To "propagate" a work means to do anything with it that, without |
||||
permission, would make you directly or secondarily liable for |
||||
infringement under applicable copyright law, except executing it on a |
||||
computer or modifying a private copy. Propagation includes copying, |
||||
distribution (with or without modification), making available to the |
||||
public, and in some countries other activities as well. |
||||
|
||||
To "convey" a work means any kind of propagation that enables other |
||||
parties to make or receive copies. Mere interaction with a user through |
||||
a computer network, with no transfer of a copy, is not conveying. |
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" |
||||
to the extent that it includes a convenient and prominently visible |
||||
feature that (1) displays an appropriate copyright notice, and (2) |
||||
tells the user that there is no warranty for the work (except to the |
||||
extent that warranties are provided), that licensees may convey the |
||||
work under this License, and how to view a copy of this License. If |
||||
the interface presents a list of user commands or options, such as a |
||||
menu, a prominent item in the list meets this criterion. |
||||
|
||||
1. Source Code. |
||||
|
||||
The "source code" for a work means the preferred form of the work |
||||
for making modifications to it. "Object code" means any non-source |
||||
form of a work. |
||||
|
||||
A "Standard Interface" means an interface that either is an official |
||||
standard defined by a recognized standards body, or, in the case of |
||||
interfaces specified for a particular programming language, one that |
||||
is widely used among developers working in that language. |
||||
|
||||
The "System Libraries" of an executable work include anything, other |
||||
than the work as a whole, that (a) is included in the normal form of |
||||
packaging a Major Component, but which is not part of that Major |
||||
Component, and (b) serves only to enable use of the work with that |
||||
Major Component, or to implement a Standard Interface for which an |
||||
implementation is available to the public in source code form. A |
||||
"Major Component", in this context, means a major essential component |
||||
(kernel, window system, and so on) of the specific operating system |
||||
(if any) on which the executable work runs, or a compiler used to |
||||
produce the work, or an object code interpreter used to run it. |
||||
|
||||
The "Corresponding Source" for a work in object code form means all |
||||
the source code needed to generate, install, and (for an executable |
||||
work) run the object code and to modify the work, including scripts to |
||||
control those activities. However, it does not include the work's |
||||
System Libraries, or general-purpose tools or generally available free |
||||
programs which are used unmodified in performing those activities but |
||||
which are not part of the work. For example, Corresponding Source |
||||
includes interface definition files associated with source files for |
||||
the work, and the source code for shared libraries and dynamically |
||||
linked subprograms that the work is specifically designed to require, |
||||
such as by intimate data communication or control flow between those |
||||
subprograms and other parts of the work. |
||||
|
||||
The Corresponding Source need not include anything that users |
||||
can regenerate automatically from other parts of the Corresponding |
||||
Source. |
||||
|
||||
The Corresponding Source for a work in source code form is that |
||||
same work. |
||||
|
||||
2. Basic Permissions. |
||||
|
||||
All rights granted under this License are granted for the term of |
||||
copyright on the Program, and are irrevocable provided the stated |
||||
conditions are met. This License explicitly affirms your unlimited |
||||
permission to run the unmodified Program. The output from running a |
||||
covered work is covered by this License only if the output, given its |
||||
content, constitutes a covered work. This License acknowledges your |
||||
rights of fair use or other equivalent, as provided by copyright law. |
||||
|
||||
You may make, run and propagate covered works that you do not |
||||
convey, without conditions so long as your license otherwise remains |
||||
in force. You may convey covered works to others for the sole purpose |
||||
of having them make modifications exclusively for you, or provide you |
||||
with facilities for running those works, provided that you comply with |
||||
the terms of this License in conveying all material for which you do |
||||
not control copyright. Those thus making or running the covered works |
||||
for you must do so exclusively on your behalf, under your direction |
||||
and control, on terms that prohibit them from making any copies of |
||||
your copyrighted material outside their relationship with you. |
||||
|
||||
Conveying under any other circumstances is permitted solely under |
||||
the conditions stated below. Sublicensing is not allowed; section 10 |
||||
makes it unnecessary. |
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
||||
|
||||
No covered work shall be deemed part of an effective technological |
||||
measure under any applicable law fulfilling obligations under article |
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or |
||||
similar laws prohibiting or restricting circumvention of such |
||||
measures. |
||||
|
||||
When you convey a covered work, you waive any legal power to forbid |
||||
circumvention of technological measures to the extent such circumvention |
||||
is effected by exercising rights under this License with respect to |
||||
the covered work, and you disclaim any intention to limit operation or |
||||
modification of the work as a means of enforcing, against the work's |
||||
users, your or third parties' legal rights to forbid circumvention of |
||||
technological measures. |
||||
|
||||
4. Conveying Verbatim Copies. |
||||
|
||||
You may convey verbatim copies of the Program's source code as you |
||||