0
0
Fork 0

Script and documentation cleanup

This commit is contained in:
the-real-herowl 2023-12-10 00:34:31 +01:00 committed by the-real-herowl
parent f9b192e68f
commit 040ce8288e
2 changed files with 2 additions and 9 deletions

View File

@ -37,7 +37,7 @@ def = {
Used to smoothly move between FOVs. Use 0 for an immediate FOV Shift. (Transition time.) Used to smoothly move between FOVs. Use 0 for an immediate FOV Shift. (Transition time.)
* Reset Time: A float value defining the number of seconds to take when removing the FOV Factor. * Reset Time: A float value defining the number of seconds to take when removing the FOV Factor.
Used to smoothly move between FOVs. Use 0 for an immediate FOV Shift. (Reset transition time.) Used to smoothly move between FOVs. Use 0 for an immediate FOV Shift. (Reset transition time.)
*If not provided, defaults to **Time*** Defaults to `time` if not defined.
* Is Multiplier: A bool value used to specify if the FOV Factor is an absolute FOV value or if it should be a percentage * Is Multiplier: A bool value used to specify if the FOV Factor is an absolute FOV value or if it should be a percentage
of the current FOV. Defaults to `true` if not defined. of the current FOV. Defaults to `true` if not defined.
* Exclusive: A bool value used to specify whether the modifier will override all other FOV modifiers. An example of this * Exclusive: A bool value used to specify whether the modifier will override all other FOV modifiers. An example of this
@ -57,8 +57,7 @@ There are three tables that are accessible via the API. They are `registered_mod
`mcl_fovapi.registered_modifiers` has the definitions of all the registered FOV Modifiers. Indexed by Modifier Name. `mcl_fovapi.registered_modifiers` has the definitions of all the registered FOV Modifiers. Indexed by Modifier Name.
And, `mcl_fovapi.applied_modifiers` is indexed by the Player Name. It contains the names of all the modifiers applied to the And, `mcl_fovapi.applied_modifiers` is indexed by the Player Name. It contains the names of all the modifiers applied to the
player. The `mcl_fovapi.default_fov` table is indexed by the Player Name, and contains the Default FOVs of the player from the player.
settings. (Expressed as a value usable in `player:set_fov`.)
#### Namespaces #### Namespaces
`mcl_fovapi` is the default API Namespace. `mcl_fovapi` is the default API Namespace.

View File

@ -12,15 +12,10 @@ local pairs = pairs
-- Globals -- Globals
mcl_fovapi = {} mcl_fovapi = {}
mcl_fovapi.default_fov = {} -- Handles default fov for players
mcl_fovapi.registered_modifiers = {} mcl_fovapi.registered_modifiers = {}
mcl_fovapi.applied_modifiers = {} mcl_fovapi.applied_modifiers = {}
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
-- Assign default FOV
mcl_fovapi.default_fov[name] = player:get_fov()
if DEBUG then if DEBUG then
minetest.log("FOV::Player: " .. name .. "\nFOV: " .. player:get_fov()) minetest.log("FOV::Player: " .. name .. "\nFOV: " .. player:get_fov())
end end
@ -31,7 +26,6 @@ minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
-- handle clean up -- handle clean up
mcl_fovapi.default_fov[name] = nil
mcl_fovapi.applied_modifiers[name] = nil mcl_fovapi.applied_modifiers[name] = nil
end) end)