So far, disable snow mapgen from snow
3
mods/snow/.gitignore
vendored
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
config.txt
|
||||||
|
debug.txt
|
||||||
|
*~
|
162
mods/snow/LazyJ-changelog.txt
Executable file
@ -0,0 +1,162 @@
|
|||||||
|
~ LazyJ, 2014_06_01
|
||||||
|
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
List of Changes
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### MapGen
|
||||||
|
|
||||||
|
I did *not* fix Snow's mapgen issue with "PlantLife" (another great, Minetest
|
||||||
|
standard) based mods. Mapgen stuff is far beyond my current skill level.
|
||||||
|
What little changes I did make were to switch-out Snow nodes that Minetest
|
||||||
|
now has as defaults (dirt_with_snow, snow, ice). My thoughts being that
|
||||||
|
texture packs and other mods that may use these nodes as recipe items are more
|
||||||
|
likely to support default nodes. I also added a line above and below in the
|
||||||
|
"mapgen.lua" file indicating where to put the comment symbols to
|
||||||
|
comment-out/disable Snow's mapgen. Mods based on VanessaE's excellent
|
||||||
|
"PlantLife" mod will not produce if Snow's mapgen is active.
|
||||||
|
*Snow's mapgen is active by default.*
|
||||||
|
I did not disable it, merely indicated were the comment symbols are
|
||||||
|
to be placed. To compensate for the loss of snow resources when Snow's mapgen
|
||||||
|
is disabled, I created crafting recipes that allows players to craft more
|
||||||
|
snow, ice, and moss. This not only encourages snow builds, but also allows
|
||||||
|
the players to create snow biomes where they want and whatever size they are
|
||||||
|
willing to make them.
|
||||||
|
|
||||||
|
|
||||||
|
##### Fixed
|
||||||
|
* Pine saplings are now replaced with tree trunks when the tree grows.
|
||||||
|
* Snowballs no longer pass through solid objects. Griefers can no
|
||||||
|
longer flood the interiors of builds by throwing snowballs through the
|
||||||
|
walls hoping to either leave a snowy mess inside or that a heat source
|
||||||
|
would melt the snow and flood the interior.
|
||||||
|
* Snowballs no longer destroy nodes when thrown at the sides.
|
||||||
|
* Falling snow no longer destroys nodes (same problem snowballs had).
|
||||||
|
* Snow bricks now, instead of disappearing like before, melt
|
||||||
|
into water sources.
|
||||||
|
* Christmas tree saplings once again will drop when pine needles
|
||||||
|
are harvested.
|
||||||
|
* Dirt_with_snow changes to dirt when a solid, non-light permeating
|
||||||
|
(sunlight_propagates) block is set on top of it.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Changed
|
||||||
|
* All snow and ice stuff (including the stairs, slabs, panels, and
|
||||||
|
microblocks) will freeze dirt and dirt_with_grass into dirt_with_snow.
|
||||||
|
* All snow and most ice stuff will freeze water into ice, including
|
||||||
|
the stairs, slabs, panels, and microblocks. The exception is the
|
||||||
|
full-sized ice blocks will *not* freeze water into ice.
|
||||||
|
* Snow brick texture reworked and based off of the default stone brick
|
||||||
|
texture (and less purple in the grout).
|
||||||
|
* Ice stuff is now semi-transparent.
|
||||||
|
* Christmas trees now have blinking lights that give off a
|
||||||
|
low level of light.
|
||||||
|
* Christmas tree stars now give off a high level of light and the
|
||||||
|
light can be punched on or off.
|
||||||
|
* Combined default snow and snowballs. Now snow can be
|
||||||
|
thrown (left-click) or placed (right-click).
|
||||||
|
* Snow stuff now has "snow" sounds instead of "grass" sounds.
|
||||||
|
* Melting - Full-sized snow blocks, snow brick, snow cobble, and ice
|
||||||
|
will melt into water sources. The down-side is this makes a big,
|
||||||
|
permanent mess. The up-side, this is a convenient way to carry water,
|
||||||
|
if buckets are disabled on your server, by keeping full-sized snow
|
||||||
|
stuff and ice blocks in your inventory to, later, melt where you
|
||||||
|
need water.
|
||||||
|
* Melting - Partial and small-sized blocks like snow (snowballs),
|
||||||
|
basic stairs and slabs for snow stuff and ice, and circular saw-made
|
||||||
|
snow stuff and ice things will melt into a water source for 2 seconds,
|
||||||
|
then switch from a water source to flowing water, and after a moment
|
||||||
|
the flowing water dries-up (small, temporary mess).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### Added
|
||||||
|
* New block-type: "Snow Cobble". Just like regular cobble from regular
|
||||||
|
stone, snow cobble comes from digging snow blocks.
|
||||||
|
* All snow and ice blocks can be crafted into basic slabs and stairs.
|
||||||
|
The default slabs stack and change back into full-sized blocks
|
||||||
|
("More Blocks" slabs won't do this).
|
||||||
|
* Soft dependency on a recent release Calinou's MoreBlocks so all
|
||||||
|
snow and ice blocks are compatible with the circular saw. If you don't
|
||||||
|
have MoreBlocks installed, Snow will ignore the code for those fancy
|
||||||
|
blocks and use basic stairs and slabs instead.
|
||||||
|
* All snow and ice stuff works with the screwdriver.
|
||||||
|
* Crafting, recycling, and cooking recipes for snow blocks,
|
||||||
|
ice, and moss.
|
||||||
|
* Snow bricks craft-recycle back into 4 snow blocks.
|
||||||
|
* 2 snow blocks craft into 3 snow blocks. This is to make up
|
||||||
|
for when the mapgen for snow biomes is disabled.
|
||||||
|
* 2 snow cobble craft-recycle into 3 snow blocks.
|
||||||
|
* 4 pine needles craft into 1 moss
|
||||||
|
* Snow blocks, snow cobble, and snow bricks can be cooked in a
|
||||||
|
furnace to make ice.
|
||||||
|
* Snowballs can be thrown (left-click) to build up layers. After the
|
||||||
|
11th layer, the bottom 9 layers change into a snow block. At a very
|
||||||
|
close distance, throwing snowballs can be used as a technique to
|
||||||
|
build-up gradual slopes. If you have lots and lots of snow balls,
|
||||||
|
with rapid-fire throwing, you can, very briefly, "white-out" another
|
||||||
|
player's view if your aim is good enough to hit them in the face.
|
||||||
|
* Snowballs can be placed (right-click) but will not stack into
|
||||||
|
multiple layers. Just one layer only. Placing snow is more reliable
|
||||||
|
and accurate than throwing snow from a distance. By placing snow,
|
||||||
|
players are able to create their own, personal, snow biomes.
|
||||||
|
* Vertical clearance check for tree growth. The nine blocks above the
|
||||||
|
spot where the sapling is placed must be free and clear of all
|
||||||
|
obstructions or else the sapling will not be allowed to grow.
|
||||||
|
Griefers could place the saplings in builds and when the tree grows
|
||||||
|
it may not destroy nodes but it fills the available air space leaving
|
||||||
|
a mess for the build's owner to clean-up. Now the trees will only grow
|
||||||
|
inside if there is 9, free-and-clear spaces from floor to ceiling.
|
||||||
|
Because pine trees (and Christmas trees) will grow on any solid surface,
|
||||||
|
their saplings are handy to take with you when deep mining. Just before
|
||||||
|
you run out of tool wood, dig out a space large enough for a tree to
|
||||||
|
grow, plant a pine or Christmas tree sapling then place 2 torches on
|
||||||
|
either side, right next to the sapling. After the tree grows harvest
|
||||||
|
the trunk for tool wood, the leaves for short-run fuel in the furnace
|
||||||
|
and for saplings to renew your tool wood supply again.
|
||||||
|
* Aliases to help make WorldEdit and "give" commands easier:
|
||||||
|
|
||||||
|
|
||||||
|
"default_snow" = "default:snow"
|
||||||
|
"snowball" = "default:snow"
|
||||||
|
"snowballs" = "default:snow"
|
||||||
|
"snow_ball" = "default:snow"
|
||||||
|
"ice" = "default:ice"
|
||||||
|
"default_ice" = "default:ice"
|
||||||
|
"dirtwithsnow" = "default:dirt_with_snow"
|
||||||
|
"snowdirt" = "default:dirt_with_snow"
|
||||||
|
"snowydirt" = "default:dirt_with_snow"
|
||||||
|
"snowblocks" = "default:snowblock"
|
||||||
|
"snowbrick" = "snow:snow_brick"
|
||||||
|
"bricksnow" = "snow:snow_brick"
|
||||||
|
"snowbricks" = "snow:snow_brick"
|
||||||
|
"snowybricks" = "snow:snow_brick"
|
||||||
|
"snowcobble" = "snow:snow_cobble"
|
||||||
|
"snowycobble" = "snow:snow_cobble"
|
||||||
|
"cobblesnow" = "snow:snow_cobble"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~~~~~~
|
||||||
|
TODO
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
Falling Snow:
|
||||||
|
* Add code to prevent snowfall from depositing snow on or near torches,
|
||||||
|
active furnaces, 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?
|
||||||
|
|
||||||
|
|
67
mods/snow/changelog.txt
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
CHANGELOG:
|
||||||
|
------------
|
||||||
|
|
||||||
|
Version 3.2
|
||||||
|
|
||||||
|
Update compatibility to the latest minetest.
|
||||||
|
|
||||||
|
Version 0.3.1
|
||||||
|
|
||||||
|
Paramat's rewrite of mapgenv6.lua: bugfixes, use noisemaps for big speed increase
|
||||||
|
|
||||||
|
Version 3.0
|
||||||
|
LazyJ's big changes (see LazyJ-changelog.txt)
|
||||||
|
|
||||||
|
Ice freezes-over.
|
||||||
|
|
||||||
|
Better leveled snow.
|
||||||
|
|
||||||
|
PLUS MORE! (see commit log)
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
Uses default namespace.
|
||||||
|
|
||||||
|
Sleds.
|
||||||
|
|
||||||
|
Bugfixes.
|
||||||
|
|
||||||
|
Version 1.8
|
||||||
|
|
||||||
|
Mapgen_v7 support.
|
||||||
|
|
||||||
|
Better config system.
|
||||||
|
|
||||||
|
Falling snow.
|
||||||
|
|
||||||
|
Version 1.4
|
||||||
|
|
||||||
|
New biomes, snowy and plain
|
||||||
|
|
||||||
|
Christmas Trees
|
||||||
|
|
||||||
|
Snowfall
|
||||||
|
|
||||||
|
Version 1.3
|
||||||
|
|
||||||
|
Smooth transitions
|
||||||
|
|
||||||
|
Snow Bricks
|
||||||
|
|
||||||
|
Version 1.2
|
||||||
|
|
||||||
|
Pine trees
|
||||||
|
|
||||||
|
Moss
|
||||||
|
|
||||||
|
Alpine biomes
|
||||||
|
|
||||||
|
Dry shrubs
|
||||||
|
|
||||||
|
Version 1.1
|
||||||
|
|
||||||
|
Better mapgen
|
||||||
|
|
||||||
|
Version 1.0
|
||||||
|
|
||||||
|
Initial release
|
4
mods/snow/depends.txt
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
default
|
||||||
|
flowers?
|
||||||
|
moreblocks?
|
||||||
|
watershed?
|
191
mods/snow/init.lua
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
--[[
|
||||||
|
--==============================
|
||||||
|
--==========================================================
|
||||||
|
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").."/src/abms.lua")
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/aliases.lua")
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/crafting.lua")
|
||||||
|
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
|
||||||
|
-- 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").."/src/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").."/src/nodes.lua")
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/basic_stairs_slabs.lua")
|
||||||
|
-- dofile(minetest.get_modpath("snow").."/src/mapgen.lua")
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/sled.lua")
|
||||||
|
-- dofile(minetest.get_modpath("snow").."/src/falling_snow.lua")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Check for "MoreBlocks". If not found, skip this next "dofile".
|
||||||
|
|
||||||
|
if minetest.get_modpath("moreblocks") then
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/stairsplus.lua")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
--This function places snow checking at the same time for snow level and increasing as needed.
|
||||||
|
--This also takes into account sourrounding snow and makes snow even.
|
||||||
|
function snow.place(pos)
|
||||||
|
if pos.y < -19000 then return end -- Don't put anything in the nether!
|
||||||
|
local node = minetest.get_node_or_nil(pos)
|
||||||
|
|
||||||
|
--Oops, maybe there is no node?
|
||||||
|
if not node
|
||||||
|
or not minetest.registered_nodes[node.name] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local bnode = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
|
if node.name == "default:snow" then
|
||||||
|
local level = minetest.get_node_level(pos)
|
||||||
|
if level < 63 then
|
||||||
|
if minetest.get_item_group(bnode.name, "leafdecay") == 0
|
||||||
|
and not snow.is_uneven(pos) then
|
||||||
|
minetest.sound_play("default_snow_footstep", {pos=pos})
|
||||||
|
minetest.add_node_level(pos, 7)
|
||||||
|
end
|
||||||
|
elseif level == 63 then
|
||||||
|
local p = minetest.find_node_near(pos, 10, "default:dirt_with_grass")
|
||||||
|
if p
|
||||||
|
and minetest.get_node_light(p, 0.5) == 15 then
|
||||||
|
minetest.sound_play("default_grass_footstep", {pos=pos})
|
||||||
|
minetest.place_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="default:snow"})
|
||||||
|
else
|
||||||
|
minetest.sound_play("default_snow_footstep", {pos=pos})
|
||||||
|
minetest.add_node(pos, {name="default:snowblock"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif node.name ~= "default:ice"
|
||||||
|
and bnode.name ~= "air" then
|
||||||
|
local data = minetest.registered_nodes[node.name]
|
||||||
|
local drawtype = data.drawtype
|
||||||
|
if drawtype == "normal"
|
||||||
|
or drawtype == "allfaces_optional" then
|
||||||
|
pos.y = pos.y+1
|
||||||
|
local sound = data.sounds
|
||||||
|
if sound then
|
||||||
|
sound = sound.footstep
|
||||||
|
if sound then
|
||||||
|
minetest.sound_play(sound.name, {pos=pos, gain=sound.gain})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.place_node(pos, {name="default:snow"})
|
||||||
|
elseif drawtype == "plantlike" then
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
if minetest.get_node(pos).name == "default:dirt_with_grass" then
|
||||||
|
minetest.sound_play("default_grass_footstep", {pos=pos})
|
||||||
|
minetest.add_node(pos, {name="default:dirt_with_snow"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Checks if the snow level is even at any given pos.
|
||||||
|
-- Smooth Snow
|
||||||
|
local function is_uneven(pos)
|
||||||
|
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
|
||||||
|
local foundz
|
||||||
|
for z = -1,1 do
|
||||||
|
for x = -1,1 do
|
||||||
|
local p = {x=pos.x+x, y=pos.y, z=pos.z+z}
|
||||||
|
local node = get_node(p)
|
||||||
|
p.y = p.y-1
|
||||||
|
local bnode = get_node(p)
|
||||||
|
|
||||||
|
if node
|
||||||
|
and minetest.registered_nodes[node.name]
|
||||||
|
and minetest.registered_nodes[node.name].drawtype == "plantlike"
|
||||||
|
and bnode.name == "default:dirt_with_grass" then
|
||||||
|
add_node(p, {name="default:dirt_with_snow"})
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
p.y = p.y+1
|
||||||
|
if not (x == 0 and z == 0)
|
||||||
|
and node.name == "default:snow"
|
||||||
|
and minetest.get_node_level(p) < num then
|
||||||
|
found = true
|
||||||
|
foundx = x
|
||||||
|
foundz = z
|
||||||
|
elseif node.name == "air"
|
||||||
|
and bnode.name ~= "air"
|
||||||
|
and bnode.name ~= "default:snow" then
|
||||||
|
p.y = p.y-1
|
||||||
|
snow.place(p)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if found then
|
||||||
|
local p = {x=pos.x+foundx, y=pos.y, z=pos.z+foundz}
|
||||||
|
if is_uneven(p) ~= true then
|
||||||
|
minetest.add_node_level(p, 7)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function snow.is_uneven(pos)
|
||||||
|
if snow.smooth_snow then
|
||||||
|
return is_uneven(pos)
|
||||||
|
end
|
||||||
|
end
|
674
mods/snow/license.txt
Executable file
@ -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
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
BIN
mods/snow/models/sled.blend
Executable file
BIN
mods/snow/models/sled.png
Executable file
After Width: | Height: | Size: 2.9 KiB |
369
mods/snow/models/sled.x
Executable file
@ -0,0 +1,369 @@
|
|||||||
|
xof 0303txt 0032
|
||||||
|
|
||||||
|
Frame Root {
|
||||||
|
FrameTransformMatrix {
|
||||||
|
1.000000, 0.000000, 0.000000, 0.000000,
|
||||||
|
0.000000, 0.000000, 1.000000, 0.000000,
|
||||||
|
0.000000, 1.000000,-0.000000, 0.000000,
|
||||||
|
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||||
|
}
|
||||||
|
Frame Cube_001 {
|
||||||
|
FrameTransformMatrix {
|
||||||
|
0.000000, 0.149813, 0.000000, 0.000000,
|
||||||
|
-0.149813, 0.000000, 0.000000, 0.000000,
|
||||||
|
0.000000, 0.000000, 0.149813, 0.000000,
|
||||||
|
0.025244, 3.853863,-2.133818, 1.000000;;
|
||||||
|
}
|
||||||
|
Mesh { //Cube_003 Mesh
|
||||||
|
88;
|
||||||
|
-1.000000;53.554752;-1.000000;,
|
||||||
|
-1.000000;-53.189678;-1.000000;,
|
||||||
|
1.000000;-53.189678;-1.000000;,
|
||||||
|
1.000000;53.554752;-1.000000;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
0.999999;-53.189678;16.253036;,
|
||||||
|
1.000000;-53.189678;-1.000000;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
1.000000;53.554752;-1.000000;,
|
||||||
|
-1.000000;-53.189678;-1.000000;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
1.000000;-53.189678;-1.000000;,
|
||||||
|
-1.000000;53.554752;-1.000000;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-1.000000;-53.189678;-1.000000;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-1.000000;53.554752;-1.000000;,
|
||||||
|
1.000000;53.554752;-1.000000;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
0.999999;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
1.000000;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
0.999999;-53.189678;16.253036;,
|
||||||
|
1.000000;53.554752;16.253036;,
|
||||||
|
1.000000;53.554752;16.253036;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
-52.403629;-53.189678;16.253036;,
|
||||||
|
-52.403629;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-52.403629;53.554752;16.253036;,
|
||||||
|
-52.403629;-53.189678;16.253036;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-52.403629;-53.189678;16.253036;,
|
||||||
|
-52.403629;53.554752;16.253036;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-52.403629;53.554752;-0.989515;,
|
||||||
|
-50.412270;53.554752;-0.989515;,
|
||||||
|
-50.412270;-53.189678;-0.989515;,
|
||||||
|
-50.412270;53.554752;-0.989515;,
|
||||||
|
-52.403629;53.554752;-0.989515;,
|
||||||
|
-52.403629;-53.189678;-0.989515;,
|
||||||
|
-52.403629;-53.189678;-0.989515;,
|
||||||
|
-52.403629;53.554752;-0.989515;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;-0.989515;,
|
||||||
|
-52.403629;-53.189678;-0.989515;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;-0.989515;,
|
||||||
|
-50.412270;-53.189678;-0.989515;;
|
||||||
|
22;
|
||||||
|
4;0;1;2;3;,
|
||||||
|
4;4;5;6;7;,
|
||||||
|
4;8;9;10;11;,
|
||||||
|
4;12;13;14;15;,
|
||||||
|
4;16;17;18;19;,
|
||||||
|
4;20;21;22;23;,
|
||||||
|
4;24;25;26;27;,
|
||||||
|
4;28;29;30;31;,
|
||||||
|
4;32;33;34;35;,
|
||||||
|
4;36;37;38;39;,
|
||||||
|
4;40;41;42;43;,
|
||||||
|
4;44;45;46;47;,
|
||||||
|
4;48;49;50;51;,
|
||||||
|
4;52;53;54;55;,
|
||||||
|
4;56;57;58;59;,
|
||||||
|
4;60;61;62;63;,
|
||||||
|
4;64;65;66;67;,
|
||||||
|
4;68;69;70;71;,
|
||||||
|
4;72;73;74;75;,
|
||||||
|
4;76;77;78;79;,
|
||||||
|
4;80;81;82;83;,
|
||||||
|
4;84;85;86;87;;
|
||||||
|
MeshNormals { //Cube_003 Normals
|
||||||
|
88;
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;;
|
||||||
|
22;
|
||||||
|
4;0;1;2;3;,
|
||||||
|
4;4;5;6;7;,
|
||||||
|
4;8;9;10;11;,
|
||||||
|
4;12;13;14;15;,
|
||||||
|
4;16;17;18;19;,
|
||||||
|
4;20;21;22;23;,
|
||||||
|
4;24;25;26;27;,
|
||||||
|
4;28;29;30;31;,
|
||||||
|
4;32;33;34;35;,
|
||||||
|
4;36;37;38;39;,
|
||||||
|
4;40;41;42;43;,
|
||||||
|
4;44;45;46;47;,
|
||||||
|
4;48;49;50;51;,
|
||||||
|
4;52;53;54;55;,
|
||||||
|
4;56;57;58;59;,
|
||||||
|
4;60;61;62;63;,
|
||||||
|
4;64;65;66;67;,
|
||||||
|
4;68;69;70;71;,
|
||||||
|
4;72;73;74;75;,
|
||||||
|
4;76;77;78;79;,
|
||||||
|
4;80;81;82;83;,
|
||||||
|
4;84;85;86;87;;
|
||||||
|
} //End of Cube_003 Normals
|
||||||
|
MeshMaterialList { //Cube_003 Material List
|
||||||
|
1;
|
||||||
|
22;
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0;;
|
||||||
|
Material Material {
|
||||||
|
0.640000; 0.640000; 0.640000; 1.000000;;
|
||||||
|
96.078431;
|
||||||
|
0.500000; 0.500000; 0.500000;;
|
||||||
|
0.000000; 0.000000; 0.000000;;
|
||||||
|
}
|
||||||
|
} //End of Cube_003 Material List
|
||||||
|
MeshTextureCoords { //Cube_003 UV Coordinates
|
||||||
|
88;
|
||||||
|
0.973358; 0.999965;,
|
||||||
|
0.975236; 0.387889;,
|
||||||
|
0.986704; 0.387924;,
|
||||||
|
0.984826; 1.000000;,
|
||||||
|
0.706578; 0.081368;,
|
||||||
|
0.706614; 0.092836;,
|
||||||
|
0.695086; 0.092871;,
|
||||||
|
0.695051; 0.081403;,
|
||||||
|
0.593305; 0.387924;,
|
||||||
|
0.680706; 0.387656;,
|
||||||
|
0.682584; 0.999732;,
|
||||||
|
0.595183; 1.000000;,
|
||||||
|
0.794015; 0.092568;,
|
||||||
|
0.706614; 0.092836;,
|
||||||
|
0.706578; 0.081368;,
|
||||||
|
0.793980; 0.081100;,
|
||||||
|
0.882261; 1.000000;,
|
||||||
|
0.794859; 0.999732;,
|
||||||
|
0.796737; 0.387656;,
|
||||||
|
0.884139; 0.387924;,
|
||||||
|
0.806422; 0.375920;,
|
||||||
|
0.893824; 0.376188;,
|
||||||
|
0.893789; 0.387656;,
|
||||||
|
0.806387; 0.387388;,
|
||||||
|
0.000000; 0.387924;,
|
||||||
|
0.011468; 0.387889;,
|
||||||
|
0.013346; 0.999965;,
|
||||||
|
0.001878; 1.000000;,
|
||||||
|
0.795764; 0.092553;,
|
||||||
|
0.807291; 0.092589;,
|
||||||
|
0.806422; 0.375920;,
|
||||||
|
0.794894; 0.375885;,
|
||||||
|
0.682584; 0.999732;,
|
||||||
|
0.680706; 0.387656;,
|
||||||
|
0.692234; 0.387621;,
|
||||||
|
0.694112; 0.999696;,
|
||||||
|
0.794859; 0.387353;,
|
||||||
|
0.794894; 0.375885;,
|
||||||
|
0.806422; 0.375920;,
|
||||||
|
0.806387; 0.387388;,
|
||||||
|
0.306218; 0.386985;,
|
||||||
|
0.308096; 0.999061;,
|
||||||
|
0.296677; 0.999096;,
|
||||||
|
0.294799; 0.387020;,
|
||||||
|
0.593305; 0.387924;,
|
||||||
|
0.591427; 1.000000;,
|
||||||
|
0.308096; 0.999131;,
|
||||||
|
0.309974; 0.387055;,
|
||||||
|
0.294799; 0.387020;,
|
||||||
|
0.296677; 0.999096;,
|
||||||
|
0.013346; 0.999965;,
|
||||||
|
0.011468; 0.387889;,
|
||||||
|
0.695086; 0.092871;,
|
||||||
|
0.706614; 0.092836;,
|
||||||
|
0.707483; 0.376167;,
|
||||||
|
0.695955; 0.376202;,
|
||||||
|
0.707518; 0.387656;,
|
||||||
|
0.705640; 0.999732;,
|
||||||
|
0.694112; 0.999697;,
|
||||||
|
0.695990; 0.387621;,
|
||||||
|
0.695955; 0.376202;,
|
||||||
|
0.707483; 0.376167;,
|
||||||
|
0.707518; 0.387586;,
|
||||||
|
0.695990; 0.387621;,
|
||||||
|
0.795799; 0.081135;,
|
||||||
|
0.807326; 0.081170;,
|
||||||
|
0.807291; 0.092589;,
|
||||||
|
0.795764; 0.092553;,
|
||||||
|
0.807291; 0.092589;,
|
||||||
|
0.807326; 0.081170;,
|
||||||
|
0.894668; 0.081438;,
|
||||||
|
0.894633; 0.092856;,
|
||||||
|
0.988581; 1.000000;,
|
||||||
|
0.986704; 0.387924;,
|
||||||
|
0.998122; 0.387889;,
|
||||||
|
1.000000; 0.999965;,
|
||||||
|
0.794859; 0.387924;,
|
||||||
|
0.792981; 1.000000;,
|
||||||
|
0.705640; 0.999732;,
|
||||||
|
0.707518; 0.387656;,
|
||||||
|
0.707518; 0.387586;,
|
||||||
|
0.707483; 0.376167;,
|
||||||
|
0.794824; 0.375899;,
|
||||||
|
0.794859; 0.387318;,
|
||||||
|
0.884138; 0.999732;,
|
||||||
|
0.886016; 0.387656;,
|
||||||
|
0.973358; 0.387924;,
|
||||||
|
0.971480; 1.000000;;
|
||||||
|
} //End of Cube_003 UV Coordinates
|
||||||
|
} //End of Cube_003 Mesh
|
||||||
|
} //End of Cube_001
|
||||||
|
} //End of Root Frame
|
BIN
mods/snow/other_textures/connected_textures_ice.png
Executable file
After Width: | Height: | Size: 656 B |
BIN
mods/snow/other_textures/default_ice.png
Executable file
After Width: | Height: | Size: 82 B |
BIN
mods/snow/other_textures/default_ice.xcf
Executable file
67
mods/snow/other_textures/inkscape_default_ice.svg
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.4 r9939"
|
||||||
|
sodipodi:docname="inkscape_default_ice.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="45.4375"
|
||||||
|
inkscape:cx="6.8335626"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:window-width="1328"
|
||||||
|
inkscape:window-height="895"
|
||||||
|
inkscape:window-x="197"
|
||||||
|
inkscape:window-y="70"
|
||||||
|
inkscape:window-maximized="0" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-1036.3622)">
|
||||||
|
<rect
|
||||||
|
style="fill:#91d2ff;fill-rule:evenodd;stroke:none;fill-opacity:1;opacity:0.90000000000000002"
|
||||||
|
id="rect2985"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
x="0"
|
||||||
|
y="1036.3622"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-filename="/home/trickpaint/Minetest/Minetest_game_stuff/049_modtest/worlds/developing_snow_overhaul/worldmods/snow_developing/snow/textures/default_ice.png" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
BIN
mods/snow/other_textures/mocha.png
Executable file
After Width: | Height: | Size: 83 B |
BIN
mods/snow/other_textures/mocha.xcf
Executable file
BIN
mods/snow/other_textures/original_snow_snow_brick.png
Executable file
After Width: | Height: | Size: 300 B |
BIN
mods/snow/other_textures/rect2985.png
Executable file
After Width: | Height: | Size: 81 B |
BIN
mods/snow/other_textures/snow_ice.png
Executable file
After Width: | Height: | Size: 371 B |
BIN
mods/snow/other_textures/snow_needles_decorated_animated.xcf
Executable file
BIN
mods/snow/other_textures/snow_snow.png
Executable file
After Width: | Height: | Size: 164 B |
BIN
mods/snow/other_textures/snow_snow_brick.xcf
Executable file
BIN
mods/snow/other_textures/snow_snow_cobble.png_01
Executable file
After Width: | Height: | Size: 570 B |
BIN
mods/snow/other_textures/snow_snow_cobble.xcf
Executable file
BIN
mods/snow/other_textures/snow_snow_side.png
Executable file
After Width: | Height: | Size: 726 B |
BIN
mods/snow/other_textures/snow_snowball.png
Executable file
After Width: | Height: | Size: 127 B |
BIN
mods/snow/other_textures/snow_snowfall.png
Executable file
After Width: | Height: | Size: 190 B |
BIN
mods/snow/other_textures/snow_star_lit.xcf
Executable file
BIN
mods/snow/other_textures/xdefault_cobble.png
Executable file
After Width: | Height: | Size: 297 B |
BIN
mods/snow/other_textures/xdefault_furnace_bottom.png
Executable file
After Width: | Height: | Size: 602 B |
BIN
mods/snow/other_textures/xdefault_furnace_fire_bg.png
Executable file
After Width: | Height: | Size: 204 B |
BIN
mods/snow/other_textures/xdefault_furnace_fire_fg.png
Executable file
After Width: | Height: | Size: 719 B |
BIN
mods/snow/other_textures/xdefault_furnace_front.png
Executable file
After Width: | Height: | Size: 553 B |
BIN
mods/snow/other_textures/xdefault_furnace_front_active.png
Executable file
After Width: | Height: | Size: 4.2 KiB |
BIN
mods/snow/other_textures/xdefault_furnace_side.png
Executable file
After Width: | Height: | Size: 602 B |
BIN
mods/snow/other_textures/xdefault_furnace_top.png
Executable file
After Width: | Height: | Size: 602 B |
BIN
mods/snow/other_textures/xdefault_glass.png
Executable file
After Width: | Height: | Size: 204 B |
BIN
mods/snow/other_textures/xdefault_ice.png
Executable file
After Width: | Height: | Size: 371 B |
BIN
mods/snow/other_textures/xdefault_ice.xcf
Executable file
BIN
mods/snow/other_textures/xdefault_snow.png
Executable file
After Width: | Height: | Size: 164 B |
BIN
mods/snow/other_textures/xdefault_stone_brick.png
Executable file
After Width: | Height: | Size: 572 B |
103
mods/snow/readme.txt
Executable file
@ -0,0 +1,103 @@
|
|||||||
|
_____ __ __ _
|
||||||
|
/ ____| | \/ | | |
|
||||||
|
| (___ _ __ _____ __ | \ / | ___ __| |
|
||||||
|
\___ \| '_ \ / _ \ \ /\ / / | |\/| |/ _ \ / _` |
|
||||||
|
____) | | | | (_) \ V V / | | | | (_) | (_| |
|
||||||
|
|_____/|_| |_|\___/ \_/\_/ |_| |_|\___/ \__,_|
|
||||||
|
|
||||||
|
Version 3.2
|
||||||
|
|
||||||
|
By Splizard and LazyJ.
|
||||||
|
|
||||||
|
Minetest version: 0.4.9
|
||||||
|
Depends: default
|
||||||
|
License: GPL v2
|
||||||
|
|
||||||
|
Complimentary Mods:
|
||||||
|
---------------------
|
||||||
|
* "Snowdrift" by paramat
|
||||||
|
* "More Blocks" by Calinou (2014_05_11 or newer)
|
||||||
|
* "Skins" by Zeg9
|
||||||
|
|
||||||
|
|
||||||
|
Install:
|
||||||
|
|
||||||
|
Forum post: http://minetest.net/forum/viewtopic.php?id=2290
|
||||||
|
Github: https://github.com/Splizard/minetest-mod-snow
|
||||||
|
Website: http://splizard.com/minetest/mods/snow/
|
||||||
|
|
||||||
|
INSTALL:
|
||||||
|
----------
|
||||||
|
Place this folder in your minetest mods folder.
|
||||||
|
(http://dev.minetest.net/Installing_Mods)
|
||||||
|
|
||||||
|
* After downloading, unzip the file.
|
||||||
|
* Rename the directory "minetest-mod-snow-master" to "snow"
|
||||||
|
* Copy the "snow" directory into either
|
||||||
|
../minetest/worlds/yourworld'sname/worldmods/
|
||||||
|
or
|
||||||
|
../minetest/mods/
|
||||||
|
* If you put "snow" in the ../minetest/mods/ directory, either
|
||||||
|
enable the mod from within Minetest's "Configure" button
|
||||||
|
(main menu, bottom right) or by adding this line to the
|
||||||
|
world's "world.mt" file:
|
||||||
|
load_mod_snow = true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NOTICE
|
||||||
|
While this mod is installed you may experience slower map loading while a snow biome is generated.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
-------
|
||||||
|
If you walk around a bit you will find snow biomes scattered around the world.
|
||||||
|
|
||||||
|
There are nine biome types:
|
||||||
|
* Normal
|
||||||
|
* Icebergs
|
||||||
|
* Icesheet
|
||||||
|
* Broken icesheet
|
||||||
|
* Icecave
|
||||||
|
* Coast
|
||||||
|
* Alpine
|
||||||
|
* Snowy
|
||||||
|
* Plain
|
||||||
|
|
||||||
|
Snow can be picked up and thrown as snowballs or stacked into snow blocks.
|
||||||
|
Snow and ice melts when near warm blocks such as torches or igniters such as lava.
|
||||||
|
Snow blocks freeze water source blocks around them.
|
||||||
|
Moss can be found in the snow, when moss is placed near cobble it spreads.
|
||||||
|
Christmas trees can be found when digging pine needles.
|
||||||
|
Sleds allow for faster travel on snow.
|
||||||
|
|
||||||
|
CRAFTING:
|
||||||
|
-----------
|
||||||
|
Snow Brick:
|
||||||
|
|
||||||
|
Snow Block Snow Block
|
||||||
|
Snow Block Snow Block
|
||||||
|
|
||||||
|
Sled:
|
||||||
|
Stick
|
||||||
|
Wood Wood Wood
|
||||||
|
|
||||||
|
Icy Snow:
|
||||||
|
|
||||||
|
Snow Ice
|
||||||
|
Ice Snow
|
||||||
|
|
||||||
|
MAPGEN_V7:
|
||||||
|
------------
|
||||||
|
If you are using minetest 0.4.8 or the latest dev version of minetest you can choose to generate a v7 map.
|
||||||
|
This option can be found when creating a new map from the menu.
|
||||||
|
Snow Biomes has support for this though you might need a couple other biomes too otherwise you will only spawn snow.
|
||||||
|
There are a couple of bugs and limitations with this such as no ice being generated at the moment.
|
||||||
|
|
||||||
|
Config file:
|
||||||
|
------------
|
||||||
|
After starting a game in minetest with snow mod, a config file will be placed in this folder that contains the various options for snow mod.
|
||||||
|
As admin you can use the /snow command in-game to make various changes.
|
||||||
|
|
||||||
|
UNINSTALL:
|
||||||
|
------------
|
||||||
|
Simply delete the folder snow from the mods folder.
|
BIN
mods/snow/schematics/pine.mts
Executable file
208
mods/snow/src/abms.lua
Executable file
@ -0,0 +1,208 @@
|
|||||||
|
--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)
|
||||||
|
minetest.add_node(pos, {name="default:snow"})
|
||||||
|
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
|
||||||
|
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 name = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).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 = 10,
|
||||||
|
chance = 2,
|
||||||
|
action = function(pos, node)
|
||||||
|
local intensity = minetest.get_item_group(node.name,"melts")
|
||||||
|
if intensity == 1 then
|
||||||
|
minetest.set_node(pos, {name="default:water_source"})
|
||||||
|
elseif intensity == 2 then
|
||||||
|
minetest.set_node(pos, {name="default:water_flowing", param2=7})
|
||||||
|
elseif intensity == 3 then
|
||||||
|
minetest.set_node(pos, {name="default:water_flowing", param2=3})
|
||||||
|
--[[ 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
|
||||||
|
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)
|
||||||
|
--]]
|
||||||
|
else
|
||||||
|
return
|
||||||
|
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)
|
||||||
|
minetest.add_node(pos,{name="default:ice"})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--Freeze Ice according to it's param2 value.
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:ice"},
|
||||||
|
neighbors = {"default:water_source"},
|
||||||
|
interval = 20,
|
||||||
|
chance = 4,
|
||||||
|
action = function(pos, node)
|
||||||
|
if node.param2 > 0 then
|
||||||
|
for l = 0,1 do
|
||||||
|
for i = -1,1,2 do
|
||||||
|
for _,p in pairs({
|
||||||
|
{x=pos.x+i, z=pos.z-l*i},
|
||||||
|
{x=pos.x+l*i, z=pos.z+i}
|
||||||
|
}) do
|
||||||
|
if math.random(2) == 2 then
|
||||||
|
p.y = pos.y
|
||||||
|
if minetest.get_node(p).name == "default:water_source" then
|
||||||
|
minetest.add_node(p,{name="default:ice", param2 = math.random(0,node.param2-1)})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if math.random(8) == 8 then
|
||||||
|
minetest.add_node(pos, {name="default:water_source"})
|
||||||
|
else
|
||||||
|
minetest.add_node(pos, {name="default:ice", param2 = 0})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Spread moss to cobble.
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:cobble"},
|
||||||
|
neighbors = {"snow:moss"},
|
||||||
|
interval = 20,
|
||||||
|
chance = 6,
|
||||||
|
action = function(pos, node)
|
||||||
|
node.name = "default:mossycobble"
|
||||||
|
minetest.add_node(pos, node)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Grow Pine Saplings
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"snow:sapling_pine"},
|
||||||
|
interval = 10,
|
||||||
|
chance = 50,
|
||||||
|
action = function(pos, node)
|
||||||
|
|
||||||
|
-- Check if there is enough vertical-space for the sapling to grow without
|
||||||
|
-- hitting anything else. ~ LazyJ, 2014_04_10
|
||||||
|
|
||||||
|
-- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
|
||||||
|
for i = 1,8 do
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y+i, z=pos.z}).name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- '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(pos).name == "snow:sapling_pine" then
|
||||||
|
-- This switches the sapling to a tree trunk. ~ LazyJ
|
||||||
|
minetest.set_node(pos, {name="default:pinetree"})
|
||||||
|
-- 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
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Grow Christmas Tree Saplings
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"snow:xmas_tree"},
|
||||||
|
interval = 10,
|
||||||
|
chance = 50,
|
||||||
|
action = function(pos, node)
|
||||||
|
|
||||||
|
-- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
|
||||||
|
for i = 1,8 do
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y+i, z=pos.z}).name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- '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
|
||||||
|
})
|
104
mods/snow/src/aliases.lua
Executable file
@ -0,0 +1,104 @@
|
|||||||
|
-- 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("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("snowybricks", "snow:snow_brick")
|
||||||
|
minetest.register_alias("icysnow", "snow:snow_cobble")
|
||||||
|
minetest.register_alias("snowcobble", "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")
|
302
mods/snow/src/basic_stairs_slabs.lua
Executable file
@ -0,0 +1,302 @@
|
|||||||
|
-- Based on
|
||||||
|
-- Minetest 0.4 mod: stairs
|
||||||
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
|
|
||||||
|
-- ADD CHECK FOR MOREBLOCKS/SKIP IF NOT FOUND CODE STUFF HERE
|
||||||
|
|
||||||
|
|
||||||
|
-- what of the recipeitem can be copied
|
||||||
|
local recipe_values = {
|
||||||
|
"description", "tiles", "groups", "sounds", "use_texture_alpha", "sunlight_propagates",
|
||||||
|
"freezemelt", "liquidtype", "sunlight_propagates",
|
||||||
|
"stair_desc", "slab_desc"
|
||||||
|
}
|
||||||
|
|
||||||
|
local stairdef = {
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
is_ground_content = true,
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
|
dig = {name="default_dig_crumbly", gain=0.4},
|
||||||
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
|
place = {name="default_place_node", gain=1.0}
|
||||||
|
}),
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||||
|
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local p0 = pointed_thing.under
|
||||||
|
local p1 = pointed_thing.above
|
||||||
|
local param2 = 0
|
||||||
|
|
||||||
|
local placer_pos = placer:getpos()
|
||||||
|
if placer_pos then
|
||||||
|
local dir = {
|
||||||
|
x = p1.x - placer_pos.x,
|
||||||
|
y = p1.y - placer_pos.y,
|
||||||
|
z = p1.z - placer_pos.z
|
||||||
|
}
|
||||||
|
param2 = minetest.dir_to_facedir(dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
if p0.y-1 == p1.y then
|
||||||
|
param2 = param2 + 20
|
||||||
|
if param2 == 21 then
|
||||||
|
param2 = 23
|
||||||
|
elseif param2 == 23 then
|
||||||
|
param2 = 21
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "default:dirt_with_grass"
|
||||||
|
-- Thinking in terms of layers, dirt_with_snow could also double as
|
||||||
|
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
|
||||||
|
or node.name == "default:dirt" then
|
||||||
|
node.name = "default:dirt_with_snow"
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Node will be called snow:stair_<subname>
|
||||||
|
local function register_stair(subname, recipeitem, newdef)
|
||||||
|
local def = table.copy(stairdef)
|
||||||
|
|
||||||
|
|
||||||
|
for n,i in pairs(newdef) do
|
||||||
|
def[n] = i
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = "snow:stair_" .. subname
|
||||||
|
minetest.register_node(name, def)
|
||||||
|
--[[
|
||||||
|
-- for replace ABM
|
||||||
|
minetest.register_node("snow:stair_" .. subname.."upside_down", {
|
||||||
|
replace_name = "snow:stair_" .. subname,
|
||||||
|
groups = {slabs_replace=1},
|
||||||
|
})
|
||||||
|
--]]
|
||||||
|
minetest.register_craft({
|
||||||
|
output = name .. " 6",
|
||||||
|
recipe = {
|
||||||
|
{recipeitem, "", ""},
|
||||||
|
{recipeitem, recipeitem, ""},
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Flipped recipe
|
||||||
|
minetest.register_craft({
|
||||||
|
output = name .. " 6",
|
||||||
|
recipe = {
|
||||||
|
{"", "", recipeitem},
|
||||||
|
{"", recipeitem, recipeitem},
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local slabdef = table.copy(stairdef)
|
||||||
|
slabdef.node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||||
|
}
|
||||||
|
slabdef.on_place = nil
|
||||||
|
|
||||||
|
-- Node will be called snow:slab_<subname>
|
||||||
|
local function register_slab(subname, recipeitem, newdef)
|
||||||
|
local def = table.copy(slabdef)
|
||||||
|
|
||||||
|
local name = "snow:slab_" .. subname
|
||||||
|
def.on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If it's being placed on an another similar one, replace it with
|
||||||
|
-- a full block
|
||||||
|
local slabpos, slabnode
|
||||||
|
local p0 = pointed_thing.under
|
||||||
|
local p1 = pointed_thing.above
|
||||||
|
local n0 = minetest.get_node(p0)
|
||||||
|
local n1 = minetest.get_node(p1)
|
||||||
|
|
||||||
|
local n0_is_upside_down = (n0.name == name and
|
||||||
|
n0.param2 >= 20)
|
||||||
|
|
||||||
|
if n0.name == name
|
||||||
|
and not n0_is_upside_down
|
||||||
|
and p0.y+1 == p1.y then
|
||||||
|
slabpos = p0
|
||||||
|
slabnode = n0
|
||||||
|
elseif n1.name == name then
|
||||||
|
slabpos = p1
|
||||||
|
slabnode = n1
|
||||||
|
end
|
||||||
|
if slabpos then
|
||||||
|
-- Remove the slab at slabpos
|
||||||
|
minetest.remove_node(slabpos)
|
||||||
|
-- Make a fake stack of a single item and try to place it
|
||||||
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
|
pointed_thing.above = slabpos
|
||||||
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
|
-- If the item was taken from the fake stack, decrement original
|
||||||
|
if success then
|
||||||
|
itemstack:set_count(fakestack:get_count())
|
||||||
|
-- Else put old node back
|
||||||
|
else
|
||||||
|
minetest.set_node(slabpos, slabnode)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local param2
|
||||||
|
-- Upside down slabs
|
||||||
|
if p0.y-1 == p1.y then
|
||||||
|
-- Turn into full block if pointing at a existing slab
|
||||||
|
if n0_is_upside_down then
|
||||||
|
-- Remove the slab at the position of the slab
|
||||||
|
minetest.remove_node(p0)
|
||||||
|
-- Make a fake stack of a single item and try to place it
|
||||||
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
|
pointed_thing.above = p0
|
||||||
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
|
-- If the item was taken from the fake stack, decrement original
|
||||||
|
if success then
|
||||||
|
itemstack:set_count(fakestack:get_count())
|
||||||
|
-- Else put old node back
|
||||||
|
else
|
||||||
|
minetest.set_node(p0, n0)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Place upside down slab
|
||||||
|
param2 = 20
|
||||||
|
elseif n0_is_upside_down
|
||||||
|
and p0.y+1 ~= p1.y then
|
||||||
|
-- If pointing at the side of a upside down slab
|
||||||
|
param2 = 20
|
||||||
|
end
|
||||||
|
|
||||||
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
|
end
|
||||||
|
|
||||||
|
for n,i in pairs(newdef) do
|
||||||
|
def[n] = i
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node(name, def)
|
||||||
|
--[[
|
||||||
|
-- for replace ABM
|
||||||
|
minetest.register_node("snow:slab_" .. subname.."upside_down", {
|
||||||
|
replace_name = "snow:slab_"..subname,
|
||||||
|
groups = {slabs_replace=1},
|
||||||
|
})
|
||||||
|
--]]
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = name .. " 6",
|
||||||
|
recipe = {
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
--[[
|
||||||
|
-- Replace old "upside_down" nodes with new param2 versions
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"group:slabs_replace"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
node.name = minetest.registered_nodes[node.name].replace_name
|
||||||
|
node.param2 = node.param2 + 20
|
||||||
|
if node.param2 == 21 then
|
||||||
|
node.param2 = 23
|
||||||
|
elseif node.param2 == 23 then
|
||||||
|
node.param2 = 21
|
||||||
|
end
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Snow stairs and slabs require extra definitions because of their extra
|
||||||
|
-- features (freezing, melting, and how they change dirt and dirt_with_grass). ~ LazyJ
|
||||||
|
|
||||||
|
-- Nodes will be called snow:{stair,slab}_<subname>
|
||||||
|
local function register_stair_and_slab(subname, recipeitem, def)
|
||||||
|
local recipedef = minetest.registered_nodes[recipeitem]
|
||||||
|
for _,i in pairs(recipe_values) do
|
||||||
|
if def[i] == nil
|
||||||
|
and recipedef[i] ~= nil then
|
||||||
|
def[i] = recipedef[i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local groups = table.copy(def.groups)
|
||||||
|
groups.cooks_into_ice = nil
|
||||||
|
if groups.melts then
|
||||||
|
groups.melts = math.min(groups.melts+1, 3)
|
||||||
|
end
|
||||||
|
def.groups = groups
|
||||||
|
|
||||||
|
local stair_desc = def.stair_desc
|
||||||
|
def.stair_desc = nil
|
||||||
|
local slab_desc = def.slab_desc
|
||||||
|
def.slab_desc = nil
|
||||||
|
|
||||||
|
def.description = stair_desc
|
||||||
|
register_stair(subname, recipeitem, def)
|
||||||
|
|
||||||
|
def.description = slab_desc
|
||||||
|
register_slab(subname, recipeitem, def)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
list_of_snow_stuff = {
|
||||||
|
--{"row[1] = first item in row",
|
||||||
|
-- "row[2] = second item in row",
|
||||||
|
-- "row[3] = third item in row", and so on, and so on...}, ~ LazyJ
|
||||||
|
{"ice", "default:ice", "Ice Stairs", "Ice Slabs"},
|
||||||
|
{"snowblock", "default:snowblock", "Snowblock Stairs", "Snowblock Slabs"},
|
||||||
|
{"snow_cobble", "snow:snow_cobble", "Snow Cobble Stairs", "Snow Cobble Slabs"},
|
||||||
|
{"snow_brick", "snow:snow_brick", "Snow Brick Stair", "Snow Brick Slab"},
|
||||||
|
{"ice_brick", "snow:ice_brick", "Ice Brick Stair", "Ice Brick Slab"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, row in pairs(list_of_snow_stuff) do
|
||||||
|
register_stair_and_slab(row[1], row[2], {
|
||||||
|
stair_desc = row[3],
|
||||||
|
slab_desc = row[4],
|
||||||
|
})
|
||||||
|
end
|
216
mods/snow/src/crafting.lua
Executable file
@ -0,0 +1,216 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
Crafting Sections (in order, top to bottom):
|
||||||
|
1. Cooking
|
||||||
|
2. Crafting and Recycling
|
||||||
|
|
||||||
|
The crafting recipe for the sled is in the sled.lua file.
|
||||||
|
|
||||||
|
~ LazyJ
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
-- 1. 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",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- 2. 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 2",
|
||||||
|
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"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "snow:ice_brick",
|
||||||
|
recipe = {
|
||||||
|
{"default:ice", "default:ice"},
|
||||||
|
{"default:ice", "default:ice"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "snow:snow_cobble 6",
|
||||||
|
recipe = {
|
||||||
|
{"snow:ice_brick"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--Craft icy snow.
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "snow:snow_cobble 6",
|
||||||
|
recipe = {
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:ice",
|
||||||
|
"default:ice",
|
||||||
|
"default:ice"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "snow:snow_cobble 4",
|
||||||
|
recipe = {
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:ice",
|
||||||
|
"default:ice"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "snow:snow_cobble 2",
|
||||||
|
recipe = {
|
||||||
|
"default:snow",
|
||||||
|
"default:snow",
|
||||||
|
"default:ice"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "snow:snow_cobble",
|
||||||
|
recipe = {
|
||||||
|
"default:snow",
|
||||||
|
"default:ice"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- 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
|
234
mods/snow/src/falling_snow.lua
Executable file
@ -0,0 +1,234 @@
|
|||||||
|
--[[
|
||||||
|
--=================
|
||||||
|
--======================================
|
||||||
|
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
|
||||||
|
--=============================================================
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
-- copied from meru mod
|
||||||
|
local SEEDDIFF3 = 9130 -- 9130 -- Values should match minetest mapgen desert perlin.
|
||||||
|
local OCTAVES3 = 3 -- 3
|
||||||
|
local PERSISTENCE3 = 0.5 -- 0.5
|
||||||
|
local SCALE3 = 250 -- 250
|
||||||
|
|
||||||
|
--Get snow at position.
|
||||||
|
local function get_snow(pos)
|
||||||
|
--Legacy support.
|
||||||
|
if weather_legacy == "snow" then
|
||||||
|
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
|
||||||
|
if perlin1:get2d({x=pos.x, y=pos.z}) <= 0.53 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- disable falling snow in desert
|
||||||
|
local desert_perlin = minetest.get_perlin(SEEDDIFF3, OCTAVES3, PERSISTENCE3, SCALE3)
|
||||||
|
local noise3 = desert_perlin:get2d({x=pos.x+150,y=pos.z+50}) -- Offsets must match minetest mapgen desert perlin.
|
||||||
|
if noise3 > 0.35 then -- Smooth transition 0.35 to 0.45.
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local addvectors = vector and vector.add
|
||||||
|
|
||||||
|
--Returns a random position between minp and maxp.
|
||||||
|
local function randpos(minp, maxp)
|
||||||
|
local x,z
|
||||||
|
if minp.x > maxp.x then
|
||||||
|
x = math.random(maxp.x,minp.x)
|
||||||
|
else
|
||||||
|
x = math.random(minp.x,maxp.x)
|
||||||
|
end
|
||||||
|
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=minp.y,z=z}
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_snow_particle = {
|
||||||
|
amount = 3,
|
||||||
|
time = 0.5,
|
||||||
|
exptime = 5,
|
||||||
|
size = 50,
|
||||||
|
collisiondetection = false,
|
||||||
|
vertical = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function get_snow_particledef(data)
|
||||||
|
for n,i in pairs(default_snow_particle) do
|
||||||
|
data[n] = data[n] or i
|
||||||
|
end
|
||||||
|
for _,i in pairs({"vel", "acc", "exptime", "size"}) do
|
||||||
|
data["min"..i] = data[i]
|
||||||
|
data["max"..i] = data[i]
|
||||||
|
end
|
||||||
|
data.texture = "weather_snow.png^[transform"..math.random(0,7)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
local function snow_fall(pos, player, animate)
|
||||||
|
local ground_y = nil
|
||||||
|
for y=pos.y+10,pos.y+20,1 do
|
||||||
|
local n = minetest.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.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}
|
||||||
|
|
||||||
|
if get_snow(pos) then
|
||||||
|
if animate then
|
||||||
|
local spos = {x=pos.x, y=ground_y+10, z=pos.z}
|
||||||
|
minetest.add_particlespawner(get_snow_particledef({
|
||||||
|
minpos = addvectors(spos, {x=-9, y=3, z=-9}),
|
||||||
|
maxpos = addvectors(spos, {x= 9, y=5, z= 9}),
|
||||||
|
vel = {x=0, y=-1, z=-1},
|
||||||
|
acc = {x=0, y=0, z=0},
|
||||||
|
playername = 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
|
||||||
|
local function calc_snowfall()
|
||||||
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
|
local ppos = player:getpos()
|
||||||
|
|
||||||
|
-- Make sure player is not in a cave/house...
|
||||||
|
if get_snow(ppos)
|
||||||
|
and minetest.get_node_light(ppos, 0.5) == 15 then
|
||||||
|
local animate
|
||||||
|
if not snow.lighter_snowfall then
|
||||||
|
local vel = {x=0, y=-1, z=-1}
|
||||||
|
local acc = {x=0, y=0, z=0}
|
||||||
|
minetest.add_particlespawner(get_snow_particledef({
|
||||||
|
amount = 5,
|
||||||
|
minpos = addvectors(ppos, {x=-9, y=3, z=-9}),
|
||||||
|
maxpos = addvectors(ppos, {x= 9, y=5, z= 9}),
|
||||||
|
vel = vel,
|
||||||
|
acc = acc,
|
||||||
|
size = 25,
|
||||||
|
playername = player:get_player_name()
|
||||||
|
}))
|
||||||
|
|
||||||
|
minetest.add_particlespawner(get_snow_particledef({
|
||||||
|
amount = 4,
|
||||||
|
minpos = addvectors(ppos, {x=-5, y=3.2, z=-5}),
|
||||||
|
maxpos = addvectors(ppos, {x= 5, y=1.6, z= 5}),
|
||||||
|
vel = vel,
|
||||||
|
acc = acc,
|
||||||
|
exptime = 4,
|
||||||
|
size = 25,
|
||||||
|
playername = player:get_player_name()
|
||||||
|
}))
|
||||||
|
|
||||||
|
animate = false
|
||||||
|
else
|
||||||
|
animate = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if math.random(1,5) == 4 then
|
||||||
|
snow_fall(
|
||||||
|
randpos(
|
||||||
|
addvectors(ppos, {x=-20, y=0, z=-20}),
|
||||||
|
addvectors(ppos, {x= 20, y=0, z= 20})
|
||||||
|
),
|
||||||
|
player,
|
||||||
|
animate
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
if snow.enable_snowfall then
|
||||||
|
calc_snowfall()
|
||||||
|
end
|
||||||
|
end)
|
160
mods/snow/src/mapgen.lua
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
--[[
|
||||||
|
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
|
||||||
|
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
|
||||||
|
saplings grow into trees. --]]
|
||||||
|
--The *starting* comment looks like this: --[[
|
||||||
|
--The *closing* comment looks like this: --]]
|
||||||
|
|
||||||
|
-- ~ LazyJ, 2014_05_13
|
||||||
|
|
||||||
|
|
||||||
|
--[[ Part 1: To disable the mapgen, add the *starting* comment under this line.
|
||||||
|
|
||||||
|
|
||||||
|
--Identify the mapgen.
|
||||||
|
minetest.register_on_mapgen_init(function(MapgenParams)
|
||||||
|
local mgname = MapgenParams.mgname
|
||||||
|
if not mgname then
|
||||||
|
io.write("[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!\n")
|
||||||
|
end
|
||||||
|
if mgname == "v7" then
|
||||||
|
--Load mapgen_v7 compatibility.
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/mapgen_v7.lua")
|
||||||
|
else
|
||||||
|
--Load mapgen_v6 compatibility.
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/mapgen_v6.lua")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- To complete the commenting-out add the *closing* comment under this line.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local pine_tree = {
|
||||||
|
axiom="TABff",
|
||||||
|
rules_a="[&T+f+ff+ff+ff+f]GA",
|
||||||
|
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
||||||
|
trunk="default:pinetree",
|
||||||
|
leaves="snow:needles",
|
||||||
|
angle=90,
|
||||||
|
iterations=1,
|
||||||
|
random_level=0,
|
||||||
|
trunk_type="single",
|
||||||
|
thin_branches=true,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local xmas_tree = {
|
||||||
|
axiom="TABff",
|
||||||
|
rules_a="[&T+f+ff+ff+ff+f]GA",
|
||||||
|
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
||||||
|
trunk="default:pinetree",
|
||||||
|
leaves="snow:needles_decorated",
|
||||||
|
angle=90,
|
||||||
|
iterations=1,
|
||||||
|
random_level=0,
|
||||||
|
trunk_type="single",
|
||||||
|
thin_branches=true,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Makes pine tree
|
||||||
|
function snow.make_pine(pos,snow,xmas)
|
||||||
|
local minetest = minetest
|
||||||
|
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
|
||||||
|
local try_node = function(pos, node)
|
||||||
|
local n = minetest.get_node(pos).name
|
||||||
|
if n == "air"
|
||||||
|
or n == "ignore" then
|
||||||
|
minetest.add_node(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if xmas then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
minetest.spawn_tree(pos, xmas_tree)
|
||||||
|
else
|
||||||
|
minetest.spawn_tree(pos, pine_tree)
|
||||||
|
end
|
||||||
|
if snow then
|
||||||
|
local x,z = pos.x,pos.z
|
||||||
|
try_node({x=x+1,y=pos.y+3,z=z+1},{name="default:snow"})
|
||||||
|
try_node({x=x-1,y=pos.y+3,z=z-1},{name="default:snow"})
|
||||||
|
try_node({x=x-1,y=pos.y+3,z=z+1},{name="default:snow"})
|
||||||
|
try_node({x=x+1,y=pos.y+3,z=z-1},{name="default:snow"})
|
||||||
|
|
||||||
|
try_node({x=x+1,y=pos.y+5,z=z},{name="default:snow"})
|
||||||
|
try_node({x=x-1,y=pos.y+5,z=z},{name="default:snow"})
|
||||||
|
try_node({x=x,y=pos.y+5,z=z+1},{name="default:snow"})
|
||||||
|
try_node({x=x,y=pos.y+5,z=z-1},{name="default:snow"})
|
||||||
|
end
|
||||||
|
if xmas then
|
||||||
|
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="snow:star_lit"}) -- Added lit star. ~ LazyJ
|
||||||
|
elseif snow
|
||||||
|
and perlin1:get2d({x=pos.x,y=pos.z}) > 0.53 then
|
||||||
|
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="default:snow"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Makes pine tree
|
||||||
|
function snow.voxelmanip_pine(pos,a,data)
|
||||||
|
local c_snow = minetest.get_content_id("default:snow")
|
||||||
|
local c_pine_needles = minetest.get_content_id("snow:needles")
|
||||||
|
local c_pinetree = minetest.get_content_id("default:pinetree")
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
|
||||||
|
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
|
||||||
|
for z = -1,1 do
|
||||||
|
local z = pos.z + z
|
||||||
|
for x = -1,1 do
|
||||||
|
local x = pos.x + x
|
||||||
|
|
||||||
|
--Make tree.
|
||||||
|
for i = 1,2 do
|
||||||
|
data[a:index(x,pos.y+i,z)] = c_pine_needles
|
||||||
|
if x ~= 0
|
||||||
|
and z ~= 0
|
||||||
|
and perlin1:get2d({x=x,y=z}) > 0.53 then
|
||||||
|
local abovenode = a:index(x,pos.y+i+1,z)
|
||||||
|
data[abovenode] = c_snow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i=3, 4 do
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y+i
|
||||||
|
local z = pos.z
|
||||||
|
data[a:index(x+1,y,z)] = c_pine_needles
|
||||||
|
data[a:index(x-1,y,z)] = c_pine_needles
|
||||||
|
data[a:index(x,y,z+1)] = c_pine_needles
|
||||||
|
data[a:index(x,y,z-1)] = c_pine_needles
|
||||||
|
if perlin1:get2d({x=x+1,y=z}) > 0.53 then
|
||||||
|
data[a:index(x+1,y+1,z)] = c_snow
|
||||||
|
end
|
||||||
|
if perlin1:get2d({x=x+1,y=z}) > 0.53 then
|
||||||
|
data[a:index(x-1,y+1,z)] = c_snow
|
||||||
|
end
|
||||||
|
if perlin1:get2d({x=x,y=z+1}) > 0.53 then
|
||||||
|
data[a:index(x,y+1,z+1)] = c_snow
|
||||||
|
end
|
||||||
|
if perlin1:get2d({x=x,y=z-1}) > 0.53 then
|
||||||
|
data[a:index(x,y+1,z-1)] = c_snow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i=0, 4 do
|
||||||
|
data[a:index(pos.x,pos.y+i,pos.z)] = c_pinetree
|
||||||
|
end
|
||||||
|
data[a:index(pos.x,pos.y+5,pos.z)] = c_pine_needles
|
||||||
|
data[a:index(pos.x,pos.y+6,pos.z)] = c_pine_needles
|
||||||
|
if perlin1:get2d({x=pos.x,y=pos.z}) > 0.53 then
|
||||||
|
data[a:index(pos.x,pos.y+7,pos.z)] = c_snow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
]]
|
486
mods/snow/src/mapgen_v6.lua
Executable file
@ -0,0 +1,486 @@
|
|||||||
|
-- https://github.com/paramat/meru/blob/master/init.lua#L52
|
||||||
|
--[[ Parameters must match mgv6 biome noise
|
||||||
|
local np_default = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {x=250, y=250, z=250},
|
||||||
|
seed = 9130,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
-- 2D noise for coldness
|
||||||
|
|
||||||
|
local np_cold = {
|
||||||
|
offset = 0,
|
||||||
|
scale = -1,
|
||||||
|
spread = {x=256, y=256, z=256},
|
||||||
|
seed = 112,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
-- 2D noise for icetype
|
||||||
|
|
||||||
|
local np_ice = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 1,
|
||||||
|
spread = {x=80, y=80, z=80},
|
||||||
|
seed = 322345,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Debugging function
|
||||||
|
|
||||||
|
local biome_strings = {
|
||||||
|
{"snowy", "plain", "alpine", "normal", "normal"},
|
||||||
|
{"cool", "icebergs", "icesheet", "icecave", "icehole"}
|
||||||
|
}
|
||||||
|
local function biome_to_string(num,num2)
|
||||||
|
local biome = biome_strings[1][num] or "unknown "..num
|
||||||
|
return biome
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function do_ws_func(a, x)
|
||||||
|
local n = x/(16000)
|
||||||
|
local y = 0
|
||||||
|
for k=1,1000 do
|
||||||
|
y = y + 1000*math.sin(math.pi * k^a * n)/(math.pi * k^a)
|
||||||
|
end
|
||||||
|
return y
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local plantlike_ids = {}
|
||||||
|
local function is_plantlike(id)
|
||||||
|
if plantlike_ids[id] ~= nil then
|
||||||
|
return plantlike_ids[id]
|
||||||
|
end
|
||||||
|
local node = minetest.registered_nodes[minetest.get_name_from_content_id(id)]
|
||||||
|
if not node then
|
||||||
|
plantlike_ids[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local drawtype = node.drawtype
|
||||||
|
if not drawtype
|
||||||
|
or drawtype ~= "plantlike" then
|
||||||
|
plantlike_ids[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
plantlike_ids[id] = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local snowable_ids = {}
|
||||||
|
local function is_snowable(id)
|
||||||
|
if snowable_ids[id] ~= nil then
|
||||||
|
return snowable_ids[id]
|
||||||
|
end
|
||||||
|
local node = minetest.registered_nodes[minetest.get_name_from_content_id(id)]
|
||||||
|
if not node then
|
||||||
|
snowable_ids[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local drawtype = node.drawtype
|
||||||
|
if drawtype
|
||||||
|
and drawtype ~= "normal"
|
||||||
|
and drawtype ~= "allfaces_optional"
|
||||||
|
and drawtype ~= "glasslike" then
|
||||||
|
snowable_ids[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
snowable_ids[id] = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local c, replacements
|
||||||
|
local function define_contents()
|
||||||
|
c = {
|
||||||
|
dirt_with_grass = minetest.get_content_id("default:dirt_with_grass"),
|
||||||
|
dirt = minetest.get_content_id("default:dirt"),
|
||||||
|
tree = minetest.get_content_id("default:tree"),
|
||||||
|
apple = minetest.get_content_id("default:apple"),
|
||||||
|
snow = minetest.get_content_id("default:snow"),
|
||||||
|
snow_block = minetest.get_content_id("default:snowblock"),
|
||||||
|
dirt_with_snow = minetest.get_content_id("default:dirt_with_snow"),
|
||||||
|
air = minetest.get_content_id("air"),
|
||||||
|
ignore = minetest.get_content_id("ignore"),
|
||||||
|
stone = minetest.get_content_id("default:stone"),
|
||||||
|
dry_shrub = minetest.get_content_id("default:dry_shrub"),
|
||||||
|
snow_shrub = minetest.get_content_id("snow:shrub_covered"),
|
||||||
|
leaves = minetest.get_content_id("default:leaves"),
|
||||||
|
jungleleaves = minetest.get_content_id("default:jungleleaves"),
|
||||||
|
junglegrass = minetest.get_content_id("default:junglegrass"),
|
||||||
|
ice = minetest.get_content_id("default:ice"),
|
||||||
|
water = minetest.get_content_id("default:water_source"),
|
||||||
|
papyrus = minetest.get_content_id("default:papyrus"),
|
||||||
|
sand = minetest.get_content_id("default:sand"),
|
||||||
|
desert_sand = minetest.get_content_id("default:desert_sand"),
|
||||||
|
}
|
||||||
|
replacements = snow.known_plants or {}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
local t1 = os.clock()
|
||||||
|
|
||||||
|
local x0 = minp.x
|
||||||
|
local z0 = minp.z
|
||||||
|
local x1 = maxp.x
|
||||||
|
local z1 = maxp.z
|
||||||
|
|
||||||
|
local smooth = snow.smooth_biomes
|
||||||
|
|
||||||
|
if not c then
|
||||||
|
define_contents()
|
||||||
|
end
|
||||||
|
|
||||||
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
local param2s = vm:get_param2_data()
|
||||||
|
|
||||||
|
local snow_tab,num = {},1
|
||||||
|
local pines_tab,pnum = {},1
|
||||||
|
|
||||||
|
local sidelen = x1 - x0 + 1
|
||||||
|
local chulens = {x=sidelen, y=sidelen, z=sidelen}
|
||||||
|
local nvals_default = minetest.get_perlin_map(np_default, chulens):get2dMap_flat({x=x0+150, y=z0+50})
|
||||||
|
local nvals_cold, nvals_ice
|
||||||
|
|
||||||
|
-- Choose biomes
|
||||||
|
local pr = PseudoRandom(seed+57)
|
||||||
|
-- Land biomes
|
||||||
|
local biome = pr:next(1, 5)
|
||||||
|
local snowy = biome == 1 -- spawns snow
|
||||||
|
local alpine = biome == 3 -- rocky terrain
|
||||||
|
-- Misc biome settings
|
||||||
|
local icy = pr:next(1, 2) == 2 -- if enabled spawns ice in sand instead of snow blocks
|
||||||
|
local shrubs = pr:next(1,2) == 1 -- spawns dry shrubs in snow
|
||||||
|
local pines = pr:next(1,2) == 1 -- spawns pines
|
||||||
|
-- Reseed random
|
||||||
|
pr = PseudoRandom(seed+68)
|
||||||
|
|
||||||
|
-- Loop through columns in chunk
|
||||||
|
local write_to_map = false
|
||||||
|
local ni = 1
|
||||||
|
for z = z0, z1 do
|
||||||
|
for x = x0, x1 do
|
||||||
|
local in_biome = false
|
||||||
|
local test
|
||||||
|
if nvals_default[ni] < 0.35 then
|
||||||
|
if not nvals_cold then
|
||||||
|
nvals_cold = minetest.get_perlin_map(np_cold, chulens):get2dMap_flat({x=x0, y=z0})
|
||||||
|
end
|
||||||
|
test = math.min(nvals_cold[ni], 1)
|
||||||
|
if smooth
|
||||||
|
and not snowy then
|
||||||
|
if (test > 0.73 or (test > 0.43 and pr:next(0,29) > (0.73 - test) * 100 )) then
|
||||||
|
in_biome = true
|
||||||
|
end
|
||||||
|
elseif test > 0.53 then
|
||||||
|
in_biome = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not in_biome then
|
||||||
|
if alpine
|
||||||
|
and test
|
||||||
|
and test > 0.43 then
|
||||||
|
-- remove trees near alpine
|
||||||
|
local ground_y = nil
|
||||||
|
for y = maxp.y, minp.y, -1 do
|
||||||
|
local nodid = data[area:index(x, y, z)]
|
||||||
|
if nodid ~= c.air
|
||||||
|
and nodid ~= c.ignore then
|
||||||
|
ground_y = y
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ground_y == maxp.y then -- avoid awful snow layers at chunk boundaries underground
|
||||||
|
ground_y = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if ground_y then
|
||||||
|
local vi = area:index(x, ground_y, z)
|
||||||
|
if data[vi] == c.leaves
|
||||||
|
or data[vi] == c.jungleleaves then
|
||||||
|
for y = ground_y, -16, -1 do
|
||||||
|
local vi = area:index(x, y, z)
|
||||||
|
local id = data[vi]
|
||||||
|
if id ~= c.air then
|
||||||
|
if id == c.leaves
|
||||||
|
or id == c.jungleleaves
|
||||||
|
or id == c.tree
|
||||||
|
or id == c.apple then
|
||||||
|
data[vi] = c.air
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
write_to_map = true
|
||||||
|
if not nvals_ice then
|
||||||
|
nvals_ice = minetest.get_perlin_map(np_ice, chulens):get2dMap_flat({x=x0, y=z0})
|
||||||
|
end
|
||||||
|
local icetype = nvals_ice[ni]
|
||||||
|
local cool = icetype > 0 -- only spawns ice on edge of water
|
||||||
|
local icebergs = icetype > -0.2 and icetype <= 0
|
||||||
|
local icehole = icetype > -0.4 and icetype <= -0.2 -- icesheet with holes
|
||||||
|
local icesheet = icetype > -0.6 and icetype <= -0.4
|
||||||
|
local icecave = icetype <= -0.6
|
||||||
|
|
||||||
|
local ground_y
|
||||||
|
for y = maxp.y, minp.y, -1 do
|
||||||
|
local nodid = data[area:index(x, y, z)]
|
||||||
|
if nodid ~= c.air and nodid ~= c.ignore then
|
||||||
|
ground_y = y
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ground_y == maxp.y then -- avoid awful snow layers at chunk boundaries underground
|
||||||
|
ground_y = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if ground_y then
|
||||||
|
local node = area:index(x, ground_y, z)
|
||||||
|
local c_ground = data[node]
|
||||||
|
|
||||||
|
if c_ground == c.dirt_with_grass then
|
||||||
|
if alpine
|
||||||
|
and test > 0.53 then
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
-- generate stone ground
|
||||||
|
for y = ground_y, math.max(-6, minp.y-6), -1 do
|
||||||
|
local vi = area:index(x, y, z)
|
||||||
|
if data[vi] == c.stone then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
data[vi] = c.stone
|
||||||
|
end
|
||||||
|
elseif pines
|
||||||
|
and pr:next(1,36) == 1 then
|
||||||
|
pines_tab[pnum] = {x=x, y=ground_y+1, z=z}
|
||||||
|
pnum = pnum+1
|
||||||
|
elseif shrubs
|
||||||
|
and pr:next(1,928) == 1 then
|
||||||
|
data[node] = c.dirt_with_snow
|
||||||
|
data[area:index(x, ground_y+1, z)] = c.dry_shrub
|
||||||
|
else
|
||||||
|
if snowy
|
||||||
|
or test > 0.8 then
|
||||||
|
-- more, deeper snow
|
||||||
|
data[node] = c.snow_block
|
||||||
|
else
|
||||||
|
data[node] = c.dirt_with_snow
|
||||||
|
end
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
end
|
||||||
|
elseif c_ground == c.water then
|
||||||
|
if not icesheet
|
||||||
|
and not icecave
|
||||||
|
and not icehole then
|
||||||
|
local nds = {
|
||||||
|
data[area:index(x+1, ground_y, z)],
|
||||||
|
data[area:index(x, ground_y, z+1)],
|
||||||
|
data[area:index(x+1, ground_y, z+1)],
|
||||||
|
data[area:index(x-1, ground_y, z-1)],
|
||||||
|
data[area:index(x-1, ground_y, z)],
|
||||||
|
data[area:index(x, ground_y, z-1)],
|
||||||
|
}
|
||||||
|
local ice
|
||||||
|
if pr:next(1,4) == 1
|
||||||
|
and (cool or icebergs) then
|
||||||
|
for _,i in ipairs(nds) do
|
||||||
|
if i == c.ice then
|
||||||
|
ice = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not ice then
|
||||||
|
for _,i in ipairs(nds) do
|
||||||
|
if i ~= c.water
|
||||||
|
and i ~= c.ice
|
||||||
|
and i ~= c.air
|
||||||
|
and i ~= c.ignore then
|
||||||
|
ice = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local y = data[area:index(x, ground_y-1, z)]
|
||||||
|
if ice
|
||||||
|
or (y ~= c.water and y ~= c.ice) -- and y ~= "air") …I don't think y can be a string here ~HybridDog
|
||||||
|
or (icebergs and pr:next(1,6) == 1) then
|
||||||
|
data[node] = c.ice
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if icesheet
|
||||||
|
or icecave
|
||||||
|
or (icehole and pr:next(1,10) > 1) then
|
||||||
|
data[node] = c.ice
|
||||||
|
end
|
||||||
|
if icecave then
|
||||||
|
for y = ground_y-1, -33, -1 do
|
||||||
|
local vi = area:index(x, y, z)
|
||||||
|
if data[vi] ~= c.water then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
data[vi] = c.air
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if icesheet then
|
||||||
|
-- put snow onto icesheets
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif c_ground == c.sand then
|
||||||
|
if icy then
|
||||||
|
data[node] = c.ice
|
||||||
|
end
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
elseif c_ground == c.papyrus then
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
-- replace papyrus plants with snowblocks
|
||||||
|
local y = ground_y
|
||||||
|
for _ = 1,7 do
|
||||||
|
local vi = area:index(x, y, z)
|
||||||
|
if data[vi] == c.papyrus then
|
||||||
|
data[vi] = c.snow_block
|
||||||
|
y = y-1
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif alpine then
|
||||||
|
-- make stone pillars out of trees and other stuff
|
||||||
|
for y = ground_y, math.max(-6, minp.y-6), -1 do
|
||||||
|
local stone = area:index(x, y, z)
|
||||||
|
if data[stone] == c.stone then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
data[stone] = c.stone
|
||||||
|
end
|
||||||
|
-- put snow onto it
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
elseif c_ground ~= c.desert_sand then
|
||||||
|
if is_snowable(c_ground) then
|
||||||
|
-- put snow onto it
|
||||||
|
snow_tab[num] = {ground_y, z, x, test}
|
||||||
|
num = num+1
|
||||||
|
end
|
||||||
|
for y = 0, 12 do
|
||||||
|
y = ground_y-y
|
||||||
|
local vi = area:index(x, y, z)
|
||||||
|
local nd = data[vi]
|
||||||
|
local plantlike = is_plantlike(nd)
|
||||||
|
if replacements[nd] then
|
||||||
|
data[vi] = replacements[nd]
|
||||||
|
if plantlike then
|
||||||
|
param2s[vi] = pr:next(0,179)
|
||||||
|
end
|
||||||
|
elseif nd == c.dirt_with_grass then
|
||||||
|
data[vi] = c.dirt_with_snow
|
||||||
|
break
|
||||||
|
elseif plantlike then
|
||||||
|
local under = area:index(x, y-1, z)
|
||||||
|
if data[under] == c.dirt_with_grass then
|
||||||
|
-- replace other plants with shrubs
|
||||||
|
data[vi] = c.snow_shrub
|
||||||
|
param2s[vi] = pr:next(0,179)
|
||||||
|
data[under] = c.dirt_with_snow
|
||||||
|
break
|
||||||
|
end
|
||||||
|
elseif nd == c.stone then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ni = ni + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if num ~= 1 then
|
||||||
|
for _,i in pairs(snow_tab) do
|
||||||
|
-- set snow
|
||||||
|
data[area:index(i[3], i[1]+1, i[2])] = c.snow
|
||||||
|
end
|
||||||
|
local wsz, wsx
|
||||||
|
for _,i in pairs(snow_tab) do
|
||||||
|
local y,z,x,test = unpack(i)
|
||||||
|
test = (test-0.53)/0.47 -- /(1-0.53)
|
||||||
|
if test > 0 then
|
||||||
|
local maxh = math.floor(test*10)%10+1
|
||||||
|
if maxh ~= 1 then
|
||||||
|
local h = math.floor( do_ws_func(2, x) + do_ws_func(5, z)*5)%10+1
|
||||||
|
if h ~= 1 then
|
||||||
|
-- search for nearby snow
|
||||||
|
y = y+1
|
||||||
|
for i = -1,1,2 do
|
||||||
|
for _,cord in pairs({{x+i,z}, {x,z+i}}) do
|
||||||
|
local nd = data[area:index(cord[1], y, cord[2])]
|
||||||
|
if nd == c.air
|
||||||
|
or is_plantlike(nd) then
|
||||||
|
h = h/2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
h = math.floor(h+0.5)
|
||||||
|
if h > 1 then
|
||||||
|
-- make snowdrifts walkable
|
||||||
|
if h == 10 then
|
||||||
|
h = 5
|
||||||
|
end
|
||||||
|
h = math.min(maxh, h)
|
||||||
|
local vi = area:index(x, y, z)
|
||||||
|
if h == 9 then
|
||||||
|
-- replace the snow with a snowblock because its a full node
|
||||||
|
data[vi] = c.snow_block
|
||||||
|
else
|
||||||
|
-- set a specific snow height
|
||||||
|
param2s[vi] = h*7
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- spawn pines
|
||||||
|
if pines
|
||||||
|
and pnum ~= 1 then
|
||||||
|
local spawn_pine = snow.voxelmanip_pine
|
||||||
|
for _,pos in pairs(pines_tab) do
|
||||||
|
spawn_pine(pos, area, data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:set_param2_data(param2s)
|
||||||
|
vm:set_lighting({day=0, night=0})
|
||||||
|
vm:calc_lighting()
|
||||||
|
vm:write_to_map()
|
||||||
|
|
||||||
|
if write_to_map
|
||||||
|
and snow.debug then -- print if any column of mapchunk was snow biome
|
||||||
|
local biome_string = biome_to_string(biome)
|
||||||
|
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||||
|
print("[snow] "..biome_string.." x "..minp.x.." z "..minp.z.." time "..chugent.." ms")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
138
mods/snow/src/mapgen_v7.lua
Executable file
@ -0,0 +1,138 @@
|
|||||||
|
minetest.register_biome({
|
||||||
|
name = "snow_biome_default",
|
||||||
|
|
||||||
|
node_top = "default:dirt_with_snow",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "default:dirt",
|
||||||
|
depth_filler = 2,
|
||||||
|
|
||||||
|
height_min = snow.min_height,
|
||||||
|
height_max = snow.min_height+60,
|
||||||
|
heat_point = 10.0,
|
||||||
|
humidity_point = 40.0,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_biome({
|
||||||
|
name = "snow_biome_forest",
|
||||||
|
|
||||||
|
node_top = "default:dirt_with_snow",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "default:dirt",
|
||||||
|
depth_filler = 2,
|
||||||
|
|
||||||
|
height_min = snow.min_height,
|
||||||
|
height_max = snow.min_height+60,
|
||||||
|
heat_point = 10.0,
|
||||||
|
humidity_point = 55.0,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_biome({
|
||||||
|
name = "snow_biome_lush",
|
||||||
|
|
||||||
|
node_top = "default:dirt_with_snow",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "default:dirt",
|
||||||
|
depth_filler = 2,
|
||||||
|
|
||||||
|
height_min = snow.min_height,
|
||||||
|
height_max = snow.min_height+60,
|
||||||
|
heat_point = 10.0,
|
||||||
|
humidity_point = 70.0,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_biome({
|
||||||
|
name = "snow_biome_alpine",
|
||||||
|
|
||||||
|
node_top = "default:stone",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "default:stone",
|
||||||
|
|
||||||
|
height_min = snow.min_height+60,
|
||||||
|
height_max = 31000,
|
||||||
|
heat_point = 10.0,
|
||||||
|
humidity_point = 40.0,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_biome({
|
||||||
|
name = "snow_biome_sand",
|
||||||
|
|
||||||
|
node_top = "default:sand",
|
||||||
|
depth_top = 3,
|
||||||
|
node_filler = "default:stone",
|
||||||
|
depth_filler = 0,
|
||||||
|
|
||||||
|
height_min = -31000,
|
||||||
|
height_max = 2,
|
||||||
|
heat_point = 10.0,
|
||||||
|
humidity_point = 40.0,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--Pine tree.
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.005,
|
||||||
|
biomes = {"snow_biome_default"},
|
||||||
|
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.05,
|
||||||
|
biomes = {"snow_biome_forest"},
|
||||||
|
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.1,
|
||||||
|
biomes = {"snow_biome_lush"},
|
||||||
|
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
})
|
||||||
|
|
||||||
|
--Dry shrubs.
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.005,
|
||||||
|
biomes = {"snow_biome_default"},
|
||||||
|
decoration = "default:dry_shrub",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.05,
|
||||||
|
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||||
|
decoration = "default:dry_shrub",
|
||||||
|
})
|
||||||
|
|
||||||
|
--Snow.
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 10,
|
||||||
|
biomes = {"snow_biome_default", "snow_biome_forest", "snow_biome_lush"},
|
||||||
|
decoration = "default:snow",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = "default:stone",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 10,
|
||||||
|
biomes = {"snow_biome_alpine"},
|
||||||
|
decoration = "default:snow",
|
||||||
|
})
|
360
mods/snow/src/nodes.lua
Executable file
@ -0,0 +1,360 @@
|
|||||||
|
-- NODES
|
||||||
|
|
||||||
|
-- Pine Needles
|
||||||
|
local nodedef = {
|
||||||
|
description = "Pine Needles",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
visual_scale = 1.3,
|
||||||
|
tiles = {"snow_needles.png"},
|
||||||
|
waving = 1,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, leafdecay=5},
|
||||||
|
furnace_burntime = 1,
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{
|
||||||
|
-- player will get sapling with 1/20 chance
|
||||||
|
items = {'snow:sapling_pine'},
|
||||||
|
rarity = 20,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
items = {'snow:needles'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
}
|
||||||
|
|
||||||
|
--[[
|
||||||
|
If christmas_content is enabled, then this next part will override the pine needles' drop code
|
||||||
|
(in the code section above) and adds Xmas tree saplings to the items that are dropped.
|
||||||
|
The Xmas tree needles are registred and defined a farther down in this nodes.lua file.
|
||||||
|
|
||||||
|
~ LazyJ
|
||||||
|
]]
|
||||||
|
if snow.christmas_content then
|
||||||
|
table.insert(nodedef.drop.items, 1, {
|
||||||
|
-- player will get xmas tree with 1/120 chance
|
||||||
|
items = {'snow:xmas_tree'},
|
||||||
|
rarity = 120,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("snow:needles", table.copy(nodedef))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--Christmas easter egg
|
||||||
|
minetest.register_on_mapgen_init( function()
|
||||||
|
if rawget(_G, "skins") then
|
||||||
|
skins.add("character_snow_man")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
-- Decorated Pine Leaves
|
||||||
|
|
||||||
|
nodedef.description ="Decorated "..nodedef.description
|
||||||
|
nodedef.light_source = 5
|
||||||
|
nodedef.waving = nil
|
||||||
|
if snow.disable_deco_needle_ani then
|
||||||
|
nodedef.tiles = {"snow_needles_decorated.png"}
|
||||||
|
else
|
||||||
|
-- Animated, "blinking lights" version. ~ LazyJ
|
||||||
|
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
|
||||||
|
nodedef.tiles = {
|
||||||
|
{name="snow_needles_decorated_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=20.0}}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
||||||
|
|
||||||
|
minetest.register_node("snow:needles_decorated", nodedef)
|
||||||
|
|
||||||
|
|
||||||
|
-- Saplings
|
||||||
|
|
||||||
|
nodedef = {
|
||||||
|
description = "Pine Sapling",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1.0,
|
||||||
|
tiles = {"snow_sapling_pine.png"},
|
||||||
|
inventory_image = "snow_sapling_pine.png",
|
||||||
|
wield_image = "snow_sapling_pine.png",
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
groups = {snappy=2,dig_immediate=3},
|
||||||
|
furnace_burntime = 10,
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Pine Sapling
|
||||||
|
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
|
||||||
|
|
||||||
|
-- Xmas Tree Sapling
|
||||||
|
nodedef.description = "Christmas Tree"
|
||||||
|
nodedef.tiles = {"snow_xmas_tree.png"}
|
||||||
|
nodedef.inventory_image = "snow_xmas_tree.png"
|
||||||
|
nodedef.wield_image = "snow_xmas_tree.png"
|
||||||
|
|
||||||
|
minetest.register_node("snow:xmas_tree", nodedef)
|
||||||
|
|
||||||
|
|
||||||
|
nodedef = {
|
||||||
|
description = "Star",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"snow_star.png"},
|
||||||
|
inventory_image = "snow_star.png",
|
||||||
|
wield_image = "snow_star.png",
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
-- Don't want the ornament breaking too easily because you have to punch it to turn it on and off. ~ LazyJ
|
||||||
|
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1},
|
||||||
|
-- Breaking "glass" sound makes it sound like a real, broken, Xmas tree ornament (Sorry, Mom!). ;)- ~ LazyJ
|
||||||
|
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}),
|
||||||
|
on_punch = function(pos, node) -- Added a "lit" star that can be punched on or off depending on your preference. ~ LazyJ
|
||||||
|
node.name = "snow:star_lit"
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
nodeupdate(pos)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Star on Xmas Trees
|
||||||
|
minetest.register_node("snow:star", table.copy(nodedef))
|
||||||
|
|
||||||
|
-- Star (Lit Version) on Xmas Trees
|
||||||
|
nodedef.description = nodedef.description.." Lighted"
|
||||||
|
nodedef.light_source = LIGHT_MAX
|
||||||
|
nodedef.tiles = {"snow_star_lit.png"}
|
||||||
|
nodedef.drop = "snow:star"
|
||||||
|
nodedef.groups.not_in_creative_inventory = 1
|
||||||
|
nodedef.on_punch = function(pos, node)
|
||||||
|
node.name = "snow:star"
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
nodeupdate(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("snow:star_lit", nodedef)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Plants
|
||||||
|
|
||||||
|
-- Moss
|
||||||
|
minetest.register_node("snow:moss", {
|
||||||
|
description = "Moss",
|
||||||
|
inventory_image = "snow_moss.png",
|
||||||
|
tiles = {"snow_moss.png"},
|
||||||
|
drawtype = "signlike",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=3, attached_node=1},
|
||||||
|
furnace_burntime = 3,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Shrub(s)
|
||||||
|
nodedef = {
|
||||||
|
description = "Snow Shrub",
|
||||||
|
tiles = {"snow_shrub.png"},
|
||||||
|
inventory_image = "snow_shrub.png",
|
||||||
|
wield_image = "snow_shrub.png",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
paramtype = "light",
|
||||||
|
waving = 1,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
is_ground_content = true,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=3,attached_node=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.3, -0.5, -0.3, 0.3, -5/16, 0.3},
|
||||||
|
},
|
||||||
|
furnace_burntime = 5,
|
||||||
|
}
|
||||||
|
minetest.register_node("snow:shrub", table.copy(nodedef))
|
||||||
|
|
||||||
|
nodedef.tiles = {"snow_shrub.png^snow_shrub_covering.png"}
|
||||||
|
nodedef.inventory_image = "snow_shrub.png^snow_shrub_covering.png"
|
||||||
|
nodedef.wield_image = "snow_shrub.png^snow_shrub_covering.png"
|
||||||
|
nodedef.drop = "snow:shrub"
|
||||||
|
nodedef.furnace_burntime = 3
|
||||||
|
minetest.register_node("snow:shrub_covered", nodedef)
|
||||||
|
|
||||||
|
-- Flowers
|
||||||
|
if rawget(_G, "flowers") then
|
||||||
|
-- broken flowers
|
||||||
|
snow.known_plants = {}
|
||||||
|
for _,name in pairs({"dandelion_yellow", "geranium", "rose", "tulip", "dandelion_white", "viola"}) do
|
||||||
|
local flowername = "flowers:"..name
|
||||||
|
local newname = "snow:flower_"..name
|
||||||
|
local flower = minetest.registered_nodes[flowername]
|
||||||
|
minetest.register_node(newname, {
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "snow_" .. name .. ".png" },
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
drop = "",
|
||||||
|
groups = {snappy=3, attached_node = 1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = flower.selection_box
|
||||||
|
})
|
||||||
|
snow.known_plants[minetest.get_content_id(flowername)] = minetest.get_content_id(newname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Leaves
|
||||||
|
local leaves = minetest.registered_nodes["default:leaves"]
|
||||||
|
nodedef = {
|
||||||
|
description = "Snow Leaves",
|
||||||
|
tiles = {"snow_leaves.png"},
|
||||||
|
waving = 1,
|
||||||
|
visual_scale = leaves.visual_scale,
|
||||||
|
drawtype = leaves.drawtype,
|
||||||
|
paramtype = leaves.paramtype,
|
||||||
|
groups = leaves.groups,
|
||||||
|
drop = leaves.drop,
|
||||||
|
sounds = leaves.sounds,
|
||||||
|
}
|
||||||
|
nodedef.groups.flammable = 1
|
||||||
|
|
||||||
|
minetest.register_node("snow:leaves", nodedef)
|
||||||
|
snow.known_plants[minetest.get_content_id("default:leaves")] = minetest.get_content_id("snow:leaves")
|
||||||
|
|
||||||
|
local apple = minetest.registered_nodes["default:apple"]
|
||||||
|
nodedef = {
|
||||||
|
description = "Snow Apple",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"snow_apple.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
sunlight_propagates = apple.sunlight_propagates,
|
||||||
|
selection_box = apple.selection_box,
|
||||||
|
groups = apple.groups,
|
||||||
|
sounds = apple.sounds,
|
||||||
|
drop = apple.drop,
|
||||||
|
}
|
||||||
|
nodedef.groups.flammable = 1
|
||||||
|
|
||||||
|
minetest.register_node("snow:apple", nodedef)
|
||||||
|
snow.known_plants[minetest.get_content_id("default:apple")] = minetest.get_content_id("snow:apple")
|
||||||
|
|
||||||
|
-- TODO
|
||||||
|
snow.known_plants[minetest.get_content_id("default:jungleleaves")] = minetest.get_content_id("default:jungleleaves")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function snow_onto_dirt(pos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "default:dirt_with_grass"
|
||||||
|
or node.name == "default:dirt" then
|
||||||
|
node.name = "default:dirt_with_snow"
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Bricks
|
||||||
|
|
||||||
|
nodedef = {
|
||||||
|
description = "Snow Brick",
|
||||||
|
tiles = {"snow_snow_brick.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
--freezemelt = "default:water_source", -- deprecated
|
||||||
|
liquidtype = "none",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype2 = "facedir", -- Allow blocks to be rotated with the screwdriver or
|
||||||
|
-- by player position. ~ LazyJ
|
||||||
|
-- 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
|
||||||
|
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
|
||||||
|
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}
|
||||||
|
}),
|
||||||
|
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could also
|
||||||
|
-- double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
|
||||||
|
on_construct = snow_onto_dirt
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Snow Brick
|
||||||
|
minetest.register_node("snow:snow_brick", table.copy(nodedef))
|
||||||
|
|
||||||
|
|
||||||
|
-- hard Ice Brick, original texture from LazyJ
|
||||||
|
local ibdef = table.copy(nodedef)
|
||||||
|
ibdef.description = "Ice Brick"
|
||||||
|
ibdef.tiles = {"snow_ice_brick.png"}
|
||||||
|
ibdef.use_texture_alpha = true
|
||||||
|
ibdef.drawtype = "glasslike"
|
||||||
|
ibdef.groups = {cracky=1, crumbly=1, choppy=1, melts=1}
|
||||||
|
ibdef.sounds = default.node_sound_glass_defaults({
|
||||||
|
dug = {name="default_hard_footstep", gain=1}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("snow:ice_brick", ibdef)
|
||||||
|
|
||||||
|
|
||||||
|
-- Snow Cobble ~ LazyJ
|
||||||
|
-- Described as Icy Snow
|
||||||
|
nodedef.description = "Icy Snow"
|
||||||
|
nodedef.tiles = {"snow_snow_cobble.png"}
|
||||||
|
|
||||||
|
minetest.register_node("snow:snow_cobble", nodedef)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Override Default Nodes to Add Extra Functions
|
||||||
|
|
||||||
|
-- This adds code to the existing default ice. ~ LazyJ
|
||||||
|
minetest.override_item("default:ice", {
|
||||||
|
-- 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
|
||||||
|
use_texture_alpha = true, -- 1
|
||||||
|
param2 = 0,
|
||||||
|
--param2 is reserved for how much ice will freezeover.
|
||||||
|
sunlight_propagates = true, -- 2
|
||||||
|
drawtype = "glasslike",
|
||||||
|
inventory_image = minetest.inventorycube("default_ice.png").."^[brighten",
|
||||||
|
liquidtype = "none",
|
||||||
|
-- I made this a lot harder to dig than snow blocks because ice is much more dense
|
||||||
|
-- and solid than fluffy snow. ~ LazyJ
|
||||||
|
groups = {cracky=2, crumbly=1, choppy=1, --[[oddly_breakable_by_hand=1,]] melts=1},
|
||||||
|
on_construct = snow_onto_dirt,
|
||||||
|
liquids_pointable = true,
|
||||||
|
--Make ice freeze over when placed by a maximum of 10 blocks.
|
||||||
|
after_place_node = function(pos)
|
||||||
|
minetest.set_node(pos, {name="default:ice", param2=math.random(0,10)})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- This adds code to the existing, default snowblock. ~ LazyJ
|
||||||
|
minetest.override_item("default:snowblock", {
|
||||||
|
liquidtype = "none", -- LazyJ to make dirt below change to dirt_with_snow (see default, nodes.lua, dirt ABM)
|
||||||
|
paramtype = "light", -- LazyJ to make dirt below change to dirt_with_snow (see default, nodes.lua, dirt ABM)
|
||||||
|
sunlight_propagates = true, -- LazyJ to make dirt below change to dirt_with_snow (see default, nodes.lua, dirt ABM)
|
||||||
|
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
|
||||||
|
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",
|
||||||
|
on_construct = snow_onto_dirt
|
||||||
|
-- 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
|
||||||
|
})
|
231
mods/snow/src/sled.lua
Executable file
@ -0,0 +1,231 @@
|
|||||||
|
--[[
|
||||||
|
--=================
|
||||||
|
--======================================
|
||||||
|
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
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* 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 not assembled in the right 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
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
* 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?
|
||||||
|
|
||||||
|
* 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
|
||||||
|
little tweak there" project has evolved into something much bigger and more complex
|
||||||
|
than I originally planned. :p ~ LazyJ
|
||||||
|
|
||||||
|
* find out why the sled disappears after rightclicking it ~ HybridDog
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--=============================================================
|
||||||
|
-- CODE STUFF
|
||||||
|
--=============================================================
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Helper functions
|
||||||
|
--
|
||||||
|
|
||||||
|
vector.zero = vector.zero or {x=0, y=0, z=0}
|
||||||
|
|
||||||
|
local function table_find(t, v)
|
||||||
|
for i = 1,#t do
|
||||||
|
if t[i] == v then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_water(pos)
|
||||||
|
return minetest.get_item_group(minetest.get_node(pos).name, "water") ~= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Sled entity
|
||||||
|
--
|
||||||
|
|
||||||
|
local sled = {
|
||||||
|
physical = true,
|
||||||
|
collisionbox = {-0.6,-0.25,-0.6, 0.6,0.3,0.6},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "sled.x",
|
||||||
|
textures = {"sled.png"},
|
||||||
|
}
|
||||||
|
|
||||||
|
local players_sled = {}
|
||||||
|
local function join_sled(self, player)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
player:setpos(pos)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
players_sled[name] = true
|
||||||
|
default.player_attached[name] = true
|
||||||
|
default.player_set_animation(player, "sit" , 30)
|
||||||
|
self.driver = name
|
||||||
|
self.object:set_attach(player, "", {x=0,y=-9,z=0}, {x=0,y=90,z=0})
|
||||||
|
self.object:setyaw(player:get_look_yaw())-- - math.pi/2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function leave_sled(self, player)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
players_sled[name] = false
|
||||||
|
self.driver = nil
|
||||||
|
self.object:set_detach()
|
||||||
|
default.player_attached[name] = false
|
||||||
|
default.player_set_animation(player, "stand" , 30)
|
||||||
|
|
||||||
|
player:set_physics_override({
|
||||||
|
speed = 1,
|
||||||
|
jump = 1,
|
||||||
|
})
|
||||||
|
player:hud_remove(self.HUD) -- And here is part 2. ~ LazyJ
|
||||||
|
self.object:remove()
|
||||||
|
|
||||||
|
--Give the sled back again
|
||||||
|
player:get_inventory():add_item("main", "snow:sled")
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:on_rightclick(player)
|
||||||
|
if self.driver
|
||||||
|
or not snow.sleds then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
join_sled(self, player)
|
||||||
|
player:set_physics_override({
|
||||||
|
speed = 2, -- multiplier to default value
|
||||||
|
jump = 0, -- multiplier to default value
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Here is part 1 of the fix. ~ LazyJ
|
||||||
|
self.HUD = player:hud_add({
|
||||||
|
hud_elem_type = "text",
|
||||||
|
position = {x=0.5, y=0.89},
|
||||||
|
name = "sled",
|
||||||
|
scale = {x=2, y=2},
|
||||||
|
text = "You are on the sled! Press the sneak key to get off the sled.", -- LazyJ
|
||||||
|
direction = 0,
|
||||||
|
})
|
||||||
|
-- End part 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:on_activate(staticdata, dtime_s)
|
||||||
|
self.object:set_armor_groups({immortal=1})
|
||||||
|
self.object:setacceleration({x=0, y=-10, z=0})
|
||||||
|
if staticdata then
|
||||||
|
self.v = tonumber(staticdata)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:get_staticdata()
|
||||||
|
return tostring(self.v)
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:on_punch(puncher)
|
||||||
|
self.object:remove()
|
||||||
|
if puncher
|
||||||
|
and puncher:is_player() then
|
||||||
|
puncher:get_inventory():add_item("main", "snow:sled")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local driveable_nodes = {"default:snow","default:snowblock","default:ice","default:dirt_with_snow", "group:icemaker"}
|
||||||
|
local function accelerating_possible(pos)
|
||||||
|
if is_water(pos) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if table_find(driveable_nodes, minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local timer = 0
|
||||||
|
function sled:on_step(dtime)
|
||||||
|
if not self.driver then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
timer = timer+dtime
|
||||||
|
if timer < 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
timer = 0
|
||||||
|
local player = minetest.get_player_by_name(self.driver)
|
||||||
|
if not player then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if player:get_player_control().sneak
|
||||||
|
or not accelerating_possible(vector.round(self.object:getpos())) then
|
||||||
|
leave_sled(self, player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_entity("snow:sled", sled)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("snow:sled", {
|
||||||
|
description = "Sled",
|
||||||
|
inventory_image = "snow_sled.png",
|
||||||
|
wield_image = "snow_sled.png",
|
||||||
|
wield_scale = {x=2, y=2, z=1},
|
||||||
|
liquids_pointable = true,
|
||||||
|
stack_max = 1,
|
||||||
|
|
||||||
|
on_use = function(itemstack, placer)
|
||||||
|
if players_sled[placer:get_player_name()] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pos = placer:getpos()
|
||||||
|
if accelerating_possible(vector.round(pos)) then
|
||||||
|
pos.y = pos.y+0.5
|
||||||
|
|
||||||
|
--Get on the sled and remove it from inventory.
|
||||||
|
minetest.add_entity(pos, "snow:sled"):right_click(placer)
|
||||||
|
itemstack:take_item(); return itemstack
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "snow:sled",
|
||||||
|
recipe = {
|
||||||
|
{"", "", ""},
|
||||||
|
{"group:stick", "", ""},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "snow:sled",
|
||||||
|
recipe = {
|
||||||
|
{"", "", ""},
|
||||||
|
{"", "", "group:stick"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
345
mods/snow/src/snowball.lua
Executable file
@ -0,0 +1,345 @@
|
|||||||
|
--============
|
||||||
|
--Snowballs
|
||||||
|
--============
|
||||||
|
|
||||||
|
-- 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
|
||||||
|
-- small handful of code lines making the difference. ~ LazyJ
|
||||||
|
|
||||||
|
local creative_mode = minetest.setting_getbool("creative_mode")
|
||||||
|
|
||||||
|
local function get_gravity()
|
||||||
|
local grav = tonumber(minetest.setting_get("movement_gravity")) or 9.81
|
||||||
|
return grav*snow.snowball_gravity
|
||||||
|
end
|
||||||
|
|
||||||
|
local someone_throwing
|
||||||
|
local timer = 0
|
||||||
|
|
||||||
|
--Shoot snowball
|
||||||
|
local function snow_shoot_snowball(item, player)
|
||||||
|
local addp = {y = 1.625} -- + (math.random()-0.5)/5}
|
||||||
|
local dir = player:get_look_dir()
|
||||||
|
local dif = 2*math.sqrt(dir.z*dir.z+dir.x*dir.x)
|
||||||
|
addp.x = dir.z/dif -- + (math.random()-0.5)/5
|
||||||
|
addp.z = -dir.x/dif -- + (math.random()-0.5)/5
|
||||||
|
local pos = vector.add(player:getpos(), addp)
|
||||||
|
local obj = minetest.add_entity(pos, "snow:snowball_entity")
|
||||||
|
obj:setvelocity(vector.multiply(dir, snow.snowball_velocity))
|
||||||
|
obj:setacceleration({x=dir.x*-3, y=-get_gravity(), z=dir.z*-3})
|
||||||
|
if creative_mode then
|
||||||
|
if not someone_throwing then
|
||||||
|
someone_throwing = true
|
||||||
|
timer = -0.5
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
item:take_item()
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
|
||||||
|
if creative_mode then
|
||||||
|
local function update_step(dtime)
|
||||||
|
timer = timer+dtime
|
||||||
|
if timer < 0.006 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
timer = 0
|
||||||
|
|
||||||
|
local active
|
||||||
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
|
if player:get_player_control().LMB then
|
||||||
|
local item = player:get_wielded_item()
|
||||||
|
local itemname = item:get_name()
|
||||||
|
if itemname == "default:snow" then
|
||||||
|
snow_shoot_snowball(nil, player)
|
||||||
|
active = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- disable the function if noone currently throws them
|
||||||
|
if not active then
|
||||||
|
someone_throwing = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- do automatic throwing using a globalstep
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
-- only if one holds left click
|
||||||
|
if someone_throwing then
|
||||||
|
update_step(dtime)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
--The snowball Entity
|
||||||
|
local snow_snowball_ENTITY = {
|
||||||
|
physical = false,
|
||||||
|
timer = 0,
|
||||||
|
collisionbox = {-5/16,-5/16,-5/16, 5/16,5/16,5/16},
|
||||||
|
}
|
||||||
|
|
||||||
|
function snow_snowball_ENTITY.on_activate(self)
|
||||||
|
self.object:set_properties({textures = {"default_snowball.png^[transform"..math.random(0,7)}})
|
||||||
|
self.object:setacceleration({x=0, y=-get_gravity(), z=0})
|
||||||
|
self.lastpos = self.object:getpos()
|
||||||
|
minetest.after(0.1, function(obj)
|
||||||
|
if not obj then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local vel = obj:getvelocity()
|
||||||
|
if vel
|
||||||
|
and vel.y ~= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.after(0, function(obj)
|
||||||
|
if not obj then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local vel = obj:getvelocity()
|
||||||
|
if not vel
|
||||||
|
or vel.y == 0 then
|
||||||
|
obj:remove()
|
||||||
|
end
|
||||||
|
end, obj)
|
||||||
|
end, self.object)
|
||||||
|
end
|
||||||
|
|
||||||
|
--Snowball_entity.on_step()--> called when snowball is moving.
|
||||||
|
function snow_snowball_ENTITY.on_step(self, dtime)
|
||||||
|
self.timer = self.timer+dtime
|
||||||
|
if self.timer > 600 then
|
||||||
|
-- 10 minutes are too long for a snowball to fly somewhere
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.physical then
|
||||||
|
local fell = self.object:getvelocity().y == 0
|
||||||
|
if not fell then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pos = vector.round(self.object:getpos())
|
||||||
|
if minetest.get_node(pos).name == "air" then
|
||||||
|
pos.y = pos.y-1
|
||||||
|
if minetest.get_node(pos).name == "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
snow.place(pos)
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = vector.round(self.object:getpos())
|
||||||
|
if vector.equals(pos, self.lastpos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if minetest.get_node(pos).name ~= "air" then
|
||||||
|
self.object:setacceleration({x=0, y=-get_gravity(), z=0})
|
||||||
|
--self.object:setvelocity({x=0, y=0, z=0})
|
||||||
|
pos = self.lastpos
|
||||||
|
self.object:setpos(pos)
|
||||||
|
local gain = vector.length(self.object:getvelocity())/30
|
||||||
|
minetest.sound_play("default_snow_footstep", {pos=pos, gain=gain})
|
||||||
|
self.object:set_properties({physical = true})
|
||||||
|
self.physical = true
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.lastpos = vector.new(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_entity("snow:snowball_entity", snow_snowball_ENTITY)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Snowball and Default Snowball Merged
|
||||||
|
|
||||||
|
-- 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
|
||||||
|
-- benefit from both? ~ LazyJ, 2014_04_08
|
||||||
|
|
||||||
|
--[[ Save this for reference and occasionally compare to the default code for any updates.
|
||||||
|
|
||||||
|
minetest.register_node(":default:snow", {
|
||||||
|
description = "Snow",
|
||||||
|
tiles = {"default_snow.png"},
|
||||||
|
inventory_image = "default_snowball.png",
|
||||||
|
wield_image = "default_snowball.png",
|
||||||
|
is_ground_content = true,
|
||||||
|
paramtype = "light",
|
||||||
|
buildable_to = true,
|
||||||
|
leveled = 7,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
freezemelt = "default:water_flowing",
|
||||||
|
node_box = {
|
||||||
|
type = "leveled",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
groups = {crumbly=3,falling_node=1, melts=1, float=1},
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
|
}),
|
||||||
|
on_construct = function(pos)
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt_with_grass" or minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt" then
|
||||||
|
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
|
||||||
|
end
|
||||||
|
-- Now, let's turn the snow pile into a snowblock. ~ LazyJ
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "default:snow" and -- Minus 2 because at the end of this, the layer that triggers the change to a snowblock is the second layer more than a full block, starting into a second block (-2) ~ LazyJ, 2014_04_11
|
||||||
|
minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow" then
|
||||||
|
minetest.set_node({x=pos.x, y=pos.y-2, z=pos.z}, {name="default:snowblock"})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_use = snow_shoot_snowball -- This line is from the 'Snow' mod, the reset is default Minetest.
|
||||||
|
})
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.override_item("default:snow", {
|
||||||
|
drop = {
|
||||||
|
max_items = 2,
|
||||||
|
items = {
|
||||||
|
{items = {'snow:moss'}, rarity = 20,},
|
||||||
|
{items = {'default:snow'},}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
leveled = 7,
|
||||||
|
node_box = {
|
||||||
|
type = "leveled",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, -0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, falling_node=1, melts=2, float=1},
|
||||||
|
sunlight_propagates = true,
|
||||||
|
--Disable placement prediction for snow.
|
||||||
|
node_placement_prediction = "",
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y-1
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "default:dirt_with_grass"
|
||||||
|
or node.name == "default:dirt" then
|
||||||
|
node.name = "default:dirt_with_snow"
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
--Handle node drops due to node level.
|
||||||
|
on_dig = function(pos, node, digger)
|
||||||
|
local level = minetest.get_node_level(pos)
|
||||||
|
minetest.node_dig(pos, node, digger)
|
||||||
|
if minetest.get_node(pos).name ~= node.name then
|
||||||
|
local inv = digger:get_inventory()
|
||||||
|
if not inv then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local left = inv:add_item("main", "default:snow "..tostring(level/7-1))
|
||||||
|
if not left:is_empty() then
|
||||||
|
minetest.add_item({
|
||||||
|
x = pos.x + math.random()/2-0.25,
|
||||||
|
y = pos.y + math.random()/2-0.25,
|
||||||
|
z = pos.z + math.random()/2-0.25,
|
||||||
|
}, left)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
--Manage snow levels.
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local under = pointed_thing.under
|
||||||
|
local oldnode_under = minetest.get_node_or_nil(under)
|
||||||
|
local above = pointed_thing.above
|
||||||
|
|
||||||
|
if not oldnode_under
|
||||||
|
or not above then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local olddef_under = ItemStack({name=oldnode_under.name}):get_definition()
|
||||||
|
olddef_under = olddef_under or minetest.nodedef_default
|
||||||
|
|
||||||
|
local place_to
|
||||||
|
-- If node under is buildable_to, place into it instead (eg. snow)
|
||||||
|
if olddef_under.buildable_to then
|
||||||
|
place_to = under
|
||||||
|
else
|
||||||
|
-- Place above pointed node
|
||||||
|
place_to = above
|
||||||
|
end
|
||||||
|
|
||||||
|
local level = minetest.get_node_level(place_to)
|
||||||
|
if level == 63 then
|
||||||
|
minetest.set_node(place_to, {name="default:snowblock"})
|
||||||
|
else
|
||||||
|
minetest.set_node_level(place_to, level+7)
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_node(place_to).name ~= "default:snow" then
|
||||||
|
local itemstack, placed = minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
|
return itemstack, placed
|
||||||
|
end
|
||||||
|
|
||||||
|
itemstack:take_item()
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
on_use = snow_shoot_snowball
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
A note about default torches, melting, and "buildable_to = true" in default snow.
|
||||||
|
|
||||||
|
On servers where buckets are disabled, snow and ice stuff is used to set water for crops and
|
||||||
|
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.
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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"
|
||||||
|
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
|
||||||
|
melt and the torch would become a dropped item.
|
||||||
|
|
||||||
|
~ LazyJ
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
-- Some of the ideas I tried. ~ LazyJ
|
||||||
|
--[[
|
||||||
|
local can_place_torch_on_top = function(pos)
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow"
|
||||||
|
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,})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
minetest.override_item("default:torch", {
|
||||||
|
--on_construct = function(pos)
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
--if minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow"
|
||||||
|
-- Even though layered snow doesn't look like it's in the next position above (y+1)
|
||||||
|
-- it registers in that position. Check the terminal's output to see the coord change.
|
||||||
|
--or minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "default:snow"
|
||||||
|
if pointed_thing.name == "default:snow"
|
||||||
|
then minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="default:torch"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--]]
|
342
mods/snow/src/stairsplus.lua
Executable file
@ -0,0 +1,342 @@
|
|||||||
|
-- ===============================================================================
|
||||||
|
-- StairsPlus Bonus!
|
||||||
|
-- ===============================================================================
|
||||||
|
--[[
|
||||||
|
This section of code that makes blocks compatible with MoreBlocks' circular saw.
|
||||||
|
I've added circular saw compatible code for default snowblocks and ice. :D
|
||||||
|
A big thanks to Calinou and ShadowNinja for making this possible.
|
||||||
|
|
||||||
|
Because StairsPlus creates partial blocks, it didn't seem quite right that the
|
||||||
|
smallest microblocks would produce a full-sized water_source node when melted.
|
||||||
|
So I toned them down a bit by changing their melt to a temporary,
|
||||||
|
2-second water_source. See "melts" in abms.lua file for the various intensities.
|
||||||
|
|
||||||
|
___...::: ATTENTION MINETEST SERVER OPERATORS :::...___
|
||||||
|
You may or may not have noticed in your server logs that MoreBlocks stairs/slabs/
|
||||||
|
panels/microblocks are not recorded as to when, who, what, and where. This is
|
||||||
|
important information when trying to determine if a player who dug these blocks
|
||||||
|
is the owner (the player who placed the block) or is a griefer stealing the block.
|
||||||
|
|
||||||
|
There is an option that will log when these blocks are placed but it comes at the
|
||||||
|
cost of losing the auto-rotation of those blocks when placed. They can still be
|
||||||
|
rotated with a screwdriver but if screwdrivers are disabled on your server your
|
||||||
|
players won't be able to position MoreBlocks, saw-made blocks.
|
||||||
|
|
||||||
|
To enable logging the placement of these blocks, un-comment these lines:
|
||||||
|
|
||||||
|
--on_place = minetest.item_place
|
||||||
|
|
||||||
|
There is one in each of the "stairsplus.register_all" sections.
|
||||||
|
|
||||||
|
~ LazyJ
|
||||||
|
-- ===============================================================================
|
||||||
|
--]]
|
||||||
|
|
||||||
|
--snow_stairsplus = {}
|
||||||
|
|
||||||
|
-- Check for infinite stacks
|
||||||
|
|
||||||
|
--if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
|
||||||
|
-- snow_stairsplus.expect_infinite_stacks = false
|
||||||
|
--else
|
||||||
|
-- snow_stairsplus.expect_infinite_stacks = true
|
||||||
|
--end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- First, let's run a check to see if MoreBlocks is installed; we're going to need it for the
|
||||||
|
-- next section of stairsplus stuff. ~LazyJ
|
||||||
|
|
||||||
|
if (minetest.get_modpath("moreblocks"))
|
||||||
|
and rawget(_G, "stairsplus")
|
||||||
|
|
||||||
|
-- 'If' MoreBlocks was found and stairsplus is available, well, 'then' go ahead with this next part:
|
||||||
|
|
||||||
|
then
|
||||||
|
|
||||||
|
--[[ Leave commented out - For reference only. ~ LazyJ
|
||||||
|
function stairsplus.register_all(modname, subname, recipeitem, fields)
|
||||||
|
--stairsplus.register_stair_slab_panel_micro(modname, subname, recipeitem, fields)
|
||||||
|
stairsplus:register_stair(modname, subname, recipeitem, fields)
|
||||||
|
stairsplus:register_slab(modname, subname, recipeitem, fields)
|
||||||
|
stairsplus:register_panel(modname, subname, recipeitem, fields)
|
||||||
|
stairsplus:register_micro(modname, subname, recipeitem, fields)
|
||||||
|
end
|
||||||
|
Leave commented out
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Leave commented out. Another, possible piece of the puzzle, as to why the placement of
|
||||||
|
-- stairsplus nodes aren't recorded in the logs. Shelved till I can concentrate on it again.
|
||||||
|
-- ~ LazyJ
|
||||||
|
|
||||||
|
--ItemStack({name=nodename}):get_definition()
|
||||||
|
--itemstack ={}
|
||||||
|
--[[
|
||||||
|
local def = itemstack:get_definition()
|
||||||
|
function minetest.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
|
minetest.log("action", placer:get_player_name() .. " places node "
|
||||||
|
.. def.name .. " at " .. minetest.pos_to_string(place_to))
|
||||||
|
end
|
||||||
|
Leave commented out
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
-- Leave commented out
|
||||||
|
--[[ FIGURE OUT HOW TO GET THE SLABS TO SHOW UP IN THE LOG ON PLACEMENT
|
||||||
|
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If it's being placed on an another similar one, replace it with
|
||||||
|
-- a full block
|
||||||
|
local slabpos = nil
|
||||||
|
local slabnode = nil
|
||||||
|
local p0 = pointed_thing.under
|
||||||
|
local p1 = pointed_thing.above
|
||||||
|
local n0 = minetest.get_node(p0)
|
||||||
|
local n1 = minetest.get_node(p1)
|
||||||
|
local param2 = 0
|
||||||
|
|
||||||
|
local n0_is_upside_down = (n0.name == "snow:slab_" .. subname and
|
||||||
|
n0.param2 >= 20)
|
||||||
|
|
||||||
|
if n0.name == "snow:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
|
||||||
|
slabpos = p0
|
||||||
|
slabnode = n0
|
||||||
|
elseif n1.name == "snow:slab_" .. subname then
|
||||||
|
slabpos = p1
|
||||||
|
slabnode = n1
|
||||||
|
end
|
||||||
|
if slabpos then
|
||||||
|
-- Remove the slab at slabpos
|
||||||
|
minetest.remove_node(slabpos)
|
||||||
|
-- Make a fake stack of a single item and try to place it
|
||||||
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
|
pointed_thing.above = slabpos
|
||||||
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
|
-- If the item was taken from the fake stack, decrement original
|
||||||
|
if success then
|
||||||
|
itemstack:set_count(fakestack:get_count())
|
||||||
|
-- Else put old node back
|
||||||
|
else
|
||||||
|
minetest.set_node(slabpos, slabnode)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Upside down slabs
|
||||||
|
if p0.y-1 == p1.y then
|
||||||
|
-- Turn into full block if pointing at a existing slab
|
||||||
|
if n0_is_upside_down then
|
||||||
|
-- Remove the slab at the position of the slab
|
||||||
|
minetest.remove_node(p0)
|
||||||
|
-- Make a fake stack of a single item and try to place it
|
||||||
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
|
pointed_thing.above = p0
|
||||||
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
|
-- If the item was taken from the fake stack, decrement original
|
||||||
|
if success then
|
||||||
|
itemstack:set_count(fakestack:get_count())
|
||||||
|
-- Else put old node back
|
||||||
|
else
|
||||||
|
minetest.set_node(p0, n0)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Place upside down slab
|
||||||
|
param2 = 20
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If pointing at the side of a upside down slab
|
||||||
|
if n0_is_upside_down and p0.y+1 ~= p1.y then
|
||||||
|
param2 = 20
|
||||||
|
end
|
||||||
|
|
||||||
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
|
end
|
||||||
|
Leave commented out
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Below, in the "groups" line there is a "melts" category. Back in the ABMs lua file, melting
|
||||||
|
code, melts=1 will produce a water_source when the full-sized snow/ice block is melted making
|
||||||
|
a big, watery mess. melts=2 will produce a water_source only for a moment, then it changes back
|
||||||
|
to water_flowing and then dries-up and disappears. I gave these stairs/slabs/panels/microblocks
|
||||||
|
a melts value of 2 instead of 1 because they are not full blocks.
|
||||||
|
|
||||||
|
~ LazyJ
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- Default snowblock and ice stairs/slabs/panels/microblocks.
|
||||||
|
|
||||||
|
local ndef = minetest.registered_nodes["default:ice"]
|
||||||
|
local groups = {}
|
||||||
|
for k, v in pairs(ndef.groups) do groups[k] = v end
|
||||||
|
|
||||||
|
stairsplus:register_all("moreblocks", "ice", "default:ice", {
|
||||||
|
description = ndef.description,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
-- Added "icemaker=1" in groups. This ties into the freezing
|
||||||
|
-- function in the ABMs.lua file. ~ LazyJ
|
||||||
|
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1, melts=2, icemaker=1},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
tiles = ndef.tiles,
|
||||||
|
-- Because of the "use_texture_alpha" line, that gives ice transparency, I couldn't combine
|
||||||
|
-- default ice and default snowblocks in a list like MoreBlocks does. ~ LazyJ
|
||||||
|
use_texture_alpha = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
-- This "on_place" line makes placing these nodes recorded in the logs.
|
||||||
|
-- Useful for investigating griefings and determining ownership
|
||||||
|
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
|
||||||
|
|
||||||
|
--on_place = minetest.item_place,
|
||||||
|
|
||||||
|
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could
|
||||||
|
-- also double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
if minetest.get_node(pos).name == "default:dirt_with_grass"
|
||||||
|
or minetest.get_node(pos).name == "default:dirt" then
|
||||||
|
minetest.set_node(pos, {name="default:dirt_with_snow"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
--end
|
||||||
|
|
||||||
|
|
||||||
|
local ndef = minetest.registered_nodes["default:snowblock"]
|
||||||
|
local groups = {}
|
||||||
|
for k, v in pairs(ndef.groups) do groups[k] = v end
|
||||||
|
|
||||||
|
stairsplus:register_all("moreblocks", "snowblock", "default:snowblock", {
|
||||||
|
description = ndef.description,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
-- Added "icemaker=1" in groups. This ties into the freezing function
|
||||||
|
-- in the ABMs.lua file. ~ LazyJ
|
||||||
|
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=2, icemaker=1},
|
||||||
|
tiles = ndef.tiles,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
|
dig = {name="default_dig_crumbly", gain=0.4},
|
||||||
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
|
place = {name="default_place_node", gain=1.0}
|
||||||
|
}),
|
||||||
|
-- This "on_place" line makes placing these nodes recorded in the logs.
|
||||||
|
-- Useful for investigating griefings and determining ownership
|
||||||
|
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
|
||||||
|
|
||||||
|
--on_place = minetest.item_place,
|
||||||
|
|
||||||
|
-- The "on_construct" part below, thinking in terms of layers,
|
||||||
|
-- dirt_with_snow could also double as dirt_with_frost
|
||||||
|
-- which adds subtlety to the winterscape. ~ LazyJ
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
if minetest.get_node(pos).name == "default:dirt_with_grass"
|
||||||
|
or minetest.get_node(pos).name == "default:dirt" then
|
||||||
|
minetest.set_node(pos, {name="default:dirt_with_snow"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Snow stairs/slabs/panels/microblocks.
|
||||||
|
|
||||||
|
local snow_nodes = {
|
||||||
|
"snow_brick",
|
||||||
|
"snow_cobble",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, name in pairs(snow_nodes) do
|
||||||
|
local nodename = "snow:"..name
|
||||||
|
local ndef = minetest.registered_nodes[nodename]
|
||||||
|
local groups = {}
|
||||||
|
for k, v in pairs(ndef.groups) do groups[k] = v end
|
||||||
|
|
||||||
|
stairsplus:register_all("moreblocks", name, nodename, {
|
||||||
|
description = ndef.description,
|
||||||
|
drop = ndef.drop,
|
||||||
|
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=2, icemaker=1},
|
||||||
|
tiles = ndef.tiles,
|
||||||
|
--paramtype2 = "facedir",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_snow_footstep", gain=0.25},
|
||||||
|
dig = {name="default_dig_crumbly", gain=0.4},
|
||||||
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
|
place = {name="default_place_node", gain=1.0}
|
||||||
|
}),
|
||||||
|
-- This "on_place" line makes placing these nodes recorded in the logs.
|
||||||
|
-- Useful for investigating griefings and determining ownership
|
||||||
|
-- BUT these nodes will nolonger auto-rotate into position. ~ LazyJ
|
||||||
|
|
||||||
|
--on_place = minetest.item_place,
|
||||||
|
|
||||||
|
|
||||||
|
-- Some attempts to have both, the recording in the logs of the placing of
|
||||||
|
-- the stairplus stuff *and* have the auto-rotation work. No luck yet.
|
||||||
|
-- ~ LazyJ
|
||||||
|
|
||||||
|
--[[
|
||||||
|
on_place = function (i, p, t)
|
||||||
|
minetest.item_place(i, p, t, 0)
|
||||||
|
minetest.rotate_node(i, p, t)
|
||||||
|
end,
|
||||||
|
--]]
|
||||||
|
--[[
|
||||||
|
on_place = function (i, p, t)
|
||||||
|
minetest.rotate_node(i, p, t, 0)
|
||||||
|
minetest.item_place(i, p, t)
|
||||||
|
end,
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Picking up were we left off... ~ LazyJ
|
||||||
|
|
||||||
|
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could
|
||||||
|
-- also double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
if minetest.get_node(pos).name == "default:dirt_with_grass"
|
||||||
|
or minetest.get_node(pos).name == "default:dirt"
|
||||||
|
then minetest.set_node(pos, {name="default:dirt_with_snow"})
|
||||||
|
end
|
||||||
|
-- Some ideas I've tried. Leaving for future reference till I can figure out a workable solution. ~ LazyJ
|
||||||
|
--minetest.log("action", sender:get_player_name().." places" ..minetest.get_node(pos).name.. "at" ..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", minetest.get_player_name().." places" ..minetest.get_node(pos).name.. "at" ..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", "BINGO places "..minetest.get_name().." at "..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", minetest.get_player_name().." places "..minetest.get_name().." at "..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", placer:get_player_name().." places moreblocks-something at "..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", " BINGO places "..minetest.get_pointed_thing().." at "..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", "BINGO places moreblocks"..ndef.." at "..minetest.pos_to_string(pos))
|
||||||
|
--minetest.log("action", "A pine sapling grows into a Christmas tree at "..minetest.pos_to_string(pos))
|
||||||
|
--return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
|
--return minetest.item_place(itemstack, pointed_thing, param2)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
return
|
||||||
|
end
|
156
mods/snow/src/util.lua
Executable file
@ -0,0 +1,156 @@
|
|||||||
|
--Global config and function table.
|
||||||
|
snow = {
|
||||||
|
snowball_gravity = 100/109,
|
||||||
|
snowball_velocity = 19,
|
||||||
|
sleds = true,
|
||||||
|
enable_snowfall = true,
|
||||||
|
lighter_snowfall = false,
|
||||||
|
debug = false,
|
||||||
|
smooth_biomes = true,
|
||||||
|
christmas_content = true,
|
||||||
|
smooth_snow = true,
|
||||||
|
min_height = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
--Config documentation.
|
||||||
|
local doc = {
|
||||||
|
snowball_gravity = "The gravity of thrown snowballs",
|
||||||
|
snowball_velocity = "How fast players throw snowballs",
|
||||||
|
sleds = "Disable this to prevent sleds from being riden.",
|
||||||
|
enable_snowfall = "Enables falling snow.",
|
||||||
|
lighter_snowfall = "Reduces the amount of resources and fps used by snowfall.",
|
||||||
|
debug = "Enables debug output. Currently it only prints mgv6 info.",
|
||||||
|
smooth_biomes = "Enables smooth transition of biomes (mgv6)",
|
||||||
|
smooth_snow = "Disable this to stop snow from being smoothed.",
|
||||||
|
christmas_content = "Disable this to remove christmas saplings from being found.",
|
||||||
|
min_height = "The minumum height a snow biome will generate (mgv7)",
|
||||||
|
}
|
||||||
|
|
||||||
|
--Manage config.
|
||||||
|
--Saves contents of config to file.
|
||||||
|
local function saveConfig(path, config, doc)
|
||||||
|
local file = io.open(path,"w")
|
||||||
|
if file then
|
||||||
|
for i,v in pairs(config) do
|
||||||
|
local t = type(v)
|
||||||
|
if t == "string" or t == "number" or t == "boolean" then
|
||||||
|
if doc and doc[i] then
|
||||||
|
file:write("# "..doc[i].."\n")
|
||||||
|
end
|
||||||
|
file:write(i.." = "..tostring(v).."\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--Loads config and returns config values inside table.
|
||||||
|
local function loadConfig(path)
|
||||||
|
local config = {}
|
||||||
|
local file = io.open(path,"r")
|
||||||
|
if file then
|
||||||
|
io.close(file)
|
||||||
|
for line in io.lines(path) do
|
||||||
|
if line:sub(1,1) ~= "#" then
|
||||||
|
local i, v = line:match("^(%S*) = (%S*)")
|
||||||
|
if i and v then
|
||||||
|
if v == "true" then v = true end
|
||||||
|
if v == "false" then v = false end
|
||||||
|
if tonumber(v) then v = tonumber(v) end
|
||||||
|
config[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return config
|
||||||
|
else
|
||||||
|
--Create config file.
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_shutdown(function()
|
||||||
|
saveConfig(minetest.get_modpath("snow").."/config.txt", snow, doc)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local config = loadConfig(minetest.get_modpath("snow").."/config.txt")
|
||||||
|
if config then
|
||||||
|
for i,v in pairs(config) do
|
||||||
|
if type(snow[i]) == type(v) then
|
||||||
|
snow[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
saveConfig(minetest.get_modpath("snow").."/config.txt", snow, doc)
|
||||||
|
end
|
||||||
|
|
||||||
|
for i,v in pairs(snow) do
|
||||||
|
local t = type(v)
|
||||||
|
if t == "string"
|
||||||
|
or t == "number"
|
||||||
|
or t == "boolean" then
|
||||||
|
local v = minetest.setting_get("snow_"..i)
|
||||||
|
if v ~= nil then
|
||||||
|
if v == "true" then v = true end
|
||||||
|
if v == "false" then v = false end
|
||||||
|
if tonumber(v) then v = tonumber(v) end
|
||||||
|
snow[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--MENU
|
||||||
|
|
||||||
|
local get_formspec = function()
|
||||||
|
local p = -0.5
|
||||||
|
local formspec = "label[0,-0.3;Settings:]"
|
||||||
|
for i,v in pairs(snow) do
|
||||||
|
local t = type(v)
|
||||||
|
if t == "string"
|
||||||
|
or t == "number" then
|
||||||
|
p = p + 1.5
|
||||||
|
formspec = formspec.."field[0.3,"..p..";2,1;snow:"..i..";"..i..";"..v.."]"
|
||||||
|
elseif t == "boolean" then
|
||||||
|
p = p + 0.5
|
||||||
|
formspec = formspec.."checkbox[0,"..p..";snow:"..i..";"..i..";"..tostring(v).."]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
p = p + 1
|
||||||
|
formspec = "size[4,"..p..";]\n"..formspec
|
||||||
|
return formspec
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= "snow:menu" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for i,v in pairs(snow) do
|
||||||
|
local t = type(v)
|
||||||
|
if t == "string" or t == "number" or t == "boolean" then
|
||||||
|
local field = fields["snow:"..i]
|
||||||
|
if field then
|
||||||
|
if t == "string" then
|
||||||
|
snow[i] = field
|
||||||
|
end
|
||||||
|
if t == "number" then
|
||||||
|
snow[i] = tonumber(field)
|
||||||
|
end
|
||||||
|
if t == "boolean" then
|
||||||
|
if field == "true" then
|
||||||
|
snow[i] = true
|
||||||
|
elseif field == "false" then
|
||||||
|
snow[i] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_chatcommand("snow", {
|
||||||
|
description = "Show a menu for various actions",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(name)
|
||||||
|
minetest.chat_send_player(name, "Showing snow menu…")
|
||||||
|
minetest.show_formspec(name, "snow:menu", get_formspec())
|
||||||
|
end,
|
||||||
|
})
|
BIN
mods/snow/textures/character_snow_man.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
mods/snow/textures/character_snow_man_preview.png
Executable file
After Width: | Height: | Size: 3.7 KiB |
BIN
mods/snow/textures/character_snow_man_preview_back.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
mods/snow/textures/default_ice.png
Executable file
After Width: | Height: | Size: 150 B |
BIN
mods/snow/textures/default_snowball.png
Executable file
After Width: | Height: | Size: 211 B |
BIN
mods/snow/textures/snow_apple.png
Executable file
After Width: | Height: | Size: 249 B |
BIN
mods/snow/textures/snow_dandelion_white.png
Executable file
After Width: | Height: | Size: 122 B |
BIN
mods/snow/textures/snow_dandelion_yellow.png
Executable file
After Width: | Height: | Size: 118 B |
BIN
mods/snow/textures/snow_geranium.png
Executable file
After Width: | Height: | Size: 269 B |
BIN
mods/snow/textures/snow_ice_brick.png
Executable file
After Width: | Height: | Size: 665 B |
BIN
mods/snow/textures/snow_leaves.png
Executable file
After Width: | Height: | Size: 190 B |
BIN
mods/snow/textures/snow_moss.png
Executable file
After Width: | Height: | Size: 619 B |
BIN
mods/snow/textures/snow_needles.png
Executable file
After Width: | Height: | Size: 660 B |
BIN
mods/snow/textures/snow_needles_decorated.png
Executable file
After Width: | Height: | Size: 884 B |
BIN
mods/snow/textures/snow_needles_decorated_animated.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
mods/snow/textures/snow_rose.png
Executable file
After Width: | Height: | Size: 120 B |
BIN
mods/snow/textures/snow_sapling_pine.png
Executable file
After Width: | Height: | Size: 272 B |
BIN
mods/snow/textures/snow_shrub.png
Executable file
After Width: | Height: | Size: 262 B |
BIN
mods/snow/textures/snow_shrub_covering.png
Executable file
After Width: | Height: | Size: 229 B |
BIN
mods/snow/textures/snow_sled.png
Executable file
After Width: | Height: | Size: 327 B |
BIN
mods/snow/textures/snow_snow_brick.png
Executable file
After Width: | Height: | Size: 319 B |
BIN
mods/snow/textures/snow_snow_cobble.png
Executable file
After Width: | Height: | Size: 737 B |
BIN
mods/snow/textures/snow_star.png
Executable file
After Width: | Height: | Size: 349 B |
BIN
mods/snow/textures/snow_star_lit.png
Executable file
After Width: | Height: | Size: 302 B |
BIN
mods/snow/textures/snow_tulip.png
Executable file
After Width: | Height: | Size: 124 B |
BIN
mods/snow/textures/snow_viola.png
Executable file
After Width: | Height: | Size: 117 B |
BIN
mods/snow/textures/snow_xmas_tree.png
Executable file
After Width: | Height: | Size: 299 B |
BIN
mods/snow/textures/weather_snow.png
Executable file
After Width: | Height: | Size: 588 B |