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.
 
 
 

41 lines
1.1 KiB

'''
Modified default commands
'''
from evennia import Command, CmdSet
from evennia.commands.default import (
general
)
# TODO: Needs tests
class CmdOverrideLook(general.CmdLook):
'''
Look command but parses out certain words
'''
def parse(self):
if self.args:
parsed_args = [x for x in self.args.split() if x not in ('at', 'the')]
self.args = ' '.join(parsed_args)
def func(self):
'''
Call original but now with new parsed args
'''
# I don't like this here...but I can't do it on the Mech CmdSet because it isn't on the
# character
if self.args and self.caller.location.typename == 'Mech':
results = self.caller.location.search(self.args)
if results:
self.caller.msg(f"You can't see that very well from inside a mech")
return
super().func()
class CmdSetOverride(CmdSet):
'''
Container for overridden commands
'''
def at_cmdset_creation(self):
'Attach commands to the command set'
self.add(CmdOverrideLook())