mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 01:36:32 +01:00
Add is_ooc lockfunc, because why not
This commit is contained in:
parent
98c20ffa21
commit
8ea578c75f
2 changed files with 19 additions and 0 deletions
|
|
@ -158,6 +158,7 @@ Up requirements to Django 4.0+, Twisted 22+, Python 3.9 or 3.10
|
|||
- Have `type/force` default to `update`-mode rather than `reset`mode and add more verbose
|
||||
warning when using reset mode.
|
||||
- Attribute storage support defaultdics (Hendher)
|
||||
- Add `is_ooc` lockfunc (meant for limiting commands at the OOC level)
|
||||
|
||||
|
||||
## Evennia 0.9.5
|
||||
|
|
|
|||
|
|
@ -473,6 +473,24 @@ def tag(accessing_obj, accessed_obj, *args, **kwargs):
|
|||
category = args[1] if len(args) > 1 else None
|
||||
return bool(accessing_obj.tags.get(tagkey, category=category))
|
||||
|
||||
def is_ooc(accessing_obj, accessed_obj, *args, **kwargs):
|
||||
"""
|
||||
Usage:
|
||||
is_ooc()
|
||||
|
||||
This is normally used to lock a Command, so it can be used
|
||||
only when out of character.
|
||||
"""
|
||||
obj = accessed_obj.obj if hasattr(accessed_obj, "obj") else accessed_obj
|
||||
session = obj.session if hasattr(obj, "session") else obj
|
||||
try:
|
||||
return not obj.get_puppet(session)
|
||||
except AttributeError:
|
||||
try:
|
||||
return not obj.account.get_puppet(session)
|
||||
except AttributeError:
|
||||
pass
|
||||
return False
|
||||
|
||||
def objtag(accessing_obj, accessed_obj, *args, **kwargs):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue