diff --git a/README b/README index 0de1995..d7dc825 100644 --- a/README +++ b/README @@ -18,6 +18,9 @@ The system can be configured by adding settings to `minetest.conf` file. # If the system should be active or not, defaults to true. sneakcam_activate = true + # The interval in which the system runs, in seconds, defaults to 0.066. + sneakcam_interval = 0.066 + # The offset by which the viewpoing is lowered, defaults to 1.65. sneakcam_offset = 1.65 diff --git a/mods/sneak_cam/sneakcam.lua b/mods/sneak_cam/sneakcam.lua index 6ce8c70..dda42dd 100644 --- a/mods/sneak_cam/sneakcam.lua +++ b/mods/sneak_cam/sneakcam.lua @@ -33,6 +33,9 @@ sneakcam = { --- If the system is active/has been activated. active = false, + --- The interval in which the system updates, defaults to 0.066. + interval = settings.get_number("sneakcam_interval", 0.066), + --- The offset by which the camera is lowered if the player is sneaking. -- The value is read from the configuration file, the name of the value -- is sneakcam_offset, defaults to 1.65. @@ -55,7 +58,11 @@ end -- invocations have no effect. function sneakcam.activate_internal() if not sneakcam.active then - minetest.register_globalstep(sneakcam.update_player_cams) + scheduler.schedule( + "sneakcam", + sneakcam.interval, + sneakcam.update_player_cams, + scheduler.OVERSHOOT_POLICY_RUN_ONCE) sneakcam.active = true end