1
0
Fork 0

Added reset for player respawning to remove FOV modifiers.

Fixed missing on_end call in remove_all_modifiers.
Added mcl_fovapi to Bows, Sprint, and Spyglass.
Set up the Spyglass to use the new FOV API.
mobile_bow_workaround
Michieal 2023-12-03 08:29:53 -05:00 committed by the-real-herowl
parent 6cfb55e853
commit 0a17bbe731
1 changed files with 6 additions and 2 deletions

View File

@ -17,6 +17,8 @@ minetest.register_craft({
}
})
mcl_fovapi.register_modifier("spyglass", 8, 0.1,false, true, nil, nil)
local spyglass_scope = {}
local function add_scope(player)
@ -37,7 +39,8 @@ local function remove_scope(player)
player:hud_remove(spyglass_scope[player])
spyglass_scope[player] = nil
player:hud_set_flags({wielditem = true})
player:set_fov(86.1)
mcl_fovapi.remove_modifier(player, "spyglass") -- use the api to remove the FOV effect.
-- old code: player:set_fov(86.1)
end
end
@ -55,7 +58,8 @@ controls.register_on_hold(function(player, key, time)
if key ~= "RMB" then return end
local wielditem = player:get_wielded_item()
if wielditem:get_name() == "mcl_spyglass:spyglass" then
player:set_fov(8, false, 0.1)
mcl_fovapi.apply_modifier(player, "spyglass") -- apply the FOV effect.
-- old code: player:set_fov(8, false, 0.1)
if spyglass_scope[player] == nil then
add_scope(player)
end