mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-01-08 01:00:30 +01:00
Make snow griefing optional
This commit is contained in:
parent
0fd6942225
commit
1079f9a762
@ -103,57 +103,59 @@ climate_api.register_abm({
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
climate_api.register_abm({
|
if regional_weather.settings.snow_griefing then
|
||||||
label = "replace flora with snow covers and stack covers higher",
|
climate_api.register_abm({
|
||||||
nodenames = {
|
label = "replace flora with snow covers and stack covers higher",
|
||||||
"group:flora",
|
nodenames = {
|
||||||
"group:grass",
|
"group:flora",
|
||||||
"group:plant",
|
"group:grass",
|
||||||
"group:weather_snow_cover"
|
"group:plant",
|
||||||
},
|
"group:weather_snow_cover"
|
||||||
neighbors = { "air" },
|
},
|
||||||
interval = 25,
|
neighbors = { "air" },
|
||||||
chance = 30,
|
interval = 25,
|
||||||
catch_up = false,
|
chance = 30,
|
||||||
|
catch_up = false,
|
||||||
|
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 55,
|
min_humidity = 55,
|
||||||
max_heat = 30,
|
max_heat = 30,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
not_biome = {
|
not_biome = {
|
||||||
"cold_desert",
|
"cold_desert",
|
||||||
"cold_desert_ocean",
|
"cold_desert_ocean",
|
||||||
"desert",
|
"desert",
|
||||||
"desert_ocean",
|
"desert_ocean",
|
||||||
"sandstone_desert",
|
"sandstone_desert",
|
||||||
"sandstone_desert_ocean"
|
"sandstone_desert_ocean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
action = function (pos, node, env)
|
action = function (pos, node, env)
|
||||||
local value = minetest.get_item_group(node.name, "weather_snow_cover") or 0
|
local value = minetest.get_item_group(node.name, "weather_snow_cover") or 0
|
||||||
if value == 0 then
|
if value == 0 then
|
||||||
-- do not override plants unless marked as buildable_to
|
-- do not override plants unless marked as buildable_to
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def == nil or not def.buildable_to then return end
|
if def == nil or not def.buildable_to then return end
|
||||||
-- do not override plants of the frost_resistance group
|
-- do not override plants of the frost_resistance group
|
||||||
local resistance = minetest.get_item_group(node.name, "frost_resistance") or 0
|
local resistance = minetest.get_item_group(node.name, "frost_resistance") or 0
|
||||||
if resistance > 0 then return end
|
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
|
||||||
-- do not place snow if area is not fully loaded
|
})
|
||||||
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
|
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
|
|
||||||
})
|
|
||||||
|
|
||||||
climate_api.register_abm({
|
climate_api.register_abm({
|
||||||
label = "melt snow covers",
|
label = "melt snow covers",
|
||||||
|
1
init.lua
1
init.lua
@ -21,6 +21,7 @@ regional_weather = {}
|
|||||||
regional_weather.settings = {}
|
regional_weather.settings = {}
|
||||||
regional_weather.settings.player_speed = get_setting_bool("player_speed", true)
|
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 = 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 = 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", true)
|
||||||
regional_weather.settings.soil = get_setting_bool("soil", true)
|
regional_weather.settings.soil = get_setting_bool("soil", true)
|
||||||
|
@ -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.
|
# If set to true, snow layers will stack up during snowy weather.
|
||||||
regional_weather_snow_layers (Place snow layers) bool true
|
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.
|
# 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.
|
# This process does not affect regular ice blocks because it adds its own temporary ones.
|
||||||
regional_weather_ice (Freeze river water) bool true
|
regional_weather_ice (Freeze river water) bool true
|
||||||
|
Loading…
Reference in New Issue
Block a user