basic unremovable clothing items

This commit is contained in:
Hazel Nova 2024-01-13 15:46:36 +08:00
parent 140d430235
commit e92b0c4113
2 changed files with 24 additions and 0 deletions

22
commands/clothing.py Normal file
View File

@ -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)

View File

@ -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):