From 110847e9e66a436d84279f41037dfb93e428f360 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Fri, 17 Nov 2023 03:38:06 +0100 Subject: [PATCH] Simplify and quicken summon list iteration --- game/scripts/interface/door.rpy | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/game/scripts/interface/door.rpy b/game/scripts/interface/door.rpy index 796ac0c0..074839d0 100644 --- a/game/scripts/interface/door.rpy +++ b/game/scripts/interface/door.rpy @@ -3,7 +3,6 @@ #################################### default summon_show_busy = True -define summon_categories_sorted = ("Snape", "Tonks", "Hermione", "Cho", "Luna", "Astoria", "Susan") #"Ginny", "Daphne", "Padma", "Patil", "Myrtle", "Mafkin" label summon: $ gui.in_context("summon_menu") @@ -71,6 +70,7 @@ label summon_menu(xx=723, yy=90): # Door dictionary summon_dict = { + # the order will be the one in the menu "Snape": {"ico": "snape", "flag": states.sna.unlocked, "busy": states.sna.busy, "loc": "randomsnape"}, "Tonks": {"ico": "tonks", "flag": states.ton.unlocked, "busy": states.ton.busy, "loc": "randomtonks"}, "Hermione": {"ico": "hermione", "flag": states.her.unlocked, "busy": states.her.busy, "loc": states.her.map_location }, @@ -78,6 +78,7 @@ label summon_menu(xx=723, yy=90): "Luna": {"ico": "luna", "flag": states.lun.unlocked, "busy": states.lun.busy, "loc": states.lun.map_location}, "Astoria": {"ico": "astoria", "flag": states.ast.unlocked, "busy": states.ast.busy, "loc": states.ast.map_location }, "Susan": {"ico": "susan", "flag": states.sus.unlocked, "busy": states.sus.busy, "loc": states.sus.map_location} + #"Ginny", "Daphne", "Padma", "Patil", "Myrtle", "Mafkin" }, ) @@ -147,9 +148,9 @@ screen summon_menu(): vbox: pos (6, 6) $ allbusy = True - for char in summon_categories_sorted: - if summon_dict[char]["flag"]: - if summon_show_busy or not summon_dict[char]["busy"]: + for char, char_dict in summon_dict.items(): + if char_dict["flag"]: + if summon_show_busy or not char_dict["busy"]: $ allbusy = False frame: style "empty" @@ -163,7 +164,7 @@ screen summon_menu(): text_xalign 0.6 text_yalign 0.5 text_xanchor 0.5 text_size 20 - if not summon_dict[char]["busy"]: + if not char_dict["busy"]: action Call("summon_menu.summon", char, from_current=True) else: text_color "#8C8C70" @@ -176,9 +177,9 @@ screen summon_menu(): background gui.format("interface/achievements/{}/iconbox.webp") foreground "interface/achievements/glass_iconbox.webp" xysize (48, 48) - add crop_image_zoom("interface/icons/head/"+summon_dict[char]["ico"]+".webp", 42, 42, summon_dict[char]["busy"]) align (0.5, 0.5) + add crop_image_zoom("interface/icons/head/"+char_dict["ico"]+".webp", 42, 42, char_dict["busy"]) align (0.5, 0.5) - text map_transcript_loc[summon_dict[char]["loc"]] size 10 xalign 0.625 yalign 0.9 xanchor 0.5 + text map_transcript_loc[char_dict["loc"]] size 10 xalign 0.625 yalign 0.9 xanchor 0.5 if not states.sna.unlocked: text "You don't know anyone" size 12 at truecenter