Skip to content

Instantly share code, notes, and snippets.

@GedMullen
Created May 19, 2016 10:16
Show Gist options
  • Save GedMullen/1e88dd6be4496cc9e2bede7d61ac7872 to your computer and use it in GitHub Desktop.
Save GedMullen/1e88dd6be4496cc9e2bede7d61ac7872 to your computer and use it in GitHub Desktop.
"""
Room
Rooms are simple containers that has no location of their own.
"""
import random
from evennia import DefaultRoom, TICKER_HANDLER
ECHOES = ["Scottie says 'I cannae do it Cpatian'",
"test message 2",
"test message 3"] # etc
class WeatherRoom(DefaultRoom):
"This room is ticked at regular intervals"
def at_object_creation(self):
"called only when the object is first created"
TICKER_HANDLER.add(self, 10, hook_key="at_weather_update")
def at_weather_update(self, *args, **kwargs):
"ticked at regular intervals"
echo = random.choice(ECHOES)
self.msg_contents(echo)
class Room(DefaultRoom):
"""
Rooms are like any Object, except their location is None
(which is default). They also use basetype_setup() to
add locks so they cannot be puppeted or picked up.
(to change that, use at_object_creation instead)
See examples/object.py for a list of
properties and methods available on all Objects.
"""
pass
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment