mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Reworked some of the Apply_Modifier code to help prevent errors.
This commit is contained in:
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
|
||||
return
|
||||
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
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if mcl_fovapi.applied_modifiers[player] == nil then
|
||||
mcl_fovapi.applied_modifiers[player] = {}
|
||||
end
|
||||
|
||||
local modifier = mcl_fovapi.registered_modifiers[modifier_name]
|
||||
if modifier.on_start ~= nil then
|
||||
modifier.on_start(player)
|
||||
end
|
||||
|
||||
mcl_fovapi.applied_modifiers[player][modifier_name] = true -- set the applied to be true.
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("FOV::Player Applied Modifiers :" .. dump(mcl_fovapi.applied_modifiers[player]))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user