diff --git a/commands/default_cmdsets.py b/commands/default_cmdsets.py index 55510ad..3450ba9 100644 --- a/commands/default_cmdsets.py +++ b/commands/default_cmdsets.py @@ -20,7 +20,9 @@ from evennia.contrib.game_systems.gendersub import SetGender from evennia.contrib.rpg.rpsystem import RPSystemCmdSet from evennia.contrib.rpg.character_creator.character_creator import ContribChargenCmdSet from commands.sittables import CmdNoSitStand -from commands.everyone import CmdTake, CmdThink, CmdSay, CmdWhisper, CmdRead, CmdEat, CmdDrink +from commands.everyone import (CmdTake, CmdThink, CmdSay, + CmdWhisper, CmdRead, CmdEat, CmdDrink, + CmdUse, CmdPush, CmdPull) from commands.wizards import CmdGM, CmdSpell, CmdGMTrigger, CmdMakeCocktail @@ -41,6 +43,9 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet): self.add(CmdNoSitStand) self.add(CmdEat) self.add(CmdDrink) + self.add(CmdUse) + self.add(CmdPush) + self.add(CmdPull) self.add(CmdTake) self.add(CmdThink) self.add(SetGender) diff --git a/commands/everyone.py b/commands/everyone.py index f2b7478..08f6b0f 100755 --- a/commands/everyone.py +++ b/commands/everyone.py @@ -38,6 +38,68 @@ def speech_effect(speech, verb, target, effects): return (speech, speech, verb) +class CmdUse(Command): + """ + Use an item, probably something in your inventory, but could + also be something in the area. + + Usage: + + use + """ + key = "use" + + def func(self): + """Call the 'do_use' method.""" + item = self.caller.search(self.args.strip()) + if item: + if item.has_method('do_use'): + item.do_use(self.caller) + else: + self.caller.msg(f"You can't use {item.name}.") + + +class CmdPush(Command): + """ + Push an item in the area. + + Usage: + + push + """ + key = "push" + + def func(self): + """Call the 'do_push' method.""" + item = self.caller.search(self.args.strip()) + if item: + if item.has_method('do_push'): + item.do_push(self.caller) + else: + self.caller.msg(f"You can't push {item.name}.") + + +class CmdPull(Command): + """ + Pull on something. + + Usage: + + pull + """ + key = "pull" + aliases = ["yank"] + + def func(self): + """Call the 'do_pull' method.""" + item = self.caller.search(self.args.strip()) + if item: + if item.has_method('do_pull'): + item.do_pull(self.caller) + else: + self.caller.msg(f"You can't pull {item.name}.") + + class CmdWhisper(MuxCommand): """ Speak privately as your character to another.