mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-14 06:53:45 +01:00
Put in checks to prevent repeatedly applying the same FOV modifier.
Added short circuit to remove_modifier if the modifier is not currently applied.
This commit is contained in:
parent
36f661743e
commit
4f3f59f4bc
@ -74,6 +74,9 @@ 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[player][modifier_name] and mcl_fovapi.applied_modifiers[player][modifier_name] == true then
|
||||||
|
return
|
||||||
|
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
|
||||||
@ -110,6 +113,8 @@ function mcl_fovapi.remove_modifier(player, modifier_name)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if mcl_fovapi.applied_modifiers[player][modifier_name] == nil then return end
|
||||||
|
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
minetest.log("FOV::Player: " .. name .. " modifier: " .. modifier_name .. "removed.")
|
minetest.log("FOV::Player: " .. name .. " modifier: " .. modifier_name .. "removed.")
|
||||||
|
Loading…
Reference in New Issue
Block a user