mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Have is_ooc lockfunc return True if no session found. Resolve #3129
This commit is contained in:
parent
596a081a64
commit
7777ff71cc
2 changed files with 9 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- Feature: Add support for saving `deque` with `maxlen` to Attributes (before
|
||||
`maxlen` was ignored).
|
||||
- Fix: More unit tests for scripts (Storsorken)
|
||||
|
||||
## Evennia 1.2.1
|
||||
|
||||
|
|
|
|||
|
|
@ -511,7 +511,8 @@ def is_ooc(accessing_obj, accessed_obj, *args, **kwargs):
|
|||
is_ooc()
|
||||
|
||||
This is normally used to lock a Command, so it can be used
|
||||
only when out of character.
|
||||
only when out of character. When not logged in at all, this
|
||||
function will still return True.
|
||||
"""
|
||||
obj = accessed_obj.obj if hasattr(accessed_obj, "obj") else accessed_obj
|
||||
account = obj.account if hasattr(obj, "account") else obj
|
||||
|
|
@ -520,9 +521,14 @@ def is_ooc(accessing_obj, accessed_obj, *args, **kwargs):
|
|||
try:
|
||||
session = accessed_obj.session
|
||||
except AttributeError:
|
||||
session = account.sessions.get()[0] # note-this doesn't work well
|
||||
# note-this doesn't work well
|
||||
# for high multisession mode. We may need
|
||||
# to change to sessiondb to resolve this
|
||||
sessions = session = account.sessions.get()
|
||||
session = sessions[0] if sessions else None
|
||||
if not session:
|
||||
# this suggests we are not even logged in; treat as ooc.
|
||||
return True
|
||||
try:
|
||||
return not account.get_puppet(session)
|
||||
except TypeError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue