Merge branch 'master' into develop
This commit is contained in:
commit
1f3d8d1b96
6 changed files with 32 additions and 15 deletions
|
|
@ -1001,7 +1001,10 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
||||||
|
|
||||||
if target and not is_iter(target):
|
if target and not is_iter(target):
|
||||||
# single target - just show it
|
# single target - just show it
|
||||||
|
if hasattr(target, "return_appearance"):
|
||||||
return target.return_appearance(self)
|
return target.return_appearance(self)
|
||||||
|
else:
|
||||||
|
return "{} has no in-game appearance.".format(target)
|
||||||
else:
|
else:
|
||||||
# list of targets - make list to disconnect from db
|
# list of targets - make list to disconnect from db
|
||||||
characters = list(tar for tar in target if tar) if target else []
|
characters = list(tar for tar in target if tar) if target else []
|
||||||
|
|
|
||||||
|
|
@ -475,14 +475,14 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["blue"] -= 1
|
root_pos["blue"] -= 1
|
||||||
self.caller.msg("The root with blue flowers gets in the way and is pushed to the left.")
|
self.caller.msg("The root with blue flowers gets in the way and is pushed to the left.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs straight down - you can only move it left or right.")
|
||||||
elif color == "blue":
|
elif color == "blue":
|
||||||
if direction == "left":
|
if direction == "left":
|
||||||
root_pos[color] = max(-1, root_pos[color] - 1)
|
root_pos[color] = max(-1, root_pos[color] - 1)
|
||||||
self.caller.msg("You shift the root with small blue flowers to the left.")
|
self.caller.msg("You shift the root with small blue flowers to the left.")
|
||||||
if root_pos[color] != 0 and root_pos[color] == root_pos["red"]:
|
if root_pos[color] != 0 and root_pos[color] == root_pos["red"]:
|
||||||
root_pos["red"] += 1
|
root_pos["red"] += 1
|
||||||
self.caller.msg("The reddish root is to big to fit as well, so that one falls away to the left.")
|
self.caller.msg("The reddish root is too big to fit as well, so that one falls away to the left.")
|
||||||
elif direction == "right":
|
elif direction == "right":
|
||||||
root_pos[color] = min(1, root_pos[color] + 1)
|
root_pos[color] = min(1, root_pos[color] + 1)
|
||||||
self.caller.msg("You shove the root adorned with small blue flowers to the right.")
|
self.caller.msg("You shove the root adorned with small blue flowers to the right.")
|
||||||
|
|
@ -490,7 +490,7 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["red"] -= 1
|
root_pos["red"] -= 1
|
||||||
self.caller.msg("The thick reddish root gets in the way and is pushed back to the left.")
|
self.caller.msg("The thick reddish root gets in the way and is pushed back to the left.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs straight down - you can only move it left or right.")
|
||||||
|
|
||||||
# now the horizontal roots (yellow/green). They can be moved up/down
|
# now the horizontal roots (yellow/green). They can be moved up/down
|
||||||
elif color == "yellow":
|
elif color == "yellow":
|
||||||
|
|
@ -507,7 +507,7 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["green"] -= 1
|
root_pos["green"] -= 1
|
||||||
self.caller.msg("The weedy green root is shifted upwards to make room.")
|
self.caller.msg("The weedy green root is shifted upwards to make room.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs across the wall - you can only move it up or down.")
|
||||||
elif color == "green":
|
elif color == "green":
|
||||||
if direction == "up":
|
if direction == "up":
|
||||||
root_pos[color] = max(-1, root_pos[color] - 1)
|
root_pos[color] = max(-1, root_pos[color] - 1)
|
||||||
|
|
@ -522,7 +522,7 @@ class CmdShiftRoot(Command):
|
||||||
root_pos["yellow"] -= 1
|
root_pos["yellow"] -= 1
|
||||||
self.caller.msg("The root with yellow flowers gets in the way and is pushed upwards.")
|
self.caller.msg("The root with yellow flowers gets in the way and is pushed upwards.")
|
||||||
else:
|
else:
|
||||||
self.caller.msg("You cannot move the root in that direction.")
|
self.caller.msg("The root hangs across the wall - you can only move it up or down.")
|
||||||
|
|
||||||
# we have moved the root. Store new position
|
# we have moved the root. Store new position
|
||||||
self.obj.db.root_pos = root_pos
|
self.obj.db.root_pos = root_pos
|
||||||
|
|
|
||||||
|
|
@ -747,9 +747,16 @@ class CmdLookDark(Command):
|
||||||
"""
|
"""
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
|
|
||||||
if random.random() < 0.75:
|
# count how many searches we've done
|
||||||
|
nr_searches = caller.ndb.dark_searches
|
||||||
|
if nr_searches is None:
|
||||||
|
nr_searches = 0
|
||||||
|
caller.ndb.dark_searches = nr_searches
|
||||||
|
|
||||||
|
if nr_searches < 4 and random.random() < 0.90:
|
||||||
# we don't find anything
|
# we don't find anything
|
||||||
caller.msg(random.choice(DARK_MESSAGES))
|
caller.msg(random.choice(DARK_MESSAGES))
|
||||||
|
caller.ndb.dark_searches += 1
|
||||||
else:
|
else:
|
||||||
# we could have found something!
|
# we could have found something!
|
||||||
if any(obj for obj in caller.contents if utils.inherits_from(obj, LightSource)):
|
if any(obj for obj in caller.contents if utils.inherits_from(obj, LightSource)):
|
||||||
|
|
@ -791,7 +798,8 @@ class CmdDarkNoMatch(Command):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"""Implements the command."""
|
"""Implements the command."""
|
||||||
self.caller.msg("Until you find some light, there's not much you can do. Try feeling around.")
|
self.caller.msg("Until you find some light, there's not much you can do. "
|
||||||
|
"Try feeling around, maybe you'll find something helpful!")
|
||||||
|
|
||||||
|
|
||||||
class DarkCmdSet(CmdSet):
|
class DarkCmdSet(CmdSet):
|
||||||
|
|
@ -814,7 +822,9 @@ class DarkCmdSet(CmdSet):
|
||||||
self.add(CmdLookDark())
|
self.add(CmdLookDark())
|
||||||
self.add(CmdDarkHelp())
|
self.add(CmdDarkHelp())
|
||||||
self.add(CmdDarkNoMatch())
|
self.add(CmdDarkNoMatch())
|
||||||
self.add(default_cmds.CmdSay)
|
self.add(default_cmds.CmdSay())
|
||||||
|
self.add(default_cmds.CmdQuit())
|
||||||
|
self.add(default_cmds.CmdHome())
|
||||||
|
|
||||||
|
|
||||||
class DarkRoom(TutorialRoom):
|
class DarkRoom(TutorialRoom):
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ for mod in settings.PROTOTYPE_MODULES:
|
||||||
# internally we store as (key, desc, locks, tags, prototype_dict)
|
# internally we store as (key, desc, locks, tags, prototype_dict)
|
||||||
prots = []
|
prots = []
|
||||||
for variable_name, prot in all_from_module(mod).items():
|
for variable_name, prot in all_from_module(mod).items():
|
||||||
|
if isinstance(prot, dict):
|
||||||
if "prototype_key" not in prot:
|
if "prototype_key" not in prot:
|
||||||
prot['prototype_key'] = variable_name.lower()
|
prot['prototype_key'] = variable_name.lower()
|
||||||
prots.append((prot['prototype_key'], homogenize_prototype(prot)))
|
prots.append((prot['prototype_key'], homogenize_prototype(prot)))
|
||||||
|
|
|
||||||
|
|
@ -716,7 +716,7 @@ def spawn(*prototypes, **kwargs):
|
||||||
val = prot.pop("tags", [])
|
val = prot.pop("tags", [])
|
||||||
tags = []
|
tags = []
|
||||||
for (tag, category, data) in val:
|
for (tag, category, data) in val:
|
||||||
tags.append((init_spawn_value(val, str), category, data))
|
tags.append((init_spawn_value(tag, str), category, data))
|
||||||
|
|
||||||
prototype_key = prototype.get('prototype_key', None)
|
prototype_key = prototype.get('prototype_key', None)
|
||||||
if prototype_key:
|
if prototype_key:
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,7 @@ class ServerSession(Session):
|
||||||
else:
|
else:
|
||||||
self.data_out(**kwargs)
|
self.data_out(**kwargs)
|
||||||
|
|
||||||
def execute_cmd(self, raw_string, **kwargs):
|
def execute_cmd(self, raw_string, session=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Do something as this object. This method is normally never
|
Do something as this object. This method is normally never
|
||||||
called directly, instead incoming command instructions are
|
called directly, instead incoming command instructions are
|
||||||
|
|
@ -417,6 +417,9 @@ class ServerSession(Session):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
raw_string (string): Raw command input
|
raw_string (string): Raw command input
|
||||||
|
session (Session): This is here to make API consistent with
|
||||||
|
Account/Object.execute_cmd. If given, data is passed to
|
||||||
|
that Session, otherwise use self.
|
||||||
Kwargs:
|
Kwargs:
|
||||||
Other keyword arguments will be added to the found command
|
Other keyword arguments will be added to the found command
|
||||||
object instace as variables before it executes. This is
|
object instace as variables before it executes. This is
|
||||||
|
|
@ -426,7 +429,7 @@ class ServerSession(Session):
|
||||||
"""
|
"""
|
||||||
# inject instruction into input stream
|
# inject instruction into input stream
|
||||||
kwargs["text"] = ((raw_string,), {})
|
kwargs["text"] = ((raw_string,), {})
|
||||||
self.sessionhandler.data_in(self, **kwargs)
|
self.sessionhandler.data_in(session or self, **kwargs)
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
"""Handle session comparisons"""
|
"""Handle session comparisons"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue