forked from VoxeLibre/VoxeLibre
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.
This commit is contained in:
parent
6cfb55e853
commit
0a17bbe731
|
@ -17,6 +17,8 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mcl_fovapi.register_modifier("spyglass", 8, 0.1,false, true, nil, nil)
|
||||||
|
|
||||||
local spyglass_scope = {}
|
local spyglass_scope = {}
|
||||||
|
|
||||||
local function add_scope(player)
|
local function add_scope(player)
|
||||||
|
@ -37,7 +39,8 @@ local function remove_scope(player)
|
||||||
player:hud_remove(spyglass_scope[player])
|
player:hud_remove(spyglass_scope[player])
|
||||||
spyglass_scope[player] = nil
|
spyglass_scope[player] = nil
|
||||||
player:hud_set_flags({wielditem = true})
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,7 +58,8 @@ controls.register_on_hold(function(player, key, time)
|
||||||
if key ~= "RMB" then return end
|
if key ~= "RMB" then return end
|
||||||
local wielditem = player:get_wielded_item()
|
local wielditem = player:get_wielded_item()
|
||||||
if wielditem:get_name() == "mcl_spyglass:spyglass" then
|
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
|
if spyglass_scope[player] == nil then
|
||||||
add_scope(player)
|
add_scope(player)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue