diff --git a/src/open_samus_returns_rando/files/custom/sprites_texturehud.lua b/src/open_samus_returns_rando/files/custom/sprites_texturehud.lua new file mode 100644 index 00000000..23b817d2 --- /dev/null +++ b/src/open_samus_returns_rando/files/custom/sprites_texturehud.lua @@ -0,0 +1,29 @@ +Game.ImportLibrary("gui/scripts/sprites_texturehud_original.lua") + +GUI.AddSpriteSheetItem("dooriceleft", "gui/textures/texturehud.bctex", { + TextureWidth = "512", + TextureHeight = "256", + UPixelOffset = "120", + VPixelOffset = "40", + UPixelScale = "4", + VPixelScale = "8", + AngleOffset = "0" +}) +GUI.AddSpriteSheetItem("dooriceright", "gui/textures/texturehud.bctex", { + TextureWidth = "512", + TextureHeight = "256", + UPixelOffset = "124", + VPixelOffset = "40", + UPixelScale = "4", + VPixelScale = "8", + AngleOffset = "0" +}) +GUI.AddSpriteSheetItem("dooricecenter", "gui/textures/texturehud.bctex", { + TextureWidth = "512", + TextureHeight = "256", + UPixelOffset = "120", + VPixelOffset = "40", + UPixelScale = "8", + VPixelScale = "8", + AngleOffset = "0" +}) diff --git a/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/doorshieldicebeam.bcmdl b/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/doorshieldicebeam.bcmdl new file mode 100644 index 00000000..3c39c1e0 Binary files /dev/null and b/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/doorshieldicebeam.bcmdl differ diff --git a/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/textures/doorcreature_i.bctex b/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/textures/doorcreature_i.bctex new file mode 100644 index 00000000..76b59a5c Binary files /dev/null and b/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/textures/doorcreature_i.bctex differ diff --git a/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/textures/spiderweb_i.bctex b/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/textures/spiderweb_i.bctex new file mode 100644 index 00000000..0c2a2ee5 Binary files /dev/null and b/src/open_samus_returns_rando/files/romfs/actors/props/doorshieldicebeam/models/textures/spiderweb_i.bctex differ diff --git a/src/open_samus_returns_rando/files/romfs/gui/textures/texturehud.bctex b/src/open_samus_returns_rando/files/romfs/gui/textures/texturehud.bctex new file mode 100644 index 00000000..ed155663 Binary files /dev/null and b/src/open_samus_returns_rando/files/romfs/gui/textures/texturehud.bctex differ diff --git a/src/open_samus_returns_rando/files/schema.json b/src/open_samus_returns_rando/files/schema.json index fc894b9b..b0f14eaa 100644 --- a/src/open_samus_returns_rando/files/schema.json +++ b/src/open_samus_returns_rando/files/schema.json @@ -162,7 +162,8 @@ "wave_beam", "missile", "super_missile", - "power_bomb" + "power_bomb", + "ice_beam" ] } }, diff --git a/src/open_samus_returns_rando/lua_editor.py b/src/open_samus_returns_rando/lua_editor.py index df7f852d..36e36248 100644 --- a/src/open_samus_returns_rando/lua_editor.py +++ b/src/open_samus_returns_rando/lua_editor.py @@ -280,6 +280,7 @@ def _add_replacement_files(self, editor: PatcherEditor, configuration: dict) -> lua_util.replace_script(editor, "actors/props/savestation/scripts/savestation", "custom/savestation.lua") lua_util.replace_script(editor, "actors/props/heatzone/scripts/heatzone", "custom/heatzone.lua") lua_util.replace_script(editor, "gui/scripts/sprites_splashes", "custom/sprites_splashes.lua") + lua_util.replace_script(editor, "gui/scripts/sprites_texturehud", "custom/sprites_texturehud.lua") def save_modifications(self, editor: PatcherEditor, configuration: dict) -> None: self._add_replacement_files(editor, configuration) diff --git a/src/open_samus_returns_rando/specific_patches/door_patches.py b/src/open_samus_returns_rando/specific_patches/door_patches.py index b201891f..4ad4aea3 100644 --- a/src/open_samus_returns_rando/specific_patches/door_patches.py +++ b/src/open_samus_returns_rando/specific_patches/door_patches.py @@ -1,4 +1,3 @@ - import copy import re import typing @@ -191,6 +190,14 @@ def _patch_one_way_doors(editor: PatcherEditor) -> None: properties.components[0]["arguments"][2]["value"] = False +def _static_door_patches(editor: PatcherEditor) -> None: + _patch_one_way_doors(editor) + _patch_missile_covers(editor) + _patch_beam_bmsads(editor) + _patch_beam_covers(editor) + _patch_charge_doors(editor) + + class ActorData(Enum): """ Enum containing data on actors @@ -205,6 +212,7 @@ class ActorData(Enum): SHIELD_MISSILE = (["doorshieldmissile"]) SHIELD_SUPER_MISSILE = (["doorshieldsupermissile"]) SHIELD_POWER_BOMB = (["doorshieldpowerbomb"]) + SHIELD_ICE_BEAM = (["doorshieldicebeam"]) class DoorType(Enum): """ @@ -240,6 +248,9 @@ class DoorType(Enum): "actors/props/doorshield", "actors/props/doorshieldpowerbomb", "sounds/props/doorchargecharge/powerbombdoor_hum.bcwav" ]) + ICE_BEAM = ("ice_beam", ActorData.DOOR_POWER, "doorice", True, ActorData.SHIELD_ICE_BEAM, [ + "actors/props/doorshield", "actors/props/doorshieldicebeam" + ]) def __init__(self, rdv_door_type: str, door_data: ActorData, minimap_name: str, need_shield: bool = False, shield_data: ActorData | None = None, @@ -426,20 +437,63 @@ def patch_actor( self.editor.ensure_present_in_scenario(scenario_name, asset) -def _static_door_patches(editor: PatcherEditor) -> None: - _patch_one_way_doors(editor) - _patch_missile_covers(editor) - _patch_beam_bmsads(editor) - _patch_beam_covers(editor) - _patch_charge_doors(editor) +class NewShield(typing.NamedTuple): + shield_name: str + weakness: str + + +new_shields = [ + NewShield("icebeam", "ICE_BEAM"), +] + + +def add_custom_shields(editor: PatcherEditor, new_shield: NewShield) -> None: + plasma_bmsad = "actors/props/doorcreature/charclasses/doorcreature.bmsad" + missile_bmsad = "actors/props/doorshieldmissile/charclasses/doorshieldmissile.bmsad" + new_bmsad = f"actors/props/doorshield{new_shield.shield_name}/charclasses/doorshield{new_shield.shield_name}.bmsad" + new_model = f"actors/props/doorshield{new_shield.shield_name}/models/doorshield{new_shield.shield_name}.bcmdl" + + # Create a copy of the bmsad + template_shield = editor.get_raw_asset(plasma_bmsad) + editor.add_new_asset(new_bmsad, template_shield, []) + + # Modify the new bmsad + custom_shield = editor.get_file(new_bmsad, Bmsad) + custom_shield.name = f"doorshield{new_shield.shield_name}" + custom_shield.raw["header"]["model_name"] = new_model + + # Update the collision to be able to open both sides + missile_shield = editor.get_file(missile_bmsad, Bmsad) + custom_shield.raw["components"]["COLLISION"] = missile_shield.raw["components"]["COLLISION"] + custom_shield.components["MODELUPDATER"].functions[0].params["Param1"]["value"] = new_model + + # Update the life component + life_component = custom_shield.raw["components"]["LIFE"]["functions"] + life_component[0]["params"]["Param1"]["value"] = new_shield.weakness + + # Remove the second weakness container + life_component.pop(1) + + # Set shield health to 1 + life_component[2]["params"]["Param2"]["value"] = 1.0 + life_component[3]["params"]["Param2"]["value"] = 1.0 + + # Remove the drops from breaking the shield + custom_shield.raw["components"].pop("DROP") + + # Remove the particle animation that occurs after the shield breaks (color mismatch) + custom_shield.raw["action_sets"][0]["animations"][0]["events0"][1]["args"][729149823]["value"] = 0 + def patch_doors(editor: PatcherEditor, door_patches: list[dict]) -> None: _static_door_patches(editor) - + for new_shield in new_shields: + add_custom_shields(editor, new_shield) door_patcher = DoorPatcher(editor) # small hack to eliminate duplicates (randovania exports everything duplicated) import json + set_of_jsons = {json.dumps(d, sort_keys=True) for d in door_patches} door_patches_set = [json.loads(t) for t in set_of_jsons]