From 66747d409ec1733012037c6689bd754233265c20 Mon Sep 17 00:00:00 2001 From: xi <104683822+ximk@users.noreply.github.com> Date: Tue, 26 Sep 2023 22:18:32 -0400 Subject: [PATCH] Update Startslide Scripts - Fixed module import with integration of https://github.com/TASLabz/dolphin/commit/61f673561241918719688f6e256abc6255c676f6 - Removed unnecessary memory checks - Updated TTK call to reflect new version - Removed unnecessary `global playerInputs` call --- scripts/Startslide_Left.py | 19 ++++++++----------- scripts/Startslide_Right.py | 18 ++++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/scripts/Startslide_Left.py b/scripts/Startslide_Left.py index 3ff7d9b..a2e3016 100644 --- a/scripts/Startslide_Left.py +++ b/scripts/Startslide_Left.py @@ -1,8 +1,6 @@ from dolphin import controller, event, gui, utils -import mkw_core as core -import mkw_classes as classes -import mkw_translations as translate -from framesequence import FrameSequence +from Modules import TTK_Lib, mkw_classes as classes, mkw_core as core, mkw_translations as translate +from Modules.framesequence import FrameSequence flame_slide_bikes = ("Flame Runner", "Mach Bike", "Sugarscoot", "Zip Zip") spear_slide_bikes = ("Jet Bubble", "Phantom", "Spear", "Sneakster", "Wario Bike") @@ -16,34 +14,33 @@ def onStateLoad(is_slot, slot): @event.on_frameadvance def onFrameAdvance(): - global playerInputs frame = core.get_frame_of_input() playerInput = playerInputs[frame] if (playerInput and classes.RaceInfo.stage() == 1): - controller.set_gc_buttons(0, playerInput.get_controller_inputs()) + TTK_Lib.writePlayerInputs(playerInput) def main() -> None: global playerInputs - playerInputs = FrameSequence(check_vehicle()) + playerInputs = FrameSequence(check_vehicle(translate.vehicle_id())) gui.add_osd_message("Startslide: {} ".format(len(playerInputs) > 0)) # Ensures the right slide for the currently selected bike is being loaded, # even through savestates and vehicle swaps. -def check_vehicle(): +def check_vehicle(vehicle): # Returns True if the player is using a bike. if bool(classes.KartParam.is_bike()): path = utils.get_script_dir() + r'\MKW_Inputs\Startslides' - if translate.vehicle_id() in flame_slide_bikes: + if vehicle in flame_slide_bikes: path += r'\flame_left.csv' - elif translate.vehicle_id() in spear_slide_bikes: + elif vehicle in spear_slide_bikes: path += r'\spear_left.csv' - elif translate.vehicle_id() in star_slide_bikes: + elif vehicle in star_slide_bikes: path += r'\star_left.csv' return path diff --git a/scripts/Startslide_Right.py b/scripts/Startslide_Right.py index a2ad7ff..1cb481b 100644 --- a/scripts/Startslide_Right.py +++ b/scripts/Startslide_Right.py @@ -1,8 +1,6 @@ from dolphin import controller, event, gui, utils -import mkw_core as core -import mkw_classes as classes -import mkw_translations as translate -from framesequence import FrameSequence +from Modules import TTK_Lib, mkw_classes as classes, mkw_core as core, mkw_translations as translate +from Modules.framesequence import FrameSequence flame_slide_bikes = ("Flame Runner", "Mach Bike", "Sugarscoot", "Zip Zip") spear_slide_bikes = ("Jet Bubble", "Phantom", "Spear", "Sneakster", "Wario Bike") @@ -21,29 +19,29 @@ def onFrameAdvance(): playerInput = playerInputs[frame] if (playerInput and classes.RaceInfo.stage() == 1): - controller.set_gc_buttons(0, playerInput.get_controller_inputs()) + TTK_Lib.writePlayerInputs(playerInput) def main() -> None: global playerInputs - playerInputs = FrameSequence(check_vehicle()) + playerInputs = FrameSequence(check_vehicle(translate.vehicle_id())) gui.add_osd_message("Startslide: {} ".format(len(playerInputs) > 0)) # Ensures the right slide for the currently selected bike is being loaded, # even through savestates and vehicle swaps. -def check_vehicle(): +def check_vehicle(vehicle): # Returns True if the player is using a bike. if bool(classes.KartParam.is_bike()): path = utils.get_script_dir() + r'\MKW_Inputs\Startslides' - if translate.vehicle_id() in flame_slide_bikes: + if vehicle in flame_slide_bikes: path += r'\flame_right.csv' - elif translate.vehicle_id() in spear_slide_bikes: + elif vehicle in spear_slide_bikes: path += r'\spear_right.csv' - elif translate.vehicle_id() in star_slide_bikes: + elif vehicle in star_slide_bikes: path += r'\star_right.csv' return path