Add 'use', 'push' and 'push' commands
This commit is contained in:
parent
b09e0d6d8f
commit
aeea787887
2 changed files with 68 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <item>
|
||||
"""
|
||||
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 <item>
|
||||
"""
|
||||
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 <item>
|
||||
"""
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue