Merge pull request #7 from 4w/master

fix and make the snow plates ABM configurable
This commit is contained in:
theFox6 2018-05-14 17:04:14 +02:00 committed by GitHub
commit d2729cb191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 17 deletions

8
weather/settingtypes.txt Normal file
View File

@ -0,0 +1,8 @@
# Fast computer ABM
#
# The “fast computer ABM” controls if snow covers will be placed
# on the ground when `weather:snow` is set. This needs a better
# computer and should not be used if the performance drops too
# much. It is advised not to enable this on servers and it is
# disbaled by default
weather_fast_pc (Snow covers for fast PCs) bool false

View File

@ -26,14 +26,16 @@ minetest.register_node("weather:snow_cover", {
drop = {}
})
--[[ Enable this section if you have a very fast PC
minetest.register_abm({
-- 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, active_object_count, active_object_count_wider)
if weather == "snow" then
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})
@ -44,5 +46,5 @@ minetest.register_abm({
end
end
end
})
]]
})
end