species-specific command framework
This commit is contained in:
parent
151db69595
commit
e3cc6674f3
|
@ -9,7 +9,6 @@ from evennia.commands.command import Command as BaseCommand
|
|||
|
||||
# from evennia import default_cmds
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""
|
||||
Base command (you may see this if a child command had no help text defined)
|
||||
|
@ -32,6 +31,22 @@ class Command(BaseCommand):
|
|||
#
|
||||
pass
|
||||
|
||||
class CmdMeow(Command):
|
||||
|
||||
key = 'meow'
|
||||
|
||||
def func(self):
|
||||
args = self.args.strip()
|
||||
if not args:
|
||||
self.caller.msg("Who or what would you like to meow at?")
|
||||
return
|
||||
target = self.caller.search(args)
|
||||
if not target:
|
||||
return
|
||||
self.caller.msg(f"You meowed at {target.key}!")
|
||||
target.msg(f"You got meowed at by {self.caller.key}!")
|
||||
|
||||
|
||||
|
||||
# -------------------------------------------------------------
|
||||
#
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
from evennia import CmdSet
|
||||
#from commands import encounter_cmdset as encounter
|
||||
from commands import command as cmd
|
||||
|
||||
class SetSpeciesHuman(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(cmd.CmdMeow())
|
||||
|
||||
class SetSpeciesCatkin(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(cmd.CmdMeow())
|
||||
|
||||
class SetSpeciesDogkin(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(cmd.CmdMeow())
|
|
@ -77,14 +77,23 @@ class CmdKiss(EncounterCommand):
|
|||
self.caller.msg(f"You kiss {self.target}{self.adverb}")
|
||||
self.target.msg(f"{self.caller} kisses you{self.adverb}")
|
||||
|
||||
|
||||
class SetSpeciesHuman(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(CmdBite)
|
||||
self.add(CmdKiss)
|
||||
|
||||
class SetSpeciesPlaceholder(CmdSet):
|
||||
|
||||
class SetSpeciesCatkin(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
pass
|
||||
self.add(CmdBite)
|
||||
self.add(CmdKiss)
|
||||
|
||||
class SetSpeciesDogkin(CmdSet):
|
||||
def at_cmdset_creation(self):
|
||||
self.add(CmdBite)
|
||||
self.add(CmdKiss)
|
||||
|
||||
|
||||
# Special encounter commands
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ class Character(ClothedCharacter):
|
|||
self.cmdset.remove(SetEncounterSpecial)
|
||||
pass
|
||||
|
||||
def apply_basic_cmdset(self):
|
||||
self.cmdset.add(SPECIES_CMDSET[self.db.species])
|
||||
|
||||
def at_pre_move(self, destination, **kwargs):
|
||||
if self.ndb.encounter_handler:
|
||||
self.msg("You would need to leave the encounter first")
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
from commands.encounter_cmdset import SetSpeciesHuman
|
||||
from commands.encounter_cmdset import SetSpeciesCatkin
|
||||
from commands.encounter_cmdset import SetSpeciesDogkin
|
||||
|
||||
from commands.custom_cmdset import SetSpeciesHuman
|
||||
from commands.custom_cmdset import SetSpeciesCatkin
|
||||
from commands.custom_cmdset import SetSpeciesDogkin
|
||||
|
||||
SPECIES_LIST = [
|
||||
"Human",
|
||||
"Catkin",
|
||||
"Dogkin"
|
||||
]
|
||||
|
||||
SPECIES_CMDSET = [
|
||||
SetSpeciesHuman,
|
||||
SetSpeciesCatkin,
|
||||
SetSpeciesDogkin
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue