From d8601def73e4f95cc68e0a01507c5d3c90d72d39 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Fri, 16 Jun 2023 15:51:48 +0100 Subject: [PATCH] Bug fixes and callbacks * Added parcel callback support for the outfit store * Added execute_callback wrapper function * Fixed ball quest item never unlocking after receiving the outfit, soft-locking the game --- game/scripts/shops/dress/chitchats.rpy | 2 ++ game/scripts/shops/dress/menu.rpy | 8 ++++++-- game/scripts/utility/common_functions.rpy | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/game/scripts/shops/dress/chitchats.rpy b/game/scripts/shops/dress/chitchats.rpy index f10f901d..5280e2bb 100644 --- a/game/scripts/shops/dress/chitchats.rpy +++ b/game/scripts/shops/dress/chitchats.rpy @@ -34,6 +34,8 @@ label purchase_outfit(item): maf "As you wish sweetie... It should be ready shortly." gen "Thank you." ("base", xpos="far_left", ypos="head") elif item == her_outfit_ball: + $ parcel_callbacks.append(renpy.curry(setattr)(ball_outfit_ITEM, "owned", 1)) + if not states.her.ev.yule_ball.e4_complete: gen "Could you make a dress for me?" ("base", xpos="far_left", ypos="head") maf "A dress? Do you mean something like a ball dress, or more burlesque?" diff --git a/game/scripts/shops/dress/menu.rpy b/game/scripts/shops/dress/menu.rpy index dd23c6c0..57744404 100644 --- a/game/scripts/shops/dress/menu.rpy +++ b/game/scripts/shops/dress/menu.rpy @@ -27,6 +27,7 @@ label shop_dress_menu: store_cart = set() menu_items = shop_dress_sortfilter([x for x in category_items.get(current_category, []) if bool(x.unlocked == False and x.price > 0 and not x in store_cart)], current_sorting) current_item = next(iter(menu_items), None) + parcel_callbacks = [] show screen shop_dress() @@ -107,14 +108,17 @@ label shop_dress_menu: $ _tmp = "tomorrow" if transit_time == 1 else "in about {} days".format(str(transit_time)) maf "You can expect a parcel [_tmp]." - $ Parcel(contents=[(k, 1) for k in store_cart], wait=transit_time).send() + # Executes callbacks upon receival of the parcel. + $ curry = renpy.curry(execute_callbacks)(parcel_callbacks) if parcel_callbacks else None + $ parcel_callbacks = [] + $ Parcel(contents=[(k, 1) for k in store_cart], wait=transit_time, func=curry).send() + return else: gen "Nothing has caught my eye I'm afraid." ("base", xpos="far_left", ypos="head") maf "Maybe next time." return - jump .after_init screen shop_dress(): diff --git a/game/scripts/utility/common_functions.rpy b/game/scripts/utility/common_functions.rpy index 7a38a189..0243d286 100644 --- a/game/scripts/utility/common_functions.rpy +++ b/game/scripts/utility/common_functions.rpy @@ -222,3 +222,6 @@ init python early: def __len__(self): return len(self._callable()) + + def execute_callbacks(callbacks): + [callback() for callback in callbacks] \ No newline at end of file