''' 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())