mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
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):
|
||||
# single target - just show it
|
||||
return target.return_appearance(self)
|
||||
if hasattr(target, "return_appearance"):
|
||||
return target.return_appearance(self)
|
||||
else:
|
||||
return "{} has no in-game appearance.".format(target)
|
||||
else:
|
||||
# list of targets - make list to disconnect from db
|
||||
characters = list(tar for tar in target if tar) if target else []
|
||||
|
|
|
|||
|
|
@ -475,14 +475,14 @@ class CmdShiftRoot(Command):
|
|||
root_pos["blue"] -= 1
|
||||
self.caller.msg("The root with blue flowers gets in the way and is pushed to the left.")
|
||||
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":
|
||||
if direction == "left":
|
||||
root_pos[color] = max(-1, root_pos[color] - 1)
|
||||
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"]:
|
||||
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":
|
||||
root_pos[color] = min(1, root_pos[color] + 1)
|
||||
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
|
||||
self.caller.msg("The thick reddish root gets in the way and is pushed back to the left.")
|
||||
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
|
||||
elif color == "yellow":
|
||||
|
|
@ -507,7 +507,7 @@ class CmdShiftRoot(Command):
|
|||
root_pos["green"] -= 1
|
||||
self.caller.msg("The weedy green root is shifted upwards to make room.")
|
||||
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":
|
||||
if direction == "up":
|
||||
root_pos[color] = max(-1, root_pos[color] - 1)
|
||||
|
|
@ -522,7 +522,7 @@ class CmdShiftRoot(Command):
|
|||
root_pos["yellow"] -= 1
|
||||
self.caller.msg("The root with yellow flowers gets in the way and is pushed upwards.")
|
||||
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
|
||||
self.obj.db.root_pos = root_pos
|
||||
|
|
|
|||
|
|
@ -747,9 +747,16 @@ class CmdLookDark(Command):
|
|||
"""
|
||||
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
|
||||
caller.msg(random.choice(DARK_MESSAGES))
|
||||
caller.ndb.dark_searches += 1
|
||||
else:
|
||||
# we could have found something!
|
||||
if any(obj for obj in caller.contents if utils.inherits_from(obj, LightSource)):
|
||||
|
|
@ -791,7 +798,8 @@ class CmdDarkNoMatch(Command):
|
|||
|
||||
def func(self):
|
||||
"""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):
|
||||
|
|
@ -814,7 +822,9 @@ class DarkCmdSet(CmdSet):
|
|||
self.add(CmdLookDark())
|
||||
self.add(CmdDarkHelp())
|
||||
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):
|
||||
|
|
|
|||
|
|
@ -107,9 +107,10 @@ for mod in settings.PROTOTYPE_MODULES:
|
|||
# internally we store as (key, desc, locks, tags, prototype_dict)
|
||||
prots = []
|
||||
for variable_name, prot in all_from_module(mod).items():
|
||||
if "prototype_key" not in prot:
|
||||
prot['prototype_key'] = variable_name.lower()
|
||||
prots.append((prot['prototype_key'], homogenize_prototype(prot)))
|
||||
if isinstance(prot, dict):
|
||||
if "prototype_key" not in prot:
|
||||
prot['prototype_key'] = variable_name.lower()
|
||||
prots.append((prot['prototype_key'], homogenize_prototype(prot)))
|
||||
# assign module path to each prototype_key for easy reference
|
||||
_MODULE_PROTOTYPE_MODULES.update({prototype_key.lower(): mod for prototype_key, _ in prots})
|
||||
# make sure the prototype contains all meta info
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ def spawn(*prototypes, **kwargs):
|
|||
val = prot.pop("tags", [])
|
||||
tags = []
|
||||
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)
|
||||
if prototype_key:
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ class ServerSession(Session):
|
|||
else:
|
||||
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
|
||||
called directly, instead incoming command instructions are
|
||||
|
|
@ -417,6 +417,9 @@ class ServerSession(Session):
|
|||
|
||||
Args:
|
||||
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:
|
||||
Other keyword arguments will be added to the found command
|
||||
object instace as variables before it executes. This is
|
||||
|
|
@ -426,7 +429,7 @@ class ServerSession(Session):
|
|||
"""
|
||||
# inject instruction into input stream
|
||||
kwargs["text"] = ((raw_string,), {})
|
||||
self.sessionhandler.data_in(self, **kwargs)
|
||||
self.sessionhandler.data_in(session or self, **kwargs)
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Handle session comparisons"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue