-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
127 lines (102 loc) · 4.28 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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