Red button commands lacked proper locks, causing non-privileged chars to not have access. Fixed.

This commit is contained in:
Griatch 2011-11-09 09:53:57 +01:00
parent a3e4e44a61
commit f950cd8b94
3 changed files with 14 additions and 7 deletions

View file

@ -30,6 +30,7 @@ class CmdNudge(Command):
key = "nudge lid" # two-word command name! key = "nudge lid" # two-word command name!
aliases = ["nudge"] aliases = ["nudge"]
locks = "cmd:all()"
def func(self): def func(self):
""" """
@ -54,6 +55,7 @@ class CmdPush(Command):
""" """
key = "push button" key = "push button"
aliases = ["push", "press button", "press"] aliases = ["push", "press button", "press"]
locks = "cmd:all()"
def func(self): def func(self):
""" """
@ -94,6 +96,7 @@ class CmdSmashGlass(Command):
key = "smash glass" key = "smash glass"
aliases = ["smash lid", "break lid", "smash"] aliases = ["smash lid", "break lid", "smash"]
locks = "cmd:all()"
def func(self): def func(self):
""" """
@ -129,6 +132,7 @@ class CmdOpenLid(Command):
key = "open lid" key = "open lid"
aliases = ["open button", 'open'] aliases = ["open button", 'open']
locks = "cmd:all()"
def func(self): def func(self):
"simply call the right function." "simply call the right function."
@ -159,6 +163,7 @@ class CmdCloseLid(Command):
key = "close lid" key = "close lid"
aliases = ["close"] aliases = ["close"]
locks = "cmd:all()"
def func(self): def func(self):
"Close the lid" "Close the lid"
@ -183,6 +188,8 @@ class CmdBlindLook(Command):
key = "look" key = "look"
aliases = ["l", "get", "examine", "ex", "feel", "listen"] aliases = ["l", "get", "examine", "ex", "feel", "listen"]
locks = "cmd:all()"
def func(self): def func(self):
"This replaces all the senses when blinded." "This replaces all the senses when blinded."
@ -215,6 +222,8 @@ class CmdBlindHelp(Command):
""" """
key = "help" key = "help"
aliases = "h" aliases = "h"
locks = "cmd:all()"
def func(self): def func(self):
"Give a message." "Give a message."
self.caller.msg("You are beyond help ... until you can see again.") self.caller.msg("You are beyond help ... until you can see again.")

View file

@ -126,6 +126,7 @@ def get_and_merge_cmdsets(caller):
cmdsets = [cmdset for cmdset in cmdsets if cmdset] cmdsets = [cmdset for cmdset in cmdsets if cmdset]
# sort cmdsets after reverse priority (highest prio are merged in last) # sort cmdsets after reverse priority (highest prio are merged in last)
cmdsets = sorted(cmdsets, key=lambda x: x.priority) cmdsets = sorted(cmdsets, key=lambda x: x.priority)
if cmdsets: if cmdsets:
# Merge all command sets into one, beginning with the lowest-prio one # Merge all command sets into one, beginning with the lowest-prio one
cmdset = cmdsets.pop(0) cmdset = cmdsets.pop(0)
@ -158,7 +159,7 @@ def cmdhandler(caller, raw_string, testing=False):
cmdset = get_and_merge_cmdsets(caller) cmdset = get_and_merge_cmdsets(caller)
#print cmdset # print cmdset
if not cmdset: if not cmdset:
# this is bad and shouldn't happen. # this is bad and shouldn't happen.
raise NoCmdSets raise NoCmdSets
@ -169,12 +170,10 @@ def cmdhandler(caller, raw_string, testing=False):
syscmd = cmdset.get(CMD_NOINPUT) syscmd = cmdset.get(CMD_NOINPUT)
sysarg = "" sysarg = ""
raise ExecSystemCommand(syscmd, sysarg) raise ExecSystemCommand(syscmd, sysarg)
# Parse the input string and match to available cmdset. # Parse the input string and match to available cmdset.
# This also checks for permissions, so all commands in match # This also checks for permissions, so all commands in match
# are commands the caller is allowed to call. # are commands the caller is allowed to call.
matches = COMMAND_PARSER(raw_string, cmdset, caller) matches = COMMAND_PARSER(raw_string, cmdset, caller)
# Deal with matches # Deal with matches
if not matches: if not matches:
# No commands match our entered command # No commands match our entered command

View file

@ -49,7 +49,6 @@ def cmdparser(raw_string, cmdset, caller, match_index=None):
matches.extend([create_match(cmdname, raw_string, cmd) matches.extend([create_match(cmdname, raw_string, cmd)
for cmdname in [cmd.key] + cmd.aliases for cmdname in [cmd.key] + cmd.aliases
if cmdname and l_raw_string.startswith(cmdname.lower())]) if cmdname and l_raw_string.startswith(cmdname.lower())])
if not matches: if not matches:
# no matches found. # no matches found.
if '-' in raw_string: if '-' in raw_string: