mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 15:07:16 +02:00
Fixed some spurious bugs.
This commit is contained in:
parent
7e146eae11
commit
7818ca077a
2 changed files with 11 additions and 9 deletions
|
|
@ -250,14 +250,16 @@ class StateLightSourceOn(Script):
|
|||
prematurely, this hook will store the current
|
||||
burntime.
|
||||
"""
|
||||
# calculate remaining burntime
|
||||
try:
|
||||
time_burnt = time.time() - self.db.script_started
|
||||
except TypeError:
|
||||
# can happen if script_started is not defined
|
||||
time_burnt = self.interval
|
||||
burntime = self.interval - time_burnt
|
||||
self.obj.db.burntime = burntime
|
||||
# calculate remaining burntime, if object is not
|
||||
# already deleted (because it burned out)
|
||||
if self.obj:
|
||||
try:
|
||||
time_burnt = time.time() - self.db.script_started
|
||||
except TypeError:
|
||||
# can happen if script_started is not defined
|
||||
time_burnt = self.interval
|
||||
burntime = self.interval - time_burnt
|
||||
self.obj.db.burntime = burntime
|
||||
|
||||
def is_valid(self):
|
||||
"This script is only valid as long as the lightsource burns."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue