Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bmsld_add and use methods of Bmsld class #109

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions open_samus_returns_rando/bmsld_add.py

This file was deleted.

3 changes: 1 addition & 2 deletions open_samus_returns_rando/patcher_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from mercury_engine_data_structures.formats import BaseResource, Bmsld
from mercury_engine_data_structures.game_check import Game

from open_samus_returns_rando.bmsld_add import remove_actor_from_all_groups
from open_samus_returns_rando.constants import ALL_AREAS

T = typing.TypeVar("T")
Expand Down Expand Up @@ -73,4 +72,4 @@ def remove_entity(self, reference: dict):
actor_name = reference["actor"]

scenario.raw.actors[layer].pop(actor_name)
remove_actor_from_all_groups(scenario, actor_name)
scenario.remove_actor_from_all_groups(actor_name)
7 changes: 3 additions & 4 deletions open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from mercury_engine_data_structures.file_tree_editor import OutputFormat

from open_samus_returns_rando.bmsld_add import add_actor_to_entity_groups
from open_samus_returns_rando.lua_editor import LuaEditor
from open_samus_returns_rando.misc_patches import lua_util
from open_samus_returns_rando.misc_patches.exefs import DSPatch
Expand All @@ -32,7 +31,7 @@ def create_custom_init(configuration: dict) -> str:

energy_per_tank = configuration["energy_per_tank"]
max_life = inventory.pop("ITEM_MAX_LIFE")

aeion_per_tank = configuration["aeion_per_tank"]
max_aeion = inventory.pop("ITEM_MAX_SPECIAL_ENERGY")

Expand Down Expand Up @@ -85,7 +84,7 @@ def patch_spawn_points(editor: PatcherEditor, spawn_config: list[dict]):
scenario_name, new_actor_name, collision_camera_name, new_spawn_pos = unpack_new_actor(new_spawn)
scenario = editor.get_scenario(scenario_name)
editor.copy_actor(scenario_name, new_spawn_pos, base_actor, new_actor_name, 5)
add_actor_to_entity_groups(scenario, collision_camera_name, new_actor_name)
scenario.add_actor_to_entity_groups(collision_camera_name, new_actor_name)

def patch_custom_pickups(editor: PatcherEditor, pickup_config: list[dict]):
# create custom pickup
Expand All @@ -95,7 +94,7 @@ def patch_custom_pickups(editor: PatcherEditor, pickup_config: list[dict]):
scenario_name, new_actor_name, collision_camera_name, new_pos = unpack_new_actor(new_pickup)
scenario = editor.get_scenario(scenario_name)
editor.copy_actor(scenario_name, new_pos, base_actor, new_actor_name, 9)
add_actor_to_entity_groups(scenario, collision_camera_name, new_actor_name)
scenario.add_actor_to_entity_groups(collision_camera_name, new_actor_name)

def patch_extracted(input_path: Path, output_path: Path, configuration: dict):
LOG.info("Will patch files from %s", input_path)
Expand Down
34 changes: 16 additions & 18 deletions open_samus_returns_rando/specific_patches/heat_room_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from construct import Container, ListContainer

from open_samus_returns_rando.bmsld_add import add_actor_to_entity_groups, add_actor_to_group, get_actor_group
from open_samus_returns_rando.patcher_editor import PatcherEditor


Expand All @@ -26,7 +25,7 @@ def _patch_area_2b(editor: PatcherEditor):
# area2b => shape is already correct but ms forgot to add one room
heat_trigger_2b = {"scenario": "s025_area2b", "layer": "2", "actor": "TG_SP_Heat_001"}
scenario_2b = editor.get_scenario(heat_trigger_2b["scenario"])
add_actor_to_entity_groups(scenario_2b, "collision_camera013", heat_trigger_2b["actor"])
scenario_2b.add_actor_to_entity_groups("collision_camera013", heat_trigger_2b["actor"])

def _patch_area_3b(editor: PatcherEditor):
name_of_scenario = "s033_area3b"
Expand All @@ -53,9 +52,8 @@ def _patch_area_3b(editor: PatcherEditor):
heat_actor = _get_heat_trigger(editor)
editor.copy_actor(name_of_scenario, (1000.0, 5000.0, 0.0), heat_actor, "TG_Heat_003", 2)

group_cc36 = get_actor_group(scenario_3b, "eg_SubArea_collision_camera_036")

add_actor_to_group(group_cc36, "TG_Heat_003", -1)
group_cc36 = scenario_3b.get_actor_group("eg_SubArea_collision_camera_036")
group_cc36.names.insert(-1, "TG_Heat_003")

def _patch_area_3c(editor: PatcherEditor):
name_of_scenario = "s036_area3c"
Expand All @@ -82,11 +80,11 @@ def _patch_area_3c(editor: PatcherEditor):
heat_actor = _get_heat_trigger(editor)
editor.copy_actor(name_of_scenario, (19269.0, 3669.0, 0.0), heat_actor, "TG_Heat_003", 2)

group_cc22 = get_actor_group(scenario_3c, "eg_SubArea_collision_camera_022")
group_cc26 = get_actor_group(scenario_3c, "eg_SubArea_collision_camera_026")
group_cc22 = scenario_3c.get_actor_group("eg_SubArea_collision_camera_022")
group_cc26 = scenario_3c.get_actor_group("eg_SubArea_collision_camera_026")

add_actor_to_group(group_cc22, "TG_Heat_003", -1)
add_actor_to_group(group_cc26, "TG_Heat_003", -1)
group_cc22.names.insert(-1, "TG_Heat_003")
group_cc26.names.insert(-1, "TG_Heat_003")

def _patch_area_4(editor: PatcherEditor):
name_of_scenario = "s040_area4"
Expand All @@ -113,7 +111,7 @@ def _patch_area_4(editor: PatcherEditor):
heat_actor = _get_heat_trigger(editor)
editor.copy_actor(name_of_scenario, (1000.0, 1000.0, 0.0), heat_actor, "TG_Heat_003", 2)

add_actor_to_entity_groups(scenario_4, "collision_camera_005", "TG_Heat_003", True)
scenario_4.add_actor_to_entity_groups("collision_camera_005", "TG_Heat_003", True)

def _patch_area_5_1(editor: PatcherEditor):
name_of_scenario = "s050_area5"
Expand All @@ -140,7 +138,7 @@ def _patch_area_5_1(editor: PatcherEditor):
heat_actor = _get_heat_trigger(editor)
editor.copy_actor(name_of_scenario, (-2000.0, 5000.0, 0.0), heat_actor, "TG_Heat_003", 2)

add_actor_to_entity_groups(scenario_5, "collision_camera_006", "TG_Heat_003", True)
scenario_5.add_actor_to_entity_groups("collision_camera_006", "TG_Heat_003", True)


def _patch_area_5_2(editor: PatcherEditor):
Expand Down Expand Up @@ -169,9 +167,9 @@ def _patch_area_5_2(editor: PatcherEditor):
new_actor = editor.copy_actor(name_of_scenario, (5600.0, 16000.0, 0.0), heat_actor, "TG_Heat_004", 2)
new_actor["components"][0]["arguments"][16]["value"] = "LS_Heat_002"

add_actor_to_entity_groups(scenario_5, "collision_camera_009", "TG_Heat_004", True)
add_actor_to_entity_groups(scenario_5, "collision_camera_015", "TG_Heat_004", True)
add_actor_to_entity_groups(scenario_5, "collision_camera_017", "TG_Heat_004", True)
scenario_5.add_actor_to_entity_groups("collision_camera_009", "TG_Heat_004", True)
scenario_5.add_actor_to_entity_groups("collision_camera_015", "TG_Heat_004", True)
scenario_5.add_actor_to_entity_groups("collision_camera_017", "TG_Heat_004", True)

def _patch_area_6_b(editor: PatcherEditor):
name_of_scenario = "s065_area6b"
Expand All @@ -198,9 +196,9 @@ def _patch_area_6_b(editor: PatcherEditor):
heat_actor = _get_heat_trigger(editor)
editor.copy_actor(name_of_scenario, (6000.0, 9000.0, 0.0), heat_actor, "TG_Heat_003", 2)

add_actor_to_entity_groups(scenario_6b, "collision_camera_014", "TG_Heat_003", True)
add_actor_to_entity_groups(scenario_6b, "collision_camera_017", "TG_Heat_003", True)
add_actor_to_entity_groups(scenario_6b, "collision_camera_018", "TG_Heat_003", True)
scenario_6b.add_actor_to_entity_groups("collision_camera_014", "TG_Heat_003", True)
scenario_6b.add_actor_to_entity_groups("collision_camera_017", "TG_Heat_003", True)
scenario_6b.add_actor_to_entity_groups("collision_camera_018", "TG_Heat_003", True)


def _patch_area_6_c(editor: PatcherEditor):
Expand Down Expand Up @@ -228,7 +226,7 @@ def _patch_area_6_c(editor: PatcherEditor):
heat_actor = _get_heat_trigger(editor)
editor.copy_actor(name_of_scenario, (1000.0, 2000.0, 0.0), heat_actor, "TG_Heat_003", 2)

add_actor_to_entity_groups(scenario_6c, "collision_camera_022", "TG_Heat_003", True)
scenario_6c.add_actor_to_entity_groups("collision_camera_022", "TG_Heat_003", True)

def patch_heat_rooms(editor: PatcherEditor):
_patch_area_2b(editor)
Expand Down