Merge branch 'master' of https://github.com/Oscuro87/evennia into Oscuro87-master

This commit is contained in:
Griatch 2020-01-28 19:33:26 +01:00
commit abe24e9764

View file

@ -136,7 +136,7 @@ class ExtendedLoopingCall(LoopingCall):
the task is not running. the task is not running.
""" """
if self.running: if self.running and self.interval > 0:
total_runtime = self.clock.seconds() - self.starttime total_runtime = self.clock.seconds() - self.starttime
interval = self.start_delay or self.interval interval = self.start_delay or self.interval
return interval - (total_runtime % self.interval) return interval - (total_runtime % self.interval)
@ -564,11 +564,9 @@ class DefaultScript(ScriptBase):
Restarts an already existing/running Script from the Restarts an already existing/running Script from the
beginning, optionally using different settings. This will beginning, optionally using different settings. This will
first call the stop hooks, and then the start hooks again. first call the stop hooks, and then the start hooks again.
Args: Args:
interval (int, optional): Allows for changing the interval interval (int, optional): Allows for changing the interval
of the Script. Given in seconds. if `None`, will use the of the Script. Given in seconds. if `None`, will use the already stored interval.
already stored interval.
repeats (int, optional): The number of repeats. If unset, will repeats (int, optional): The number of repeats. If unset, will
use the previous setting. use the previous setting.
start_delay (bool, optional): If we should wait `interval` seconds start_delay (bool, optional): If we should wait `interval` seconds
@ -587,6 +585,8 @@ class DefaultScript(ScriptBase):
del self.db._paused_callcount del self.db._paused_callcount
# set new flags and start over # set new flags and start over
if interval is not None: if interval is not None:
if interval < 0:
interval = 0
self.interval = interval self.interval = interval
if repeats is not None: if repeats is not None:
self.repeats = repeats self.repeats = repeats