From 73d406c913c24cf1fb0e522926df92cf64f22232 Mon Sep 17 00:00:00 2001 From: Thanatos Date: Mon, 25 Sep 2023 22:32:22 +0200 Subject: [PATCH] Changes for vector in meds + some comments --- open_samus_returns_rando/patcher_editor.py | 6 ++--- .../specific_patches/door_patches.py | 27 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/open_samus_returns_rando/patcher_editor.py b/open_samus_returns_rando/patcher_editor.py index f51d284..161dd81 100644 --- a/open_samus_returns_rando/patcher_editor.py +++ b/open_samus_returns_rando/patcher_editor.py @@ -61,9 +61,9 @@ def copy_actor(self, scenario: str, coords, template_actor: Container, new_name: new_actor = copy.deepcopy(template_actor) current_scenario = self.get_scenario(scenario) current_scenario.raw.actors[layer_index][new_name] = new_actor - new_actor.x = coords[0] + offset[0] - new_actor.y = coords[1] + offset[1] - new_actor.z = coords[2] + offset[2] + new_actor["position"][0] = coords[0] + offset[0] + new_actor["position"][1] = coords[1] + offset[1] + new_actor["position"][2] = coords[2] + offset[2] return new_actor diff --git a/open_samus_returns_rando/specific_patches/door_patches.py b/open_samus_returns_rando/specific_patches/door_patches.py index 35f28be..c2cceee 100644 --- a/open_samus_returns_rando/specific_patches/door_patches.py +++ b/open_samus_returns_rando/specific_patches/door_patches.py @@ -51,7 +51,7 @@ def _patch_missile_covers(editor: PatcherEditor): scenario = editor.get_scenario(area) for layer, actor_name, actor in scenario.all_actors(): if actor.type in missile_types: - actor["unk06"] = 90 + actor["y_rotation"] = 90 def _patch_beam_covers(editor: PatcherEditor): creature_bmsad_files = [ @@ -61,34 +61,37 @@ def _patch_beam_covers(editor: PatcherEditor): ] for creature_bmsad_file in creature_bmsad_files: cr_bmsad = editor.get_parsed_asset(creature_bmsad_file, type_hint=Bmsad) + # add the script component, which defines the lua file where it finds functions cr_bmsad.raw["components"]["SCRIPT"] = SCRIPT_COMPONENT + # add the callback to the first animation (which is "death" for the bmsad's) action_set_anim = cr_bmsad.action_sets[0].raw["animations"][0] action_set_anim.event_counts[0] = action_set_anim.event_counts[0] + 1 action_set_anim["events0"].append(ON_DEAD_CB) + # wave cb didn't work and it has animation id 21.it's maybe a bitmask? because it works + # with 29 and also with 30 (which the other two are using) and both are setting 2^3 bit action_set_anim["animation_id"] = 30 editor.replace_asset(creature_bmsad_file, cr_bmsad) beam_types = {"doorwave", "doorspazerbeam", "doorcreature"} for area in ALL_AREAS: editor.ensure_present_in_scenario(area, "actors/props/doors/scripts/doors.lc") - editor.ensure_present_in_scenario(area, "actors/props/doorspazerbeam/collisions/doorspazerbeam.bmscd") - editor.ensure_present_in_scenario(area, "actors/props/doorspazerbeam/models/doorspazerbeam.bcmdl") scenario = editor.get_scenario(area) actor_list_copy = {actor_name: actor for layer, actor_name, actor in scenario.all_actors()} for actor_name, actor in actor_list_copy.items(): if actor.type in beam_types: new_actor_name = f"{actor_name}_o" new_actor = editor.copy_actor( - area, (actor["x"], actor["y"], actor["z"]), actor, new_actor_name, 9 + area, (actor["position"][0], actor["position"][1], actor["position"][2]), + actor, new_actor_name, 9 ) - if new_actor["unk06"] == 0.0: - new_actor["unk05"] = 0 - new_actor["unk06"] = 180 - new_actor["unk07"] = 0 - elif new_actor["unk06"] == 180.0: - new_actor["unk05"] = 0 - new_actor["unk06"] = 0 - new_actor["unk07"] = 0 + if new_actor["rotation"][1] == 0.0: + new_actor["rotation"][0] = 0 + new_actor["rotation"][1] = 180 + new_actor["rotation"][2] = 0 + elif new_actor["rotation"][1] == 180.0: + new_actor["rotation"][0] = 0 + new_actor["rotation"][1] = 0 + new_actor["rotation"][2] = 0 else: # that one is weird (because of fake surface west ?) if area == "s000_surface" and actor_name == "LE_SpazerShield_Door_012":