Reworked some of the Apply_Modifier code to help prevent errors.
parent
2f8389d3f5
commit
580a1caa38
|
@ -74,18 +74,23 @@ function mcl_fovapi.apply_modifier(player, modifier_name)
|
||||||
if mcl_fovapi.registered_modifiers[modifier_name] == nil then
|
if mcl_fovapi.registered_modifiers[modifier_name] == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if mcl_fovapi.applied_modifiers ~= nil and mcl_fovapi.applied_modifiers[player] ~= nil and mcl_fovapi.applied_modifiers[player][modifier_name] ~= nil then
|
if mcl_fovapi.applied_modifiers and mcl_fovapi.applied_modifiers[player] and mcl_fovapi.applied_modifiers[player][modifier_name] then
|
||||||
if mcl_fovapi.applied_modifiers[player][modifier_name] and mcl_fovapi.applied_modifiers[player][modifier_name] == true then
|
if mcl_fovapi.applied_modifiers[player][modifier_name] and mcl_fovapi.applied_modifiers[player][modifier_name] == true then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if mcl_fovapi.applied_modifiers[player] == nil then
|
||||||
|
mcl_fovapi.applied_modifiers[player] = {}
|
||||||
|
end
|
||||||
|
|
||||||
local modifier = mcl_fovapi.registered_modifiers[modifier_name]
|
local modifier = mcl_fovapi.registered_modifiers[modifier_name]
|
||||||
if modifier.on_start ~= nil then
|
if modifier.on_start ~= nil then
|
||||||
modifier.on_start(player)
|
modifier.on_start(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_fovapi.applied_modifiers[player][modifier_name] = true -- set the applied to be true.
|
mcl_fovapi.applied_modifiers[player][modifier_name] = true -- set the applied to be true.
|
||||||
|
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
minetest.log("FOV::Player Applied Modifiers :" .. dump(mcl_fovapi.applied_modifiers[player]))
|
minetest.log("FOV::Player Applied Modifiers :" .. dump(mcl_fovapi.applied_modifiers[player]))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue