Kovitikus

tickerhandler argument won't work

Nov 28th, 2020
805
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Torch(DefaultObject):
  2.  
  3.     def at_object_creation(self):
  4.         self.db.fuel = 10
  5.         self.db.burning = False
  6.         self.db.description = "A unlit wooden torch hangs from a wall here."
  7.  
  8.     def ignite(self, lighter, room):
  9.         room_text = f"{lighter.name} lights {self.name}."
  10.         lighter_text = f"You light {self.name}."
  11.  
  12.         room.msg_contents(room_text, exclude=lighter)
  13.         lighter.msg(lighter_text)
  14.  
  15.         self.db.burning = True
  16.         tickerhandler.add(5, self.at_tick, room)
  17.  
  18.     def at_tick(self, room):
  19.        fuel = self.db.fuel
  20.        room_text = f"{self.name} flickers and crackles as it burns."
  21.        death_text = f"{self.name} burns out with a puff of smoke."
  22.  
  23.        if fuel <= 0:
  24.            self.db.burning = False
  25.            tickerhandler.remove(5, self.at_tick)
  26.            room.msg_contents(death_text)
  27.            self.delete()
  28.        else:
  29.            room.msg_contents(room_text)
  30.            self.db.fuel -= 1
RAW Paste Data