From e92b0c4113fcdf81c51cb0c1d101a161d33b601c Mon Sep 17 00:00:00 2001 From: 0x_hazel <0x.voidweaver@gmail.com> Date: Sat, 13 Jan 2024 15:46:36 +0800 Subject: [PATCH] basic unremovable clothing items --- commands/clothing.py | 22 ++++++++++++++++++++++ commands/default_cmdsets.py | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 commands/clothing.py diff --git a/commands/clothing.py b/commands/clothing.py new file mode 100644 index 0000000..e606332 --- /dev/null +++ b/commands/clothing.py @@ -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) diff --git a/commands/default_cmdsets.py b/commands/default_cmdsets.py index 18e442f..9dd8897 100644 --- a/commands/default_cmdsets.py +++ b/commands/default_cmdsets.py @@ -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):