mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
alter_cache helper method on buffs
This commit is contained in:
parent
6d3fdc512f
commit
dce7fc8b1c
1 changed files with 10 additions and 0 deletions
|
|
@ -232,8 +232,18 @@ class BaseBuff:
|
|||
|
||||
def reset(self):
|
||||
"""Resets the buff start time as though it were just applied; functionally identical to a refresh"""
|
||||
self.start = time.time()
|
||||
self.handler.buffcache[self.buffkey]["start"] = time.time()
|
||||
|
||||
def alter_cache(self, to_cache: dict = None):
|
||||
"""Alters this buff's cache, both internally (this instance) and on the handler's buff cache."""
|
||||
if not isinstance(to_cache, dict):
|
||||
raise TypeError
|
||||
_cache = dict(self.handler.buffcache[self.buffkey])
|
||||
_cache.update(to_cache)
|
||||
self.cache = _cache
|
||||
self.handler.buffcache[self.buffkey] = _cache
|
||||
|
||||
# endregion
|
||||
|
||||
# region hook methods
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue