mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-02-03 22:10:23 +01:00
Fix MTG warning, add configurability for lightning chances, nerf movement penalties
This commit is contained in:
parent
e6f0067f3b
commit
ffdbdf792e
@ -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 not minetest.get_modpath("lightning") then return end
|
||||||
|
if regional_weather.settings.lightning == 0 then return end
|
||||||
|
|
||||||
local EFFECT_NAME = "regional_weather:lightning"
|
local EFFECT_NAME = "regional_weather:lightning"
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ local function handle_effect(player_data)
|
|||||||
chance = chance + value - (chance * value)
|
chance = chance + value - (chance * value)
|
||||||
end
|
end
|
||||||
local random = math.random()
|
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 player = minetest.get_player_by_name(playername)
|
||||||
local ppos = player:get_pos()
|
local ppos = player:get_pos()
|
||||||
local position = choose_pos(ppos)
|
local position = choose_pos(ppos)
|
||||||
|
@ -58,7 +58,7 @@ local function generate_effects(params)
|
|||||||
movement_direction = vector.normalize(movement)
|
movement_direction = vector.normalize(movement)
|
||||||
end
|
end
|
||||||
local vector_product = vector.dot(movement_direction, wind)
|
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
|
override["regional_weather:speed_buff"] = movement_penalty
|
||||||
return override
|
return override
|
||||||
end
|
end
|
||||||
|
15
init.lua
15
init.lua
@ -1,14 +1,18 @@
|
|||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
local modpath = minetest.get_modpath(modname)
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
|
||||||
local function get_setting_bool(name, default)
|
local function get_setting_bool(name, default, is_global)
|
||||||
local value = minetest.settings:get_bool("regional_weather_" .. name)
|
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
|
if type(value) == "nil" then value = default end
|
||||||
return minetest.is_yes(value)
|
return minetest.is_yes(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_setting_number(name, default)
|
local function get_setting_number(name, default, is_global)
|
||||||
local value = minetest.settings:get("regional_weather_" .. name)
|
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
|
if type(value) == "nil" then value = default end
|
||||||
return tonumber(value)
|
return tonumber(value)
|
||||||
end
|
end
|
||||||
@ -23,6 +27,7 @@ regional_weather.settings.soil = get_setting_bool("soil", true)
|
|||||||
regional_weather.settings.fire = get_setting_bool("fire", true)
|
regional_weather.settings.fire = get_setting_bool("fire", true)
|
||||||
regional_weather.settings.ice = get_setting_bool("ice", true)
|
regional_weather.settings.ice = get_setting_bool("ice", true)
|
||||||
regional_weather.settings.pedology = get_setting_bool("pedology", 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.max_height = get_setting_number("max_height", 120)
|
||||||
regional_weather.settings.min_height = get_setting_number("min_height", -50)
|
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)
|
||||||
@ -31,7 +36,7 @@ regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
|
|||||||
-- warn about clouds being overriden by MTG weather
|
-- warn about clouds being overriden by MTG weather
|
||||||
if climate_mod.settings.skybox
|
if climate_mod.settings.skybox
|
||||||
and minetest.get_modpath("weather")
|
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")
|
minetest.log("warning", "[Regional Weather] Disable MTG weather for the best experience")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,6 +25,10 @@ regional_weather_fire (Extinguish fire) bool true
|
|||||||
# If set to true, rain will wetten or dry nodes from pedology mod.
|
# If set to true, rain will wetten or dry nodes from pedology mod.
|
||||||
regional_weather_pedology (Wetten pedology nodes) bool true
|
regional_weather_pedology (Wetten pedology nodes) bool true
|
||||||
|
|
||||||
|
# Multiplier for lightning strike chances
|
||||||
|
# Require lightning mod to be installed
|
||||||
|
regional_weather_lightning (Lightning chance modifier) float 1 0 20
|
||||||
|
|
||||||
[World Configuration]
|
[World Configuration]
|
||||||
|
|
||||||
# No visual effects will be applied below this height.
|
# No visual effects will be applied below this height.
|
||||||
|
Loading…
Reference in New Issue
Block a user