Refactor and bug fix

* Fixed Gold displayable restarting every interaction
* Removed unused class
This commit is contained in:
LoafyLemon 2023-03-29 23:59:03 +01:00
parent 99b15859c0
commit d4472d9a1f
2 changed files with 3 additions and 39 deletions

View File

@ -216,41 +216,3 @@ init python:
# Change tier and reset progress
self._points = 0
self._tier = relative_tier
class stats_class(dict):
def __delitem__(self, key):
"""Override delitem method to delete inner dictionary key."""
del self[key]
def __missing__(self, key):
"""Return zero if key does not exist in the inner dictionary."""
return 0
def __setattr__(self, name, value):
"""Override setattr method to add attributes as keys and values in the inner dictionary."""
self[name] = value
def __getattr__(self, name):
"""Override getattr method to return a value of the key from the inner dictionary."""
# Skip protected attributes and/or injected Ren'py methods
if not name.startswith("_"):
return self[name]
raise AttributeError("'"+self.__class__.__name__+"' has no attribute '"+name+"'")
def status(self):
"""Print currently defined keys and values in the console."""
for key, value in self.items():
print(key + " == " + str(value))
return
def reset(self):
"""Reset all key values back to default values depending on the value type."""
for key in self.keys():
if isinstance(self[key], (float, int)):
self[key] = 0
elif isinstance(self[key], bool):
self[key] = False
else:
pass
return

View File

@ -73,6 +73,8 @@ screen gold(old, new):
tag gold
zorder 50
default d = DynamicDisplayable(show_gold, old, new)
frame:
xpadding 10
ysize 44
@ -80,7 +82,7 @@ screen gold(old, new):
background Frame(gui.format("interface/frames/{}/iconmed.webp"), 6, 6)
pos (50, 50)
add DynamicDisplayable(show_gold, old, new) yoffset 3
add d yoffset 3
timer 3.0 action Hide("gold")