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)
|
local cdef=mcl_weather.get_weatherdef(mcl_weather.current)
|
||||||
|
|
||||||
if cdef.at_pos ~= nil then --switch to defined weather in at_pos conditions
|
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
|
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)
|
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
|
else
|
||||||
mcl_weather.change_player(name,mcl_weather.current)
|
mcl_weather.change_player(name,mcl_weather.current)
|
||||||
end
|
end
|
||||||
|
|
|
@ -94,7 +94,12 @@ mcl_weather.register_weather("rain",{
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
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
|
if mcl_weather.allow_abm then
|
||||||
|
|
|
@ -57,18 +57,13 @@ mcl_weather.register_weather("snow",{
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
start = function() end,
|
start = function() end,
|
||||||
start_player = function(name)
|
start_player = function(name)end,
|
||||||
local player=minetest.get_player_by_name(name)
|
|
||||||
if not mcl_weather.snow.at_pos(player:get_pos()) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
clear = function() end,
|
clear = function() end,
|
||||||
at_pos = function(pos)
|
at_pos = function(pos) end,
|
||||||
local biome=minetest.get_biome_data(pos)
|
change_at_pos = function(pos)
|
||||||
if mcl_worlds.has_weather(pos) and biome.heat < 15 then
|
local biome=minetest.get_biome_data(pos)
|
||||||
return true
|
if pos.y > 50 or (mcl_worlds.has_weather(pos) and biome.heat > 15 ) then
|
||||||
|
return "rain"
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
change_at_pos = "rain"
|
|
||||||
})
|
})
|
Loading…
Reference in New Issue