forked from Mineclonia/Mineclonia
support for weathers to change according to pos
This commit is contained in:
parent
cd67354725
commit
f98058a853
|
@ -232,8 +232,10 @@ function mcl_weather.tick()
|
|||
local cdef=mcl_weather.get_weatherdef(mcl_weather.current)
|
||||
|
||||
if cdef.at_pos ~= nil then --switch to defined weather in at_pos conditions
|
||||
if not cdef.at_pos(pos) and cdef.change_at_pos ~= nil then
|
||||
mcl_weather.change_player(name,cdef.change_at_pos)
|
||||
if not cdef.at_pos(pos) and cdef.change_at_pos ~= nil and cdef.change_at_pos(pos) then
|
||||
mcl_weather.change_player(name,cdef.change_at_pos(pos))
|
||||
elseif not cdef.at_pos(pos) then
|
||||
mcl_weather.stop_weather_player(name,cdef)
|
||||
else
|
||||
mcl_weather.change_player(name,mcl_weather.current)
|
||||
end
|
||||
|
|
|
@ -94,7 +94,12 @@ mcl_weather.register_weather("rain",{
|
|||
return true
|
||||
end
|
||||
end,
|
||||
change_at_pos = "snow"
|
||||
change_at_pos = function(pos)
|
||||
local biome=minetest.get_biome_data(pos)
|
||||
if mcl_worlds.has_weather(pos) and biome.heat < 15 then
|
||||
return "snow"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if mcl_weather.allow_abm then
|
||||
|
|
|
@ -57,18 +57,13 @@ mcl_weather.register_weather("snow",{
|
|||
}
|
||||
},
|
||||
start = function() end,
|
||||
start_player = function(name)
|
||||
local player=minetest.get_player_by_name(name)
|
||||
if not mcl_weather.snow.at_pos(player:get_pos()) then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
start_player = function(name)end,
|
||||
clear = function() end,
|
||||
at_pos = function(pos)
|
||||
at_pos = function(pos) end,
|
||||
change_at_pos = function(pos)
|
||||
local biome=minetest.get_biome_data(pos)
|
||||
if mcl_worlds.has_weather(pos) and biome.heat < 15 then
|
||||
return true
|
||||
if pos.y > 50 or (mcl_worlds.has_weather(pos) and biome.heat > 15 ) then
|
||||
return "rain"
|
||||
end
|
||||
end
|
||||
end,
|
||||
change_at_pos = "rain"
|
||||
})
|
Loading…
Reference in New Issue