mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Red button commands lacked proper locks, causing non-privileged chars to not have access. Fixed.
This commit is contained in:
parent
a3e4e44a61
commit
f950cd8b94
3 changed files with 14 additions and 7 deletions
|
|
@ -30,6 +30,7 @@ class CmdNudge(Command):
|
|||
|
||||
key = "nudge lid" # two-word command name!
|
||||
aliases = ["nudge"]
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"""
|
||||
|
|
@ -54,6 +55,7 @@ class CmdPush(Command):
|
|||
"""
|
||||
key = "push button"
|
||||
aliases = ["push", "press button", "press"]
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"""
|
||||
|
|
@ -94,6 +96,7 @@ class CmdSmashGlass(Command):
|
|||
|
||||
key = "smash glass"
|
||||
aliases = ["smash lid", "break lid", "smash"]
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"""
|
||||
|
|
@ -129,6 +132,7 @@ class CmdOpenLid(Command):
|
|||
|
||||
key = "open lid"
|
||||
aliases = ["open button", 'open']
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"simply call the right function."
|
||||
|
|
@ -159,6 +163,7 @@ class CmdCloseLid(Command):
|
|||
|
||||
key = "close lid"
|
||||
aliases = ["close"]
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"Close the lid"
|
||||
|
|
@ -183,6 +188,8 @@ class CmdBlindLook(Command):
|
|||
|
||||
key = "look"
|
||||
aliases = ["l", "get", "examine", "ex", "feel", "listen"]
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"This replaces all the senses when blinded."
|
||||
|
||||
|
|
@ -215,6 +222,8 @@ class CmdBlindHelp(Command):
|
|||
"""
|
||||
key = "help"
|
||||
aliases = "h"
|
||||
locks = "cmd:all()"
|
||||
|
||||
def func(self):
|
||||
"Give a message."
|
||||
self.caller.msg("You are beyond help ... until you can see again.")
|
||||
|
|
|
|||
|
|
@ -119,13 +119,14 @@ def get_and_merge_cmdsets(caller):
|
|||
try:
|
||||
player_cmdset = caller.player.cmdset.current
|
||||
except AttributeError:
|
||||
player_cmdset = None
|
||||
player_cmdset = None
|
||||
|
||||
cmdsets = [caller_cmdset] + [player_cmdset] + [channel_cmdset] + local_objects_cmdsets
|
||||
# weed out all non-found sets
|
||||
cmdsets = [cmdset for cmdset in cmdsets if cmdset]
|
||||
# sort cmdsets after reverse priority (highest prio are merged in last)
|
||||
cmdsets = sorted(cmdsets, key=lambda x: x.priority)
|
||||
|
||||
if cmdsets:
|
||||
# Merge all command sets into one, beginning with the lowest-prio one
|
||||
cmdset = cmdsets.pop(0)
|
||||
|
|
@ -135,7 +136,7 @@ def get_and_merge_cmdsets(caller):
|
|||
cmdset = merging_cmdset + cmdset
|
||||
else:
|
||||
cmdset = None
|
||||
|
||||
|
||||
for cset in (cset for cset in local_objects_cmdsets if cset):
|
||||
cset.duplicates = cset.old_duplicates
|
||||
|
||||
|
|
@ -157,8 +158,8 @@ def cmdhandler(caller, raw_string, testing=False):
|
|||
try: # catch special-type commands
|
||||
|
||||
cmdset = get_and_merge_cmdsets(caller)
|
||||
|
||||
#print cmdset
|
||||
|
||||
# print cmdset
|
||||
if not cmdset:
|
||||
# this is bad and shouldn't happen.
|
||||
raise NoCmdSets
|
||||
|
|
@ -169,12 +170,10 @@ def cmdhandler(caller, raw_string, testing=False):
|
|||
syscmd = cmdset.get(CMD_NOINPUT)
|
||||
sysarg = ""
|
||||
raise ExecSystemCommand(syscmd, sysarg)
|
||||
|
||||
# Parse the input string and match to available cmdset.
|
||||
# This also checks for permissions, so all commands in match
|
||||
# are commands the caller is allowed to call.
|
||||
matches = COMMAND_PARSER(raw_string, cmdset, caller)
|
||||
|
||||
# Deal with matches
|
||||
if not matches:
|
||||
# No commands match our entered command
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ def cmdparser(raw_string, cmdset, caller, match_index=None):
|
|||
matches.extend([create_match(cmdname, raw_string, cmd)
|
||||
for cmdname in [cmd.key] + cmd.aliases
|
||||
if cmdname and l_raw_string.startswith(cmdname.lower())])
|
||||
|
||||
if not matches:
|
||||
# no matches found.
|
||||
if '-' in raw_string:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue