|
| 1 | +init -990 python in mas_submod_utils: |
| 2 | + Submod( |
| 3 | + author="multimokia", |
| 4 | + name="All Gen Scrollable Menus", |
| 5 | + description="A submod which converts all menus to gen-scrollable-menus so Monika's face is never hidden.", |
| 6 | + version="1.0.0", |
| 7 | + version_updates={} |
| 8 | + ) |
| 9 | + |
| 10 | +init 900 python: |
| 11 | + def menu_override(items, set_expr): |
| 12 | + """ |
| 13 | + For the docstring DM Tom: 152088707963289600 |
| 14 | +
|
| 15 | + :pcrowSip: |
| 16 | + """ |
| 17 | + global _history_list |
| 18 | + global _window_auto |
| 19 | + |
| 20 | + if renpy.config.old_substitutions: |
| 21 | + def substitute(s): |
| 22 | + return s % renpy.exports.tag_quoting_dict |
| 23 | + else: |
| 24 | + def substitute(s): |
| 25 | + return s |
| 26 | + |
| 27 | + #Filter the list of items to only include ones for which the condition is True. |
| 28 | + items = [ |
| 29 | + (substitute(label), value) |
| 30 | + for label, condition, value in items |
| 31 | + if renpy.python.py_eval(condition) |
| 32 | + ] |
| 33 | + |
| 34 | + #Check to see if there's at least one choice in set of items: |
| 35 | + if not items: |
| 36 | + return None |
| 37 | + |
| 38 | + #Filter the list of items on the set_expr: |
| 39 | + if set_expr: |
| 40 | + set = renpy.python.py_eval(set_expr) |
| 41 | + items = [ |
| 42 | + (label, value) |
| 43 | + for label, value in items |
| 44 | + if label not in set |
| 45 | + ] |
| 46 | + |
| 47 | + else: |
| 48 | + set = None |
| 49 | + |
| 50 | + #Convert items |
| 51 | + formatted_menuitems = [ |
| 52 | + (x[0], x[1], False, False) |
| 53 | + for x in items |
| 54 | + ] |
| 55 | + |
| 56 | + #Prep before showing the menu |
| 57 | + renpy.show("monika", at_list=[t21]) |
| 58 | + |
| 59 | + #Get last line |
| 60 | + last_line = _history_list[-1].what |
| 61 | + |
| 62 | + if last_line.endswith("{nw}"): |
| 63 | + renpy.say(m, last_line.replace("{nw}", "{fast}"), interact=False) |
| 64 | + _history_list.pop() |
| 65 | + |
| 66 | + else: |
| 67 | + _window_hide() |
| 68 | + |
| 69 | + picked = renpy.call_screen( |
| 70 | + "mas_gen_scrollable_menu", |
| 71 | + items=formatted_menuitems, |
| 72 | + display_area=store.mas_ui.SCROLLABLE_MENU_TXT_AREA, |
| 73 | + scroll_align=store.mas_ui.SCROLLABLE_MENU_XALIGN |
| 74 | + ) |
| 75 | + |
| 76 | + #Reset Monika's position |
| 77 | + renpy.show("monika", at_list=[t11]) |
| 78 | + |
| 79 | + #And reset the window |
| 80 | + _window_auto = True |
| 81 | + |
| 82 | + #If we have a set, fill it in with the label of the chosen item. |
| 83 | + if set is not None and picked is not None: |
| 84 | + for label, value in items: |
| 85 | + if value == picked: |
| 86 | + try: |
| 87 | + set.append(label) |
| 88 | + except AttributeError: |
| 89 | + set.add(label) |
| 90 | + |
| 91 | + return picked |
| 92 | + |
| 93 | + renpy.exports.menu = menu_override |
0 commit comments