Compare commits
5 Commits
68cd345d75
...
c013b7d800
Author | SHA1 | Date |
---|---|---|
Hazel Nova | c013b7d800 | |
Hazel Nova | df7eb9f31f | |
Hazel Nova | 886b3bc21e | |
Hazel Nova | e92b0c4113 | |
Hazel Nova | 863f140d15 |
|
@ -0,0 +1,22 @@
|
|||
from commands.command import Command
|
||||
from evennia import CmdSet
|
||||
|
||||
class CmdRemove(Command):
|
||||
key = "remove"
|
||||
help_category = "clothing"
|
||||
|
||||
def func(self):
|
||||
clothing = self.caller.search(self.args, candidates=self.caller.contents)
|
||||
if not clothing:
|
||||
self.caller.msg("You don't have anything like that.")
|
||||
return
|
||||
if not clothing.db.worn:
|
||||
self.caller.msg("You're not wearing that!")
|
||||
return
|
||||
if covered := clothing.db.covered_by:
|
||||
self.caller.msg(f"You have to take off {covered} first.")
|
||||
return
|
||||
if not clothing.access(self.caller, 'remove'):
|
||||
self.caller.msg(clothing.db.remove_err_msg or f"You are unable to remove that.")
|
||||
return
|
||||
clothing.remove(self.caller)
|
|
@ -19,6 +19,7 @@ from evennia.contrib.game_systems.containers import ContainerCmdSet
|
|||
from evennia import default_cmds
|
||||
|
||||
from .encounter_cmdset import CmdEngage
|
||||
from .clothing import CmdRemove
|
||||
|
||||
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||
"""
|
||||
|
@ -37,6 +38,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
self.add(CmdEngage)
|
||||
self.add(ClothedCharacterCmdSet)
|
||||
self.add(ContainerCmdSet)
|
||||
self.add(CmdRemove)
|
||||
|
||||
|
||||
class AccountCmdSet(default_cmds.AccountCmdSet):
|
||||
|
|
|
@ -2,6 +2,9 @@ from commands.command import Command
|
|||
from evennia import create_script
|
||||
from evennia import CmdSet
|
||||
|
||||
from evennia.utils import inherits_from
|
||||
import typeclasses.characters
|
||||
|
||||
class EncounterCommand(Command):
|
||||
energy_cost = 1
|
||||
allow_self_target = False
|
||||
|
@ -185,6 +188,9 @@ class CmdEngage(Command):
|
|||
target = self.caller.search(self.args)
|
||||
if not target:
|
||||
return
|
||||
if not inherits_from(target, typeclasses.characters.Character) or not target.access(self.caller, 'engage'):
|
||||
self.caller.msg(target.db.engage_err_msg or f"You can't initiate an encounter with {target.name}.")
|
||||
return
|
||||
if target == self.caller:
|
||||
self.caller.msg("You can't initiate an encounter with yourself!")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue