A WIP Evennia escape room themed MUD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

50 lines
1.8 KiB

'''
Mech typeclass
'''
from typeclasses.objects import Object
from commands.mech_cmds import CmdSetMech
DESC_INSIDE = '''
You see the insides of a large mech.
Glancing at the controls you see you can do the following:
look through the |xHUD|n
|xdrive|n to a destination
|xexit|n the mech
'''.strip()
class Mech(Object):
'''
Mech typeclass
'''
def at_object_creation(self):
'Called once when object is created'
self.locks.add('get:none()') # Restrict ability to be put in inventory
self.db.get_err_msg = "You can't possibly lift this"
self.db.desc_inside = DESC_INSIDE
self.cmdset.add_default(CmdSetMech, permanent=True)
def msg_contents(self, text=None, exclude=[], from_obj=None, mapping=None, **kwargs):
'Intercept in order to relay messages from pilot to the room'
super().msg_contents(text=text, exclude=exclude, from_obj=from_obj, mapping=mapping)
# Relay messages from pilot to room
if exclude:
# Evennia will pass a tuple to this method...I convert it because I hate tuples
# TODO: Embrace the tuple and fix my implementation
exclude = list(exclude).append(self)
self.location.msg_contents(text=text, exclude=exclude, from_obj=from_obj, mapping=mapping)
def at_msg_receive(self, text=None, exclude=None, from_obj=None, **kwargs):
'Relay messages to pilots'
# Prevent loop when pilot uses say
self.msg_contents(text=text, exclude=exclude, from_obj=from_obj)
def return_appearance(self, looker=None):
'What a user sees when using look'
if looker in self.contents:
# return self.db.desc_inside
return self.db.desc_inside
return 'You see a large mech. It looks like it has missiles and stuff.'