From f07b6fa23e14af98e095a3a73d3e11222d81b0eb Mon Sep 17 00:00:00 2001 From: theFox6 Date: Thu, 17 May 2018 17:00:58 +0200 Subject: [PATCH] merge local repository --- weather/snow.lua | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/weather/snow.lua b/weather/snow.lua index 5c867bb..92a039e 100644 --- a/weather/snow.lua +++ b/weather/snow.lua @@ -26,23 +26,25 @@ minetest.register_node("weather:snow_cover", { drop = {} }) ---[[ Enable this section if you have a very fast PC -minetest.register_abm({ - nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"}, - neighbors = {"default:air"}, - interval = 10.0, - chance = 80, - action = function (pos, node, active_object_count, active_object_count_wider) - if weather == "snow" then - if minetest.registered_nodes[node.name].drawtype == "normal" - or minetest.registered_nodes[node.name].drawtype == "allfaces_optional" then - local np = vector.add(pos, {x=0, y=1, z=0}) - if minetest.env:get_node_light(np, 0.5) == 15 - and minetest.env:get_node(np).name == "air" then - minetest.env:add_node(np, {name="weather:snow_cover"}) +-- Snow cover ABM when weather_fast_pc setting is set to `true` +if minetest.is_yes(minetest.settings:get_bool('weather_fast_pc')) then + minetest.log('action', '[weather] Loaded fast computer ABM (snow covers when weather:snow is set)') + minetest.register_abm({ + nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"}, + neighbors = {"default:air"}, + interval = 10.0, + chance = 80, + action = function (pos, node) + if weather.type == "weather:snow" then + if minetest.registered_nodes[node.name].drawtype == "normal" + or minetest.registered_nodes[node.name].drawtype == "allfaces_optional" then + local np = vector.add(pos, {x=0, y=1, z=0}) + if minetest.env:get_node_light(np, 0.5) == 15 + and minetest.env:get_node(np).name == "air" then + minetest.env:add_node(np, {name="weather:snow_cover"}) + end end end end - end -}) -]] + }) +end