Initial commit

master
shivajiva 2019-09-22 09:17:04 +01:00
commit 28422c1a6f
31 changed files with 1813 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 shivajiva101@hotmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Weather
This mod provides diverse weather for mapgen v5, v7 and a somewhat simpler weather for v6. Features include an API to add weather types and define the biome weather system. It will only work on Minetest versions greater than v5.0
The reason v6 maps are handled differently is due to the inability to detect the current biome of a players position, v6 maps report 'default' for every biome. Without any granularity the only possible detection is from the nodes around the player. I may add that level of detection, depending on demand.

52
api.md Normal file
View File

@ -0,0 +1,52 @@
Register weather types as follows:
weather.register_weather = function(name, def)
def is a table with these values:
particle = {
pos = {x=0, y=0, z=0},
velocity = {x=0, y=0, z=0},
acceleration = {x=0, y=0, z=0},
expirationtime = 1,
size = 1,
collisiondetection = false,
collision_removal = false,
vertical = false,
texture = "image.png",
playername = "singleplayer",
animation = {Tile Animation definition},
glow = 0,
qty = 64 - required! (number of particles)
},
hud = "image_name.png",
skybox = false used to trigger plain skybox event
clouds = true shows clouds(default)
cloud_def = set cloud parameters
* `parameters` is a table with the following optional fields:
* `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`)
* `color`: basic cloud color with alpha channel, ColorSpec (default `#fff0f0e5`)
* `ambient`: cloud color lower bound, use for a "glow at night" effect. ColorSpec (alpha ignored, default `#000000`)
* `height`: cloud height, i.e. y of cloud base (default per conf, usually `120`)
* `thickness`: cloud thickness in nodes (default `16`)
* `speed`: 2D cloud speed + direction in nodes per second (default `{x=0, z=-2}`).
sound = name(s) of the sound clip(s)
* `parameter` string or a table:
'weather_raindrop'
OR
{'weather_raindrop','weather_wind'}
gain = float value,
lightning = boolean
Register weather systems to a biome:
weather.register_biome = function(name, def)
def is a table of weather patterns, consisting of several types of weather and
it must use the weather type names that were registered with weather.register_weather()
example:
savanna = {
'clear','cloudy','light_rain','overcast','cloudy'
},
The weather progresses along the entries at random intervals so the size of the array is entirely up to you!

1289
init.lua Normal file

File diff suppressed because it is too large Load Diff

438
register.lua Normal file
View File

@ -0,0 +1,438 @@
local COLLIDE = true -- Particles: remove on collision with nodes
-- REGISTRATION --
weather.register_weather("clear", {
name = "clear",
skybox = false,
clouds = false,
cloud_def = {
color = {r=240,g=240,b=255,a=229},
density = 0,
height = 120,
thickness = 0
}
})
weather.register_weather("cloudy", {
name = "cloudy",
skybox = false,
clouds = true,
cloud_def = {
color = {r=240,g=240,b=255,a=229},
density = 0.4,
height = 120,
thickness = 16
}
})
weather.register_weather("duststorm", {
name = "duststorm",
skybox = false,
clouds = true,
cloud_def = {
color = {r=103,g=100,b=105,a=229},
density = 1.0,
height = 1,
thickness = 128
},
sound = "weather_wind",
gain = 1,
})
weather.register_weather("light_rain", {
name = "light_rain",
particle = {
velocity = {
x = 0.0,
y = -10.0,
z = 0.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 2.1,
size = 1.2,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = true,
texture = "weather_raindrop.png",
qty = 32
},
skybox = false,
skybox_def = {color = {r=195,g=195,b=210,a=255}},
clouds = true,
cloud_def = {
color = {r=200,g=200,b=215,a=229},
density = 0.45,
height = 120,
thickness = 16
},
sound = "weather_raindrop",
gain = 0.5
})
weather.register_weather("medium_rain", {
name = "medium_rain",
particle = {
velocity = {
x = 0.0,
y = -10.0,
z = 0.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 2.1,
size = 2,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = true,
texture = "weather_raindrop.png",
qty = 48
},
skybox = true,
clouds = true,
cloud_def = {
color = {r=175,g=175,b=191,a=229},
density = 0.5,
height = 120,
thickness = 24
},
sound = "weather_raindrop",
gain = 1
})
weather.register_weather("heavy_rain", {
name = "heavy_rain",
particle = {
velocity = {
x = 0.0,
y = -10.0,
z = 0.0
},
acceleration = {x = 0, y = 1, z = 0},
expirationtime = 2.1,
size = 3,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = true,
texture = "weather_raindrop.png",
qty = 64
},
skybox = true,
clouds = true,
cloud_def = {
color = {r=143,g=143,b=158,a=229},
density = 0.55,
height = 120,
thickness = 32
},
sound = "weather_raindrop",
gain = 1.5
})
weather.register_weather("fog", {
name = "fog",
skybox = false,
clouds = true,
cloud_def = {
color = {r=240,g=240,b=255,a=150},
density = 1.0,
height = 1,
thickness = 64
}
})
weather.register_weather("heavy_fog", {
name = "heavy_fog",
skybox = false,
clouds = true,
cloud_def = {
color = {r=240,g=240,b=255,a=229},
density = 1.0,
height = 1,
thickness = 128
}
})
weather.register_weather("light_snow", {
name = "light_snow",
particle = {
velocity = {
x = 0.0,
y = -2.0,
z = -1.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 8.5,
size = 2.8,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = false,
texture = "weather_snowflake" .. math.random(1, 4) .. ".png",
qty = 8
},
skybox = true,
clouds = true,
cloud_def = {
color = {r=175,g=175,b=190,a=229},
density = 0.45,
height = 120,
thickness = 16
}
})
weather.register_weather("medium_smow", {
name = "medium_snow",
particle = {
velocity = {
x = 0.0,
y = -2.0,
z = -1.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 8.5,
size = 2.8,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = false,
texture = "weather_snowflake" .. math.random(1, 5) .. ".png",
qty = 12
},
skybox = true,
clouds = true,
cloud_def = {
color = {r=175,g=175,b=190,a=229},
density = 0.45,
height = 120,
thickness = 24
}
})
weather.register_weather("heavy_snow", {
name = "heavy_snow",
particle = {
velocity = {
x = 0.0,
y = -2.0,
z = -1.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 8.5,
size = 2.8,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = false,
texture = "weather_snowflake" .. math.random(1, 8) .. ".png",
qty = 16
},
skybox = true,
clouds = true,
cloud_def = {
color = {r=175,g=175,b=190,a=229},
density = 0.45,
height = 120,
thickness = 32
}
})
weather.register_weather("blizzard", {
name = "blizzard",
particle = {
velocity = {
x = 0.0,
y = -2.0,
z = -1.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 8.5,
size = 2.8,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = false,
texture = "weather_snowflake" .. math.random(1, 4) .. ".png",
qty = 20
},
skybox = true,
clouds = false,
cloud_def = {
color = {r=240,g=240,b=255,a=229},
density = 0,
height = 120,
thickness = 0
},
sound = "weather_wind",
gain = 1.5
})
weather.register_weather("tropical_storm", {
name = "tropical_storm",
particle = {
velocity = {
x = 0.0,
y = -10.0,
z = 0.0
},
acceleration = {x = 0, y = 0, z = 0},
expirationtime = 2.1,
size = 3,
collisiondetection = COLLIDE,
collision_removal = true,
vertical = true,
texture = "weather_raindrop.png",
qty = 64
},
skybox = true,
clouds = true,
cloud_def = {
color = {r=175,g=175,b=190,a=229},
density = 0.45,
height = 120,
thickness = 48
},
sound = "weather_raindrop",
gain = 1.5,
lightning = true
})
weather.register_weather("thunderstorm", {
name = "thunderstorm",
clouds = true,
cloud_def = {
color = {r=102,g=102,b=118,a=229},
density = 0.65,
height = 120,
thickness = 48
},
skybox = true,
lightning = true
})
weather.register_weather("overcast", {
name = "overcast",
clouds = true,
cloud_def = {
color = {r=240,g=240,b=255,a=229},
density = 0.4,
height = 120,
thickness = 16
},
skybox = true
})
weather.register_weather("sandstorm", {
name = "sandstorm",
skybox = false,
clouds = true,
cloud_def = {
color = {r=142,g=112,b=72,a=229},
density = 1.0,
height = 1,
thickness = 128
},
sound = "weather_wind",
gain = 1,
})
local W_SYSTEMS = {
rainforest_ocean = {
'clear','light_rain','medium_rain','fog','heavy_fog','fog'
},
rainforest_swamp = {
'clear','light_rain','medium_rain','fog','heavy_fog','fog'
},
rainforest = {
'clear','light_rain','medium_rain','fog','heavy_fog','fog'
},
savanna_ocean = {
'clear','cloudy','light_rain','cloudy'
},
savanna_shore = {
'clear','cloudy','light_rain','cloudy'
},
savanna = {
'clear','cloudy','light_rain','cloudy'
},
cold_desert_ocean = {
'clear','cloudy','clear'
},
cold_desert = {
'clear','cloudy','clear'
},
sandstone_desert_ocean = {
'clear','cloudy','clear'
},
sandstone_desert = {
'clear','sandstorm','clear'
},
desert_ocean = {
'clear','cloudy','clear'
},
desert_sand = {
'clear','cloudy','duststorm','clear'
},
deciduous_forest_ocean = {
'clear','cloudy','light_rain','medium_rain','fog','clear'
},
deciduous_forest_shore = {
'clear','cloudy','light_rain','medium_rain','fog','clear'
},
deciduous_forest = {
'clear','cloudy','light_rain','medium_rain','fog','clear'
},
coniferous_forest_ocean = {
'cloudy','light_rain','medium_rain','fog','light_snow'
},
coniferous_forest_dunes = {
'cloudy','light_rain','medium_rain','fog','light_snow'
},
coniferous_forest = {
'cloudy','light_rain','medium_rain','fog','light_snow'
},
grassland_ocean = {
'clear','cloudy','light_rain','medium_rain','overcast','clear'
},
grassland_dunes = {
'clear','cloudy','light_rain','medium_rain','overcast','clear'
},
grassland = {
'clear','cloudy','light_rain','medium_rain','overcast','clear'
},
snowy_grassland_ocean = {
'cloudy','light_snow','medium_snow','heavy_snow'
},
snowy_grassland = {
'cloudy','light_snow','medium_snow','heavy_snow'
},
taiga_ocean = {
'cloudy','light_snow','medium_snow','heavy_snow'
},
taiga = {
'cloudy','light_snow','medium_snow','heavy_snow'
},
tundra_ocean = {
'cloudy','medium_snow','heavy_snow','overcast'
},
tundra_beach = {
'cloudy','medium_snow','heavy_snow','overcast'
},
tundra = {
'cloudy','medium_snow','heavy_snow','overcast'
},
tundra_highland = {
'cloudy','medium_snow','heavy_snow','overcast'
},
icesheet_ocean = {
'cloudy','medium_snow','heavy_snow','overcast'
},
icesheet = {
'cloudy','medium_snow','heavy_snow','overcast'
},
default = {
'clear','light_rain','medium_rain','overcast','fog',
'heavy_fog','thunderstorm'
}
}
-- register biome weather systems
for key,val in pairs(W_SYSTEMS) do
weather.register_biome(key, val)
end

4
sounds/credits.txt Normal file
View File

@ -0,0 +1,4 @@
Weather Sounds:
thunder.1.ogg CC BY (3.0) by Hantorio http://www.freesound.org/people/hantorio/sounds/121945/
thunder.2.ogg CC BY (3.0) by justkiddink http://www.freesound.org/people/juskiddink/sounds/101948/
raindrop.ogg CC BY (3.0) by inchadney http://freesound.org/people/inchadney/sounds/58835/

BIN
sounds/weather_raindrop.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sounds/weather_wind.ogg Normal file

Binary file not shown.

Binary file not shown.

4
textures/credits.txt Normal file
View File

@ -0,0 +1,4 @@
Weather Textures:
raindrop CC BY-SA (3.0) by paramat
snowflakes CC BY-SA (3.0) by paramat
acid_raindrop CC BY-SA (3.0) by shivajiva

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

BIN
textures/weather_dust.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B