Compare commits

..

3 Commits

Author SHA1 Message Date
f8130fdb4d Fix test call
it raised an exception in my case, and I'm fairly sure this is how it's supposed to work
also adds a complimentary hidden reset at the end
2023-11-15 03:18:07 +01:00
9b96c5572c Remove now-unused reset_variables relying on implem details
It is used in a txt draft which I didn't change, it can be done if deemed necessary
I think this function should be kept off, as it is both more dangerous and slower than the workarounds
2023-11-15 03:16:00 +01:00
757a39d782 Avoid using reset_variables 2023-11-15 03:13:55 +01:00
3 changed files with 13 additions and 24 deletions

View File

@ -1,7 +1,6 @@
# Quidditch stands
default quidditch_stands = {
define __quidditch_stands = {
"weather": "sun_high",
"rain": False,
"puddles": False,
@ -11,6 +10,7 @@ default quidditch_stands = {
"hole": False,
"tree_fire": False
}
default quidditch_stands = __quidditch_stands.copy()
# Crowd density presets
define crowd_few = ("low_1")
@ -55,8 +55,9 @@ label quidditch_stands(hidden=False, reset=False, **kwargs):
# Update and show the area.
# Pass `hidden=True` to update only, `reset=True` to reset the area before applying arguments.
if reset:
$ reset_variables("quidditch_stands")
$ quidditch_stands.update(kwargs)
$ quidditch_stands = __quidditch_stands | kwargs
else:
$ quidditch_stands.update(kwargs)
if not hidden:
show screen quidditch_stands_back(**quidditch_stands)
show screen quidditch_stands_mid(**quidditch_stands)
@ -158,6 +159,7 @@ label test_stands:
pause 1.5
call quidditch_stands(hole=True)
pause 1
call quidditch_stands(weather="overcast", crowd=["bj"])
call quidditch_stands(weather="overcast", crowd_bj=True)
pause 1
call quidditch_stands(reset=True, hidden=True)
jump test_stands

View File

@ -1,16 +1,17 @@
# Quidditch stands
default quidditch_stands2 = {
define __quidditch_stands2 = {
"weather": "sun_high",
"crowd": (),
"crowd_react": (None, None, None),
}
default quidditch_stands2 = __quidditch_stands2.copy()
label quidditch_stands2(hidden=False, reset=False, **kwargs):
if reset:
$ reset_variables("quidditch_stands2")
$ quidditch_stands2.update(kwargs)
$ quidditch_stands2 = __quidditch_stands2 | kwargs
else:
$ quidditch_stands2.update(kwargs)
if not hidden:
show screen quidditch_stands_back2(**quidditch_stands2)
show screen quidditch_stands_front2(**quidditch_stands2)

View File

@ -101,20 +101,6 @@ init python early:
print("Error evaluating data:")
print(e)
def reset_variables(*args):
"""Resets the given variables to their default values."""
# Refer to renpy.ast.Default.set_default for implementation details
defaults_set = renpy.store._defaults_set
changed_set = renpy.store.__dict__.ever_been_changed
for arg in args:
if arg in defaults_set:
if arg in changed_set:
defaults_set.remove(arg)
changed_set.remove(arg)
elif config.developer:
raise Exception("The variable `{}` was not previously set with a default value.".format(arg))
renpy.execute_default_statement(False)
def disable_game_menu():
setattr(renpy.store, "_game_menu_screen", None)