Added configuration for the interval.
parent
448526c4ca
commit
75e199ac01
3
README
3
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.
|
# If the system should be active or not, defaults to true.
|
||||||
sneakcam_activate = 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.
|
# The offset by which the viewpoing is lowered, defaults to 1.65.
|
||||||
sneakcam_offset = 1.65
|
sneakcam_offset = 1.65
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,9 @@ sneakcam = {
|
||||||
--- If the system is active/has been activated.
|
--- If the system is active/has been activated.
|
||||||
active = false,
|
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 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
|
-- The value is read from the configuration file, the name of the value
|
||||||
-- is sneakcam_offset, defaults to 1.65.
|
-- is sneakcam_offset, defaults to 1.65.
|
||||||
|
@ -55,7 +58,11 @@ end
|
||||||
-- invocations have no effect.
|
-- invocations have no effect.
|
||||||
function sneakcam.activate_internal()
|
function sneakcam.activate_internal()
|
||||||
if not sneakcam.active then
|
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
|
sneakcam.active = true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue