mirror of
https://github.com/t-affeldt/climate_api.git
synced 2024-12-22 08:50:37 +01:00
Fix crash when trying to apply weather to dead players
This commit is contained in:
parent
082c789d6e
commit
06f337b23e
@ -90,20 +90,22 @@ function trigger.get_active_effects()
|
|||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
local pname = player:get_player_name()
|
local pname = player:get_player_name()
|
||||||
local env = environments[pname]
|
local env = environments[pname]
|
||||||
if is_weather_active(player, wname, env) then
|
if env ~= nil then
|
||||||
if type(climate_mod.current_weather[pname]) == "nil" then
|
if is_weather_active(player, wname, env) then
|
||||||
climate_mod.current_weather[pname] = {}
|
if type(climate_mod.current_weather[pname]) == "nil" then
|
||||||
end
|
climate_mod.current_weather[pname] = {}
|
||||||
table.insert(climate_mod.current_weather[pname], wname)
|
|
||||||
local player_effects = get_weather_effects(player, wconfig, env)
|
|
||||||
for effect, value in pairs(player_effects) do
|
|
||||||
if type(effects[effect]) == "nil" then
|
|
||||||
effects[effect] = {}
|
|
||||||
end
|
end
|
||||||
if type(effects[effect][pname]) == "nil" then
|
table.insert(climate_mod.current_weather[pname], wname)
|
||||||
effects[effect][pname] = {}
|
local player_effects = get_weather_effects(player, wconfig, env)
|
||||||
|
for effect, value in pairs(player_effects) do
|
||||||
|
if type(effects[effect]) == "nil" then
|
||||||
|
effects[effect] = {}
|
||||||
|
end
|
||||||
|
if type(effects[effect][pname]) == "nil" then
|
||||||
|
effects[effect][pname] = {}
|
||||||
|
end
|
||||||
|
effects[effect][pname][wname] = value
|
||||||
end
|
end
|
||||||
effects[effect][pname][wname] = value
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user