forked from vantablack/vantaMOO
trying to make a room channel
This commit is contained in:
parent
3bd279b9aa
commit
409029e55a
|
@ -5,11 +5,13 @@ Rooms are simple containers that has no location of their own.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from lib.rpsystem import ContribRPRoom
|
from lib.rpsystem import ContribRPRoom
|
||||||
|
from evennia.utils import logger
|
||||||
|
|
||||||
# rpsystem
|
# rpsystem
|
||||||
class Room(ContribRPRoom):
|
class Room(ContribRPRoom):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class VBGB(Room):
|
||||||
def at_say(
|
def at_say(
|
||||||
self,
|
self,
|
||||||
message,
|
message,
|
||||||
|
@ -19,7 +21,16 @@ class Room(ContribRPRoom):
|
||||||
msg_receivers=None,
|
msg_receivers=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
channel = typeclasses.channel.msg(message)
|
if not self.channel:
|
||||||
# Get list of all Channels
|
# connect to Evennia channel
|
||||||
channels = evennia.typeclass.objects.all().iterator()
|
channel = search.channel_search("VBGB")
|
||||||
return message
|
if not channel:
|
||||||
|
raise RuntimeError(f"Evennia Channel 'VBGB' not found.")
|
||||||
|
channel = channel[0]
|
||||||
|
# Cache this channel
|
||||||
|
self.channel = channel
|
||||||
|
self.channel.connect(self)
|
||||||
|
logger.log_msg(message)
|
||||||
|
logger.log_msg(self.id)
|
||||||
|
self.channel.msg(message, senders=self.id)
|
||||||
|
return super().at_say(self, message, msg_self,msg_location, receivers, msg_receivers, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue