mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-07-27 12:50:18 +02:00
Compare commits
6 Commits
v1.0.1
...
4b44f25ef8
Author | SHA1 | Date | |
---|---|---|---|
4b44f25ef8 | |||
f3e6d48b97 | |||
5e2cba0ae8 | |||
1079f9a762 | |||
0fd6942225 | |||
920f80e044 |
@ -14,7 +14,8 @@ climate_api.register_abm({
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
max_heat = 85,
|
||||
daylight = 15
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
|
@ -5,7 +5,10 @@ then return end
|
||||
|
||||
local BLOCK_NAME = "regional_weather:ice"
|
||||
|
||||
local S = regional_weather.i18n
|
||||
|
||||
minetest.register_node(BLOCK_NAME, {
|
||||
description = S("Thin Ice"),
|
||||
tiles = {"(default_ice.png^[colorize:#ffffff:50)^[opacity:200"},
|
||||
paramtype = "light",
|
||||
groups = {
|
||||
@ -40,7 +43,8 @@ climate_api.register_abm({
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
max_heat = 25,
|
||||
daylight = 15
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
@ -59,7 +63,8 @@ climate_api.register_abm({
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 40,
|
||||
daylight = 15
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
|
@ -14,7 +14,8 @@ climate_api.register_abm({
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 25,
|
||||
min_light = 15
|
||||
daylight = 15,
|
||||
indoors = false,
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
|
@ -1,6 +1,7 @@
|
||||
local BLOCK_PREFIX = "regional_weather:puddle_"
|
||||
local VARIANT_COUNT = 39
|
||||
local MIN_DISTANCE = 4
|
||||
local CHECK_DISTANCE = 4
|
||||
local MAX_AMOUNT = 3
|
||||
|
||||
local GROUND_COVERS = {
|
||||
"group:soil",
|
||||
@ -12,18 +13,34 @@ local GROUND_COVERS = {
|
||||
"default:permafrost_with_stones"
|
||||
}
|
||||
|
||||
local S = regional_weather.i18n
|
||||
|
||||
-- clean up puddles if disabled
|
||||
if not regional_weather.settings.puddles then
|
||||
for i=1,VARIANT_COUNT do
|
||||
for r=0,270,90 do
|
||||
minetest.register_alias(BLOCK_PREFIX .. i .. "_" .. r, "air")
|
||||
-- set all puddle nodes to air
|
||||
minetest.register_alias("regional_weather:puddle", "air")
|
||||
for i = 1, VARIANT_COUNT do
|
||||
for flip = 0, 1 do
|
||||
local name = BLOCK_PREFIX .. i
|
||||
if flip == 1 then
|
||||
name = name .. "_flipped"
|
||||
end
|
||||
minetest.register_alias(name, "air")
|
||||
end
|
||||
end
|
||||
|
||||
-- return air instead of a puddle
|
||||
function regional_weather.get_random_puddle()
|
||||
return { name = "air" }
|
||||
end
|
||||
|
||||
-- end puddle execution
|
||||
return
|
||||
end
|
||||
|
||||
local node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5}
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.49, 0.5 }
|
||||
}
|
||||
|
||||
local apply_water_group
|
||||
@ -31,8 +48,8 @@ if regional_weather.settings.puddles_water then
|
||||
apply_water_group = 1
|
||||
end
|
||||
|
||||
for i = 1,VARIANT_COUNT do
|
||||
for flip = 0,1 do
|
||||
for i = 1, VARIANT_COUNT do
|
||||
for flip = 0, 1 do
|
||||
local name = BLOCK_PREFIX .. i
|
||||
local index = i
|
||||
if i < 10 then index = "0" .. i end
|
||||
@ -42,6 +59,7 @@ for i = 1,VARIANT_COUNT do
|
||||
texture = texture .. "^[transformFX"
|
||||
end
|
||||
minetest.register_node(name, {
|
||||
description = S("Puddle"),
|
||||
tiles = { texture },
|
||||
drawtype = "nodebox",
|
||||
pointable = false,
|
||||
@ -75,7 +93,7 @@ end
|
||||
|
||||
minetest.register_alias("regional_weather:puddle", BLOCK_PREFIX .. "14")
|
||||
|
||||
local function get_random_puddle()
|
||||
function regional_weather.get_random_puddle()
|
||||
local index = math.random(1, VARIANT_COUNT)
|
||||
local rotation = math.random(0, 3) * 90
|
||||
local flip = math.random(0, 1)
|
||||
@ -101,7 +119,8 @@ climate_api.register_abm({
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
min_heat = 30,
|
||||
daylight = 15
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
pos_override = function(pos)
|
||||
@ -109,25 +128,28 @@ climate_api.register_abm({
|
||||
end,
|
||||
|
||||
action = function (pos, node, env)
|
||||
-- only override air nodes
|
||||
if minetest.get_node(pos).name ~= "air" then return end
|
||||
if minetest.find_node_near(pos, MIN_DISTANCE, "group:weather_puddle") then return end
|
||||
minetest.set_node(pos, get_random_puddle())
|
||||
-- do not place puddle if area is not fully loaded
|
||||
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
|
||||
-- do not place puddle if already enpugh puddles
|
||||
local pos1 = vector.add(pos, { x = -CHECK_DISTANCE, y = -1, z = -CHECK_DISTANCE })
|
||||
local pos2 = vector.add(pos, { x = CHECK_DISTANCE, y = 1, z = CHECK_DISTANCE })
|
||||
local preplaced = minetest.find_nodes_in_area(pos1, pos2, "group:weather_puddle")
|
||||
if preplaced ~= nil and #preplaced >= MAX_AMOUNT then return end
|
||||
minetest.set_node(pos, regional_weather.get_random_puddle())
|
||||
end
|
||||
})
|
||||
|
||||
-- Makes puddles dry up when not raining
|
||||
climate_api.register_abm({
|
||||
label = "remove rain puddles",
|
||||
nodenames = { "group:regional_weather_puddle" },
|
||||
interval = 10,
|
||||
chance = 3,
|
||||
nodenames = { "group:weather_puddle" },
|
||||
interval = 25,
|
||||
chance = 30,
|
||||
catch_up = true,
|
||||
|
||||
action = function (pos, node, env)
|
||||
if env.humidity < 55 then
|
||||
minetest.remove_node(pos)
|
||||
elseif env.heat < 30 and regional_weather.settings.snow_cover then
|
||||
minetest.set_node(pos, {name = "regional_weather:snow_cover_1"})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
})
|
||||
|
@ -1,4 +1,8 @@
|
||||
local BLOCK_PREFIX = "regional_weather:snow_cover_"
|
||||
local CHECK_DISTANCE = 5
|
||||
local MAX_AMOUNT = 20
|
||||
|
||||
local S = regional_weather.i18n
|
||||
|
||||
if not minetest.get_modpath("default")
|
||||
or default.node_sound_snow_defaults == nil
|
||||
@ -23,6 +27,7 @@ for i = 1,5 do
|
||||
}
|
||||
|
||||
minetest.register_node(BLOCK_PREFIX .. i, {
|
||||
description = S("Snow Cover"),
|
||||
tiles = { "default_snow.png" },
|
||||
drawtype = "nodebox",
|
||||
buildable_to = i < 3,
|
||||
@ -35,7 +40,7 @@ for i = 1,5 do
|
||||
crumbly = 3,
|
||||
falling_node = 1,
|
||||
snowy = 1,
|
||||
regional_weather_snow_cover = i
|
||||
weather_snow_cover = i
|
||||
},
|
||||
sounds = default.node_sound_snow_defaults(),
|
||||
drop = "default:snow " .. math.ceil(i / 2),
|
||||
@ -61,7 +66,7 @@ climate_api.register_abm({
|
||||
},
|
||||
neighbors = { "air" },
|
||||
interval = 25,
|
||||
chance = 40,
|
||||
chance = 80,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
@ -69,7 +74,16 @@ climate_api.register_abm({
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
max_heat = 30,
|
||||
daylight = 15
|
||||
not_biome = {
|
||||
"cold_desert",
|
||||
"cold_desert_ocean",
|
||||
"desert",
|
||||
"desert_ocean",
|
||||
"sandstone_desert",
|
||||
"sandstone_desert_ocean"
|
||||
},
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
pos_override = function(pos)
|
||||
@ -77,64 +91,88 @@ climate_api.register_abm({
|
||||
end,
|
||||
|
||||
action = function (pos, node, env)
|
||||
-- only override air nodes
|
||||
if node.name ~= "air" then return end
|
||||
local base = minetest.get_node(vector.add(pos, {x=0, y=-1, z=0})).name
|
||||
local is_soil = minetest.get_item_group(base, "soil") or 0
|
||||
local is_stone = minetest.get_item_group(base, "stone") or 0
|
||||
if not (is_soil == 0 and is_stone == 0) then
|
||||
minetest.set_node(pos, { name = BLOCK_PREFIX .. "1" })
|
||||
end
|
||||
-- do not place snow if area is not fully loaded
|
||||
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
|
||||
-- do not place snow if already enpugh snow
|
||||
local pos1 = vector.add(pos, { x = -CHECK_DISTANCE, y = -1, z = -CHECK_DISTANCE })
|
||||
local pos2 = vector.add(pos, { x = CHECK_DISTANCE, y = 1, z = CHECK_DISTANCE })
|
||||
local preplaced = minetest.find_nodes_in_area(pos1, pos2, "group:weather_snow_cover")
|
||||
if preplaced ~= nil and #preplaced >= MAX_AMOUNT then return end
|
||||
minetest.set_node(pos, { name = BLOCK_PREFIX .. "1" })
|
||||
end
|
||||
})
|
||||
|
||||
climate_api.register_abm({
|
||||
label = "replace flora with snow covers and stack covers higher",
|
||||
nodenames = {
|
||||
"group:flora",
|
||||
"group:grass",
|
||||
"group:plant",
|
||||
"group:regional_weather_snow_cover"
|
||||
},
|
||||
neighbors = { "air" },
|
||||
interval = 25,
|
||||
chance = 30,
|
||||
catch_up = false,
|
||||
if regional_weather.settings.snow_griefing then
|
||||
climate_api.register_abm({
|
||||
label = "replace flora with snow covers and stack covers higher",
|
||||
nodenames = {
|
||||
"group:flora",
|
||||
"group:grass",
|
||||
"group:plant",
|
||||
"group:weather_snow_cover"
|
||||
},
|
||||
neighbors = { "air" },
|
||||
interval = 25,
|
||||
chance = 160,
|
||||
catch_up = false,
|
||||
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
max_heat = 30,
|
||||
daylight = 15
|
||||
},
|
||||
conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
max_heat = 30,
|
||||
not_biome = {
|
||||
"cold_desert",
|
||||
"cold_desert_ocean",
|
||||
"desert",
|
||||
"desert_ocean",
|
||||
"sandstone_desert",
|
||||
"sandstone_desert_ocean"
|
||||
},
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
local value = minetest.get_item_group(node.name, "regional_weather_snow_cover")
|
||||
if value == nil then value = 0 end
|
||||
if value < 5 then
|
||||
minetest.set_node(pos, { name = BLOCK_PREFIX .. (value + 1) })
|
||||
action = function (pos, node, env)
|
||||
local value = minetest.get_item_group(node.name, "weather_snow_cover") or 0
|
||||
if value == 0 then
|
||||
-- do not override plants unless marked as buildable_to
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def == nil or not def.buildable_to then return end
|
||||
-- do not override plants of the frost_resistance group
|
||||
local resistance = minetest.get_item_group(node.name, "frost_resistance") or 0
|
||||
if resistance > 0 then return end
|
||||
end
|
||||
-- do not place snow if area is not fully loaded
|
||||
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
|
||||
-- do not place snow if already enpugh snow
|
||||
local pos1 = vector.add(pos, { x = -CHECK_DISTANCE, y = -1, z = -CHECK_DISTANCE })
|
||||
local pos2 = vector.add(pos, { x = CHECK_DISTANCE, y = 1, z = CHECK_DISTANCE })
|
||||
local preplaced = minetest.find_nodes_in_area(pos1, pos2, "group:weather_snow_cover")
|
||||
if preplaced ~= nil and #preplaced >= MAX_AMOUNT then return end
|
||||
if value < 5 then
|
||||
minetest.set_node(pos, { name = BLOCK_PREFIX .. (value + 1) })
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
climate_api.register_abm({
|
||||
label = "melt snow covers",
|
||||
nodenames = { "group:regional_weather_snow_cover" },
|
||||
nodenames = { "group:weather_snow_cover" },
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
chance = 85,
|
||||
catch_up = true,
|
||||
|
||||
conditions = {
|
||||
min_heat = 30
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
local value = minetest.get_item_group(node.name, "regional_weather_snow_cover")
|
||||
local value = minetest.get_item_group(node.name, "weather_snow_cover")
|
||||
if value == nil then value = 0 end
|
||||
if value > 1 then
|
||||
minetest.set_node(pos, { name = BLOCK_PREFIX .. (value - 1) })
|
||||
elseif regional_weather.settings.puddles then
|
||||
minetest.set_node(pos, { name = "regional_weather:puddle" })
|
||||
minetest.set_node(pos, regional_weather.get_random_puddle())
|
||||
else
|
||||
minetest.set_node(pos, { name = "air" })
|
||||
end
|
||||
|
@ -14,7 +14,8 @@ if farming ~= nil and farming.mod == "redo" then
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
min_heat = 30,
|
||||
min_light = 15
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
@ -35,7 +36,8 @@ else
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_humidity = 55,
|
||||
min_heat = 30,
|
||||
min_light = 15
|
||||
daylight = 15,
|
||||
indoors = false
|
||||
},
|
||||
|
||||
action = function (pos, node, env)
|
||||
|
@ -7,7 +7,15 @@ local conditions = {
|
||||
max_heat = 45,
|
||||
min_humidity = 65,
|
||||
min_windspeed = 2.5,
|
||||
daylight = 15
|
||||
indoors = false,
|
||||
not_biome = {
|
||||
"cold_desert",
|
||||
"cold_desert_ocean",
|
||||
"desert",
|
||||
"desert_ocean",
|
||||
"sandstone_desert",
|
||||
"sandstone_desert_ocean"
|
||||
}
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
@ -7,7 +7,7 @@ local conditions = {
|
||||
min_humidity = 30,
|
||||
max_humidity = 40,
|
||||
max_windspeed = 2,
|
||||
daylight = 15,
|
||||
indoors = false,
|
||||
has_biome = {
|
||||
"default",
|
||||
"deciduous_forest",
|
||||
|
@ -6,7 +6,7 @@ local conditions = {
|
||||
min_heat = 35,
|
||||
min_humidity = 50,
|
||||
max_humidity = 65,
|
||||
daylight = 15
|
||||
indoors = false
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
@ -5,7 +5,7 @@ local conditions = {
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 40,
|
||||
min_humidity = 65,
|
||||
daylight = 15
|
||||
indoors = false
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
@ -6,7 +6,15 @@ local conditions = {
|
||||
max_heat = 35,
|
||||
min_humidity = 50,
|
||||
max_humidity = 65,
|
||||
daylight = 15
|
||||
indoors = false,
|
||||
not_biome = {
|
||||
"cold_desert",
|
||||
"cold_desert_ocean",
|
||||
"desert",
|
||||
"desert_ocean",
|
||||
"sandstone_desert",
|
||||
"sandstone_desert_ocean"
|
||||
}
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
@ -5,7 +5,15 @@ local conditions = {
|
||||
max_height = regional_weather.settings.max_height,
|
||||
max_heat = 30,
|
||||
min_humidity = 65,
|
||||
daylight = 15
|
||||
indoors = false,
|
||||
not_biome = {
|
||||
"cold_desert",
|
||||
"cold_desert_ocean",
|
||||
"desert",
|
||||
"desert_ocean",
|
||||
"sandstone_desert",
|
||||
"sandstone_desert_ocean"
|
||||
}
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
@ -4,7 +4,7 @@ local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_windspeed = 3,
|
||||
daylight = 15
|
||||
indoors = false,
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
8
init.lua
8
init.lua
@ -21,8 +21,9 @@ regional_weather = {}
|
||||
regional_weather.settings = {}
|
||||
regional_weather.settings.player_speed = get_setting_bool("player_speed", true)
|
||||
regional_weather.settings.snow = get_setting_bool("snow_layers", true)
|
||||
regional_weather.settings.snow_griefing = get_setting_bool("snow_griefing", true)
|
||||
regional_weather.settings.puddles = get_setting_bool("puddles", true)
|
||||
regional_weather.settings.puddles_water = get_setting_bool("puddles_water", true)
|
||||
regional_weather.settings.puddles_water = get_setting_bool("puddles_water", false)
|
||||
regional_weather.settings.soil = get_setting_bool("soil", true)
|
||||
regional_weather.settings.fire = get_setting_bool("fire", true)
|
||||
regional_weather.settings.ice = get_setting_bool("ice", true)
|
||||
@ -33,11 +34,14 @@ regional_weather.settings.min_height = get_setting_number("min_height", -50)
|
||||
regional_weather.settings.cloud_height = get_setting_number("cloud_height", 120)
|
||||
regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
|
||||
|
||||
local S = minetest.get_translator("regional_weather")
|
||||
regional_weather.i18n = S
|
||||
|
||||
-- warn about clouds being overriden by MTG weather
|
||||
if climate_mod.settings.skybox
|
||||
and minetest.get_modpath("weather")
|
||||
and get_setting_bool("enable_weather", true, true) then
|
||||
minetest.log("warning", "[Regional Weather] Disable MTG weather for the best experience")
|
||||
minetest.log("warning", "[Regional Weather] " .. S("Disable MTG weather for the best experience. Check the forum for more information."))
|
||||
end
|
||||
|
||||
-- import individual weather types
|
||||
|
5
locale/regional_weather.de.tr
Normal file
5
locale/regional_weather.de.tr
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain:regional_weather
|
||||
Disable MTG weather for the best experience. Check the forum for more information.=Deaktiviere MTG weather für die beste Spielerfahrung. Mehr Informationen im Forum.
|
||||
Thin Ice=Dünnes Eis
|
||||
Puddle=Pfütze
|
||||
Snow Cover=Schnee
|
5
locale/template.txt
Normal file
5
locale/template.txt
Normal file
@ -0,0 +1,5 @@
|
||||
# textdomain:regional_weather
|
||||
Disable MTG weather for the best experience=
|
||||
Thin Ice=
|
||||
Puddle=
|
||||
Snow Cover=
|
@ -6,6 +6,9 @@ regional_weather_player_speed (Change movement speed based on wind) bool true
|
||||
# If set to true, snow layers will stack up during snowy weather.
|
||||
regional_weather_snow_layers (Place snow layers) bool true
|
||||
|
||||
# If set to true, snow layers will destroy crops
|
||||
regional_weather_snow_griefing (Destructive snow layers) bool true
|
||||
|
||||
# If set to true, river water sources will freeze at low temperatures and melt when it gets warmer again.
|
||||
# This process does not affect regular ice blocks because it adds its own temporary ones.
|
||||
regional_weather_ice (Freeze river water) bool true
|
||||
@ -14,7 +17,8 @@ regional_weather_ice (Freeze river water) bool true
|
||||
regional_weather_puddles (Place rain puddles) bool true
|
||||
|
||||
# If set to true, puddles will be marked as water and hydrate farmland.
|
||||
regional_weather_puddles_water (Hydrate farmland near puddles) bool true
|
||||
# Not compatible with some ambient sound or mob mods
|
||||
regional_weather_puddles_water (Hydrate farmland near puddles) bool false
|
||||
|
||||
# If set to true, rain will cause dry farmland to turn wet.
|
||||
regional_weather_soil (Hydrate farmland during rain) bool true
|
||||
|
Reference in New Issue
Block a user