Added an interval configuration.

master
Robert Zenz 2016-01-02 11:51:07 +01:00
parent 83b71abf1c
commit 7f640a7a65
2 changed files with 13 additions and 1 deletions

4
README
View File

@ -56,6 +56,10 @@ The system can be configured by adding settings to the `minetest.conf`:
# to 15.
playermodel_frame_speed_sneaking = 15
# The interval in which the animation is updated, in seconds, defaults
# to 0.066 seconds.
playermodel_interval = 0.066
# The parameters that follow are the start and end frame (both inclusive)
# of the animation, and optionally the frame speed for normal and sneaking.
# Like this: playermodel_animation_laying = 5, 89, 30, 15

View File

@ -63,6 +63,9 @@ playermodel = {
-- Defaults to 15.
frame_speed_sneaking = settings.get_number("playermodel_frame_speed_sneaking", 15),
--- The interval in which the animation is updated. Defaults to 0.066.
interval = settings.get_number("playermodel_interval", 0.066),
--- The name of the model that will be used. Defaults to "character.x".
model = settings.get_string("playermodel_model_name", "character.x"),
@ -89,7 +92,12 @@ function playermodel.activate_internal()
if not playermodel.active then
playermodel.animation_providers:add(playermodel.default_animation_provider)
minetest.register_globalstep(playermodel.perform_animation_updates)
scheduler.schedule(
"playermodel",
playermodel.interval,
playermodel.perform_animation_updates,
scheduler.OVERSHOOT_POLICY_RUN_ONCE)
minetest.register_on_joinplayer(playermodel.activate_model_on_player)
playermodel.active = true