forked from mtcontrib/regional_weather
Tweak fog effect, add puddle variants, imrove frost HUD
This commit is contained in:
@ -6,6 +6,7 @@ climate_api.register_abm({
|
||||
nodenames = { "fire:basic_flame" },
|
||||
interval = 10,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
|
@ -27,6 +27,7 @@ climate_api.register_abm({
|
||||
neighbors = { "air" },
|
||||
interval = 10,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
@ -46,6 +47,7 @@ climate_api.register_abm({
|
||||
neighbors = { "air" },
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
catch_up = true,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
|
101
abms/puddle.lua
101
abms/puddle.lua
@ -1,13 +1,13 @@
|
||||
-- code of this file is partially taken from and otherwise inspired by
|
||||
-- mymonths on https://github.com/minetest-mods/mymonths (licensed under DWYWPL)
|
||||
-- contributers available at https://github.com/minetest-mods/mymonths/graphs/contributors
|
||||
-- all changes of mine remain under LGPL v3
|
||||
|
||||
local BLOCK_NAME = "regional_weather:puddle"
|
||||
local MIN_DISTANCE = 12
|
||||
local BLOCK_PREFIX = "regional_weather:puddle_"
|
||||
local VARIANT_COUNT = 30
|
||||
local MIN_DISTANCE = 2
|
||||
|
||||
if not regional_weather.settings.puddles then
|
||||
minetest.register_alias(BLOCK_NAME, "air")
|
||||
for i=1,VARIANT_COUNT do
|
||||
for r=0,270,90 do
|
||||
minetest.register_alias(BLOCK_PREFIX .. i .. "_" .. r, "air")
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
@ -16,27 +16,59 @@ local node_box = {
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5}
|
||||
}
|
||||
|
||||
minetest.register_node(BLOCK_NAME, {
|
||||
tiles = { "weather_puddle.png" },
|
||||
drawtype = "nodebox",
|
||||
pointable = false,
|
||||
buildable_to = true,
|
||||
floodable = true,
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
use_texture_alpha = true,
|
||||
node_box = node_box,
|
||||
groups = {
|
||||
not_in_creative_inventory = 1,
|
||||
crumbly = 3,
|
||||
attached_node = 1,
|
||||
slippery = 1,
|
||||
flora = 1,
|
||||
water = 1
|
||||
},
|
||||
drop = "",
|
||||
})
|
||||
for i = 1,VARIANT_COUNT do
|
||||
for rotation = 0,270,90 do
|
||||
for flip = 0,1 do
|
||||
local name = BLOCK_PREFIX .. i .. "_" .. rotation
|
||||
local texture = "weather_puddle." .. i .. ".png^[opacity:128"
|
||||
if flip == 1 or rotation > 0 then
|
||||
texture = texture .. "^[transform"
|
||||
end
|
||||
if flip == 1 then
|
||||
name = name .. "_flipped"
|
||||
texture = texture .. "FX"
|
||||
end
|
||||
if rotation > 0 then
|
||||
texture = texture .. "R" .. rotation
|
||||
end
|
||||
minetest.register_node(name, {
|
||||
tiles = { texture },
|
||||
drawtype = "nodebox",
|
||||
pointable = false,
|
||||
buildable_to = true,
|
||||
floodable = true,
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
use_texture_alpha = true,
|
||||
node_box = node_box,
|
||||
groups = {
|
||||
not_in_creative_inventory = 1,
|
||||
crumbly = 3,
|
||||
attached_node = 1,
|
||||
slippery = 1,
|
||||
flora = 1,
|
||||
water = 1,
|
||||
regional_weather_puddle = 1
|
||||
},
|
||||
drop = "",
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_alias("regional_weather:puddle", BLOCK_PREFIX .. "14_0")
|
||||
|
||||
local function get_random_puddle()
|
||||
local index = math.random(1, VARIANT_COUNT)
|
||||
local rotation = math.random(0, 3) * 90
|
||||
local flip = math.random(0, 1)
|
||||
local name = BLOCK_PREFIX .. index .. "_" .. rotation
|
||||
if flip == 1 then
|
||||
name = name .. "_flipped"
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
-- Makes Puddles when raining
|
||||
climate_api.register_abm({
|
||||
@ -45,6 +77,7 @@ climate_api.register_abm({
|
||||
neighbors = { "air" },
|
||||
interval = 10,
|
||||
chance = 50,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
@ -60,17 +93,19 @@ climate_api.register_abm({
|
||||
|
||||
action = function (pos, node, env)
|
||||
if minetest.get_node(pos).name ~= "air" then return end
|
||||
if minetest.find_node_near(pos, MIN_DISTANCE, BLOCK_NAME) then return end
|
||||
minetest.set_node(pos, {name = BLOCK_NAME})
|
||||
if minetest.find_node_near(pos, MIN_DISTANCE, "group:regional_weather_puddle") then return end
|
||||
local puddle_name = get_random_puddle()
|
||||
minetest.set_node(pos, {name = puddle_name})
|
||||
end
|
||||
})
|
||||
|
||||
-- Makes puddles dry up when not raining
|
||||
climate_api.register_abm({
|
||||
label = "remove rain puddles",
|
||||
nodenames = { BLOCK_NAME },
|
||||
nodenames = { "group:regional_weather_puddle" },
|
||||
interval = 5,
|
||||
chance = 5,
|
||||
catch_up = true,
|
||||
|
||||
action = function (pos, node, env)
|
||||
if env.humidity < 55 then
|
||||
@ -79,4 +114,4 @@ climate_api.register_abm({
|
||||
minetest.set_node(pos, {name = "regional_weather:snow_cover_1"})
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
||||
|
@ -1,8 +1,3 @@
|
||||
-- code of this file is partially taken from and otherwise inspired by
|
||||
-- mymonths on https://github.com/minetest-mods/mymonths (licensed under DWYWPL)
|
||||
-- contributers available at https://github.com/minetest-mods/mymonths/graphs/contributors
|
||||
-- all changes of mine remain under LGPL v3
|
||||
|
||||
local BLOCK_PREFIX = "regional_weather:snow_cover_"
|
||||
|
||||
if not minetest.get_modpath("default")
|
||||
@ -66,7 +61,8 @@ climate_api.register_abm({
|
||||
},
|
||||
neighbors = { "air" },
|
||||
interval = 15,
|
||||
chance = 20,
|
||||
chance = 30,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
@ -100,7 +96,8 @@ climate_api.register_abm({
|
||||
"group:regional_weather_snow_cover"
|
||||
},
|
||||
interval = 15,
|
||||
chance = 15,
|
||||
chance = 25,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
@ -125,6 +122,7 @@ climate_api.register_abm({
|
||||
nodenames = { "group:regional_weather_snow_cover" },
|
||||
interval = 15,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
|
||||
conditions = {
|
||||
min_heat = 30
|
||||
|
@ -7,6 +7,7 @@ if farming ~= nil and farming.mod == "redo" then
|
||||
nodenames = { "farming:soil" },
|
||||
interval = 8,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
@ -27,6 +28,7 @@ else
|
||||
nodenames = { "group:field" },
|
||||
interval = 8,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
|
Reference in New Issue
Block a user