mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-06-28 22:56:02 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
da4062206d | |||
ffdbdf792e | |||
e6f0067f3b |
@ -26,6 +26,11 @@ local node_box = {
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5}
|
||||
}
|
||||
|
||||
local apply_water_group
|
||||
if regional_weather.settings.puddles_water then
|
||||
apply_water_group = 1
|
||||
end
|
||||
|
||||
for i = 1,VARIANT_COUNT do
|
||||
for flip = 0,1 do
|
||||
local name = BLOCK_PREFIX .. i
|
||||
@ -54,7 +59,7 @@ for i = 1,VARIANT_COUNT do
|
||||
attached_node = 1,
|
||||
slippery = 1,
|
||||
flora = 1,
|
||||
water = 1,
|
||||
water = apply_water_group,
|
||||
weather_puddle = 1
|
||||
},
|
||||
drop = "",
|
||||
|
@ -6,6 +6,7 @@ Expects an integer indicating a chance (between 0 and 1) for lightning to strike
|
||||
]]
|
||||
|
||||
if not minetest.get_modpath("lightning") then return end
|
||||
if regional_weather.settings.lightning == 0 then return end
|
||||
|
||||
local EFFECT_NAME = "regional_weather:lightning"
|
||||
|
||||
@ -46,7 +47,7 @@ local function handle_effect(player_data)
|
||||
chance = chance + value - (chance * value)
|
||||
end
|
||||
local random = math.random()
|
||||
if random <= chance then
|
||||
if random <= chance * regional_weather.settings.lightning then
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
local ppos = player:get_pos()
|
||||
local position = choose_pos(ppos)
|
||||
|
@ -4,6 +4,8 @@ Use this effect to modify a player's movement speed.
|
||||
Expects a numeric value that will be multiplied with the current speed physics.
|
||||
]]
|
||||
|
||||
if not regional_weather.settings.player_speed then return end
|
||||
|
||||
local EFFECT_NAME = "regional_weather:speed_buff"
|
||||
|
||||
local function handle_effect(player_data)
|
||||
|
@ -58,7 +58,7 @@ local function generate_effects(params)
|
||||
movement_direction = vector.normalize(movement)
|
||||
end
|
||||
local vector_product = vector.dot(movement_direction, wind)
|
||||
local movement_penalty = climate_api.utility.sigmoid(vector_product, 1.6, 0.2, 0.8) + 0.2
|
||||
local movement_penalty = climate_api.utility.sigmoid(vector_product, 1.5, 0.15, 0.9) + 0.2
|
||||
override["regional_weather:speed_buff"] = movement_penalty
|
||||
return override
|
||||
end
|
||||
|
19
init.lua
19
init.lua
@ -1,35 +1,42 @@
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
local function get_setting_bool(name, default)
|
||||
local value = minetest.settings:get_bool("regional_weather_" .. name)
|
||||
local function get_setting_bool(name, default, is_global)
|
||||
local prefix = ""
|
||||
if not is_global then prefix = "regional_weather_" end
|
||||
local value = minetest.settings:get_bool(prefix .. name)
|
||||
if type(value) == "nil" then value = default end
|
||||
return minetest.is_yes(value)
|
||||
end
|
||||
|
||||
local function get_setting_number(name, default)
|
||||
local value = minetest.settings:get("regional_weather_" .. name)
|
||||
local function get_setting_number(name, default, is_global)
|
||||
local prefix = ""
|
||||
if not is_global then prefix = "regional_weather_" end
|
||||
local value = minetest.settings:get(prefix .. name)
|
||||
if type(value) == "nil" then value = default end
|
||||
return tonumber(value)
|
||||
end
|
||||
|
||||
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.puddles = get_setting_bool("puddles", true)
|
||||
regional_weather.settings.puddles_water = get_setting_bool("puddles_water", true)
|
||||
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)
|
||||
regional_weather.settings.pedology = get_setting_bool("pedology", true)
|
||||
regional_weather.settings.lightning = get_setting_number("lightning", 1)
|
||||
regional_weather.settings.max_height = get_setting_number("max_height", 120)
|
||||
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_height = get_setting_number("cloud_height", 120)
|
||||
regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
|
||||
|
||||
-- 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) then
|
||||
and get_setting_bool("enable_weather", true, true) then
|
||||
minetest.log("warning", "[Regional Weather] Disable MTG weather for the best experience")
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
[Features]
|
||||
|
||||
# If set to true, wind will boost or penalize player movements based on direction.
|
||||
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
|
||||
|
||||
@ -10,8 +13,11 @@ regional_weather_ice (Freeze river water) bool true
|
||||
# If set to true, water puddles will form during rain or when snow layers have melted.
|
||||
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
|
||||
|
||||
# If set to true, rain will cause dry farmland to turn wet.
|
||||
regional_weather_soil (Hydrate farmland) bool true
|
||||
regional_weather_soil (Hydrate farmland during rain) bool true
|
||||
|
||||
# If set to true, fires will be extinguished during rain showers.
|
||||
regional_weather_fire (Extinguish fire) bool true
|
||||
@ -19,6 +25,10 @@ regional_weather_fire (Extinguish fire) bool true
|
||||
# If set to true, rain will wetten or dry nodes from pedology mod.
|
||||
regional_weather_pedology (Wetten pedology nodes) bool true
|
||||
|
||||
# Multiplier for lightning strike chances
|
||||
# Requires lightning mod to be installed
|
||||
regional_weather_lightning (Lightning chance modifier) float 1 0 20
|
||||
|
||||
[World Configuration]
|
||||
|
||||
# No visual effects will be applied below this height.
|
||||
|
Reference in New Issue
Block a user