commit a622ed3906ee4597804c37fd3ad1c168664bfdff Author: paramat Date: Fri Aug 9 04:33:05 2013 +0100 Version 0.1.1 more, and varying snowfall diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..9f28390 --- /dev/null +++ b/README.txt @@ -0,0 +1,23 @@ +-- Snowdrift 0.1.1 by paramat +-- For latest stable Minetest and back to 0.4.6 +-- Depends default +-- Licenses: Code WTFPL. Textures CC BY-SA. +-- This is intended to be used as alternative snowfall for the snow mod by Splizard. +-- The code is partly derived from weather mod by Jeija and snow mod version 1.8 by Splizard. + +Version 0.1.0 +--------------- +* Snowfall only in the snow biomes of snow mod by Splizard. You will need to disable snow mod snowfall. +* Minimal processing for less powerful computers. +* Snowfall is only seen by a player if the player is outside under open sky. +* Each snowflake has it's own random trajectory, initial position, initial velocity and acceleration. +* Snow falls at an average of 1m/s. +* Snow drifts southwards at an average of 1m/s, a slightly lower speed than the southward cloud drift. +* Snowflakes are sized to match 16x16 texture resolution and the icons used in my texture pack. +* The snow box around the player is 128x128x32 nodes in size. +* Parameter PROCHA controls snow density and processing load, default is 0.5, try 1 for denser snow. + +Version 0.1.1 +------------- +* Mod is too light, doubled maximum snow density, added second snowflake design with a square symmetry. +* Snow density is now smoothly varied by how deep into a snow biome a player is. diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..90f7f54 --- /dev/null +++ b/init.lua @@ -0,0 +1,60 @@ +-- Snowdrift 0.1.1 by paramat +-- For latest stable Minetest and back to 0.4.6 +-- Depends default +-- Licenses: Code WTFPL. Textures CC BY-SA. +-- This is intended to be used as alternative snowfall for the snow mod by Splizard. +-- The code is partly derived from weather mod by Jeija and snow mod version 1.8 by Splizard. + +-- Parameters + +local MAXCHA = 1 -- (0 to 1) Maximum per globalstep chance of processing a player. Controls snow density and processing load. + +local SEED1 = 112 -- 112 -- These 5 parameters should match the values you use in snow mod. +local OCTA1 = 3 -- 3 +local PERS1 = 0.5 -- 0.5 +local SCAL1 = 256 -- 150 -- Large scale size of snow biomes. +local SNOTHR = 0.4 -- 0.53 -- Perlin noise > SNOTHR for snow biome. + +-- Stuff + +snowdrift = {} + +-- Globalstep function + +minetest.register_globalstep(function(dtime) + for _, player in ipairs(minetest.get_connected_players()) do + if math.random() > MAXCHA then + return + end + local ppos = player:getpos() + if minetest.env:get_node_light(ppos, 0.5) ~= 15 then + return + end + local perlin1 = minetest.env:get_perlin(SEED1, OCTA1, PERS1, SCAL1) + local noise1 = perlin1:get2d({x = ppos.x, y = ppos.z}) + local biome = noise1 - SNOTHR + if math.random() > biome then + return + end + local posi = {x = ppos.x - 64 + math.random(0, 128), y= ppos.y + 16, z= ppos.z - 48 + math.random(0, 128)} + local velo = {x = math.random() / 5 - 0.1, y = math.random() / 5 - 1.1, z = math.random() / 5 - 1.1} + local acce = {x = math.random() / 50 - 0.01, y = math.random() / 50 - 0.01, z = math.random() / 50 - 0.01} + minetest.add_particle( + posi, + velo, + acce, + 32, + 2.8, + false, "snowdrift_snowflake1.png", player:get_player_name()) + local posi = {x = ppos.x - 64 + math.random(0, 128), y= ppos.y + 16, z= ppos.z - 48 + math.random(0, 128)} + local velo = {x = math.random() / 5 - 0.1, y = math.random() / 5 - 1.1, z = math.random() / 5 - 1.1} + local acce = {x = math.random() / 50 - 0.01, y = math.random() / 50 - 0.01, z = math.random() / 50 - 0.01} + minetest.add_particle( + posi, + velo, + acce, + 32, + 2.8, + false, "snowdrift_snowflake2.png", player:get_player_name()) + end +end) diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..c73f8ae --- /dev/null +++ b/license.txt @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/textures/snowdrift_snowflake1.png b/textures/snowdrift_snowflake1.png new file mode 100644 index 0000000..b8d915f Binary files /dev/null and b/textures/snowdrift_snowflake1.png differ diff --git a/textures/snowdrift_snowflake2.png b/textures/snowdrift_snowflake2.png new file mode 100644 index 0000000..ca7cfc2 Binary files /dev/null and b/textures/snowdrift_snowflake2.png differ