Advertisement
Kovitikus

default command set

Aug 30th, 2020
1,723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.64 KB | None | 0 0
  1. """
  2. Command sets
  3.  
  4. All commands in the game must be grouped in a cmdset.  A given command
  5. can be part of any number of cmdsets and cmdsets can be added/removed
  6. and merged onto entities at runtime.
  7.  
  8. To create new commands to populate the cmdset, see
  9. `commands/command.py`.
  10.  
  11. This module wraps the default command sets of Evennia; overloads them
  12. to add/remove commands from the default lineup. You can create your
  13. own cmdsets by inheriting from them or directly from `evennia.CmdSet`.
  14.  
  15. """
  16.  
  17. from evennia import default_cmds
  18. from commands import command
  19. from commands import combat_cmds
  20.  
  21.  
  22.  
  23. class CharacterCmdSet(default_cmds.CharacterCmdSet):
  24.     """
  25.    The `CharacterCmdSet` contains general in-game commands like `look`,
  26.    `get`, etc available on in-game Character objects. It is merged with
  27.    the `AccountCmdSet` when an Account puppets a Character.
  28.    """
  29.     key = "DefaultCharacter"
  30.  
  31.     def at_cmdset_creation(self):
  32.         """
  33.        Populates the cmdset
  34.        """
  35.         super().at_cmdset_creation()
  36.         #
  37.         # any commands you add below will overload the default ones.
  38.         #
  39.         self.add(command.CmdDesc())
  40.         self.add(command.CmdCharGen())
  41.         self.add(command.CmdLearnSkill())
  42.         self.add(command.CmdGrantSP())
  43.         self.add(command.CmdTest())
  44.         self.add(command.CmdLook())
  45.         self.add(command.CmdInventory())
  46.         self.add(command.CmdGet())
  47.         self.add(command.CmdInhand())
  48.         self.add(command.CmdStand())
  49.         self.add(command.CmdKneel())
  50.         self.add(command.CmdSit())
  51.         self.add(command.CmdLie())
  52.         self.add(command.CmdDrop())
  53.         self.add(command.CmdStow())
  54.         self.add(command.CmdWield())
  55.         self.add(command.CmdUnwield())
  56.         self.add(combat_cmds.Approach())
  57.         self.add(combat_cmds.Retreat())
  58.         self.add(combat_cmds.CmdStaveSwat())
  59.         self.add(combat_cmds.CmdHeal())
  60.         self.add(command.CmdTakeFrom())
  61.         self.add(command.CmdPut())
  62.         self.add(command.CmdSkills())
  63.  
  64. class AccountCmdSet(default_cmds.AccountCmdSet):
  65.     """
  66.    This is the cmdset available to the Account at all times. It is
  67.    combined with the `CharacterCmdSet` when the Account puppets a
  68.    Character. It holds game-account-specific commands, channel
  69.    commands, etc.
  70.    """
  71.     key = "DefaultAccount"
  72.  
  73.     def at_cmdset_creation(self):
  74.         """
  75.        Populates the cmdset
  76.        """
  77.         super().at_cmdset_creation()
  78.         #
  79.         # any commands you add below will overload the default ones.
  80.         #
  81.  
  82.  
  83. class UnloggedinCmdSet(default_cmds.UnloggedinCmdSet):
  84.     """
  85.    Command set available to the Session before being logged in.  This
  86.    holds commands like creating a new account, logging in, etc.
  87.    """
  88.     key = "DefaultUnloggedin"
  89.  
  90.     def at_cmdset_creation(self):
  91.         """
  92.        Populates the cmdset
  93.        """
  94.         super().at_cmdset_creation()
  95.         #
  96.         # any commands you add below will overload the default ones.
  97.         #
  98.  
  99.  
  100. class SessionCmdSet(default_cmds.SessionCmdSet):
  101.     """
  102.    This cmdset is made available on Session level once logged in. It
  103.    is empty by default.
  104.    """
  105.     key = "DefaultSession"
  106.  
  107.     def at_cmdset_creation(self):
  108.         """
  109.        This is the only method defined in a cmdset, called during
  110.        its creation. It should populate the set with command instances.
  111.  
  112.        As and example we just add the empty base `Command` object.
  113.        It prints some info.
  114.        """
  115.         super().at_cmdset_creation()
  116.         #
  117.         # any commands you add below will overload the default ones.
  118.         #
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement