Skip to content

Commit

Permalink
Merge pull request #412 from randovania/new-meds-changes
Browse files Browse the repository at this point in the history
Support for new MEDS
  • Loading branch information
ThanatosGit authored Jul 23, 2024
2 parents 02ffaf2 + d6e63da commit 491f024
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 24 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"mercury-engine-data-structures>=0.30.0",
"mercury-engine-data-structures>=0.31.1",
"jsonschema>=4.0.0",
"ips.py>=0.1.2",
]
Expand Down Expand Up @@ -69,7 +69,6 @@ max-complexity = 25
[project.optional-dependencies]
typing = [
"types-jsonschema",
"construct-typing",
"types-pyinstaller",
"mypy"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"magic": "MSAD",
"version": 2883585,
"version": "1.44.0",
"name": "randomizerpowerup",
"header": {
"model_name": "actors/items/itemsphere/models/itemsphere.bcmdl",
Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/lua_editor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import itertools
from collections.abc import Iterable

from construct import Container
from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.formats.lua import Lua

from open_samus_returns_rando.constants import ALL_SCENARIOS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from construct import Container
from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.formats.lua import Lua
from open_samus_returns_rando.misc_patches import lua_util
from open_samus_returns_rando.patcher_editor import PatcherEditor
Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/misc_patches/elevators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from construct import Container
from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.formats.lua import Lua
from open_samus_returns_rando.misc_patches import lua_util
from open_samus_returns_rando.patcher_editor import PatcherEditor
Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/misc_patches/lua_util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import typing

from construct import Container
from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.file_tree_editor import FileTreeEditor
from mercury_engine_data_structures.formats.lua import Lua
from open_samus_returns_rando.files import files_path, templates_path
Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/patcher_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typing
from pathlib import Path

from construct import Container
from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.file_tree_editor import FileTreeEditor
from mercury_engine_data_structures.formats import BaseResource, Bmsld
from mercury_engine_data_structures.game_check import Game
Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/pickups/custom_pickups.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import typing

from construct import Container, ListContainer
from construct import Container, ListContainer # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsmsd
from open_samus_returns_rando.patcher_editor import PatcherEditor

Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/pickups/pickup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from enum import Enum

from construct import Container, ListContainer
from construct import Container, ListContainer # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsad, Bmsmsd, Lua
from mercury_engine_data_structures.formats.bmsmsd import TileType
from open_samus_returns_rando.constants import get_package_name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import typing

from construct import Container, ListContainer
from construct import Container, ListContainer # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsad, Bmsmsd
from open_samus_returns_rando.patcher_editor import PatcherEditor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typing
from enum import Enum

from construct import Container, ListContainer
from construct import Container, ListContainer # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsad, Bmsld, Bmsmsd, Lua
from mercury_engine_data_structures.formats.bmsmsd import IconPriority, TileBorders
from open_samus_returns_rando.files import files_path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from construct import Container
from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsad, Bmsbk
from open_samus_returns_rando.patcher_editor import PatcherEditor

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
import typing

from construct import Container, ListContainer
from construct import Container, ListContainer # type: ignore[import-untyped]
from open_samus_returns_rando.patcher_editor import PatcherEditor


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import typing

from construct import ListContainer
from construct import ListContainer # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsad
from open_samus_returns_rando.patcher_editor import PatcherEditor

Expand Down
18 changes: 9 additions & 9 deletions src/open_samus_returns_rando/specific_patches/static_fixes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
import typing

from construct import Container, ListContainer
from construct import Container, ListContainer # type: ignore[import-untyped]
from mercury_engine_data_structures.formats import Bmsad, Bmsbk, Bmscc, Bmssd, Bmtun
from open_samus_returns_rando.patcher_editor import PatcherEditor

Expand Down Expand Up @@ -234,8 +234,8 @@ def fix_wrong_cc_actor_deletions(editor: PatcherEditor) -> None:
"unk2": 0,
"unk3": 0,
"respawn_time": 0.0,
"name1": "sg_casca38",
"name2": ""
"model_name": "sg_casca38",
"vignette_name": ""
})
BOMB_GROUP = Container(
unk_bool=True,
Expand Down Expand Up @@ -295,7 +295,7 @@ def fix_wrong_cc_actor_deletions(editor: PatcherEditor) -> None:
new_group = copy.deepcopy(BOMB_GROUP)
new_block = copy.deepcopy(CUSTOM_BLOCK)
new_block["pos"] = pos
new_block["name1"] = sg_casca
new_block["model_name"] = sg_casca
types: ListContainer = typing.cast(ListContainer, new_group["types"])
types[0]["blocks"].append(new_block)
bmsbk.raw.block_groups.append(new_group)
Expand Down Expand Up @@ -354,17 +354,17 @@ def disable_vignettes(editor: PatcherEditor) -> None:
block["name2"] = ""

bmssd = editor.get_file(f"maps/levels/c10_samus/{scenario_name}/{scenario_name}.bmssd", Bmssd)
sg_group = bmssd.raw["unk_structs_b"]
sg_group = bmssd.raw["scene_groups"]
vignette_models = vignette_object["vignette_models"]
for camera in vignette_object["cc"]:
cc_name = "sg_SubArea_collision_camera_" + camera
for sg in sg_group:
# Check for the cc_name
if sg["str1"] == cc_name:
for cc_group in sg["struct3"]:
model_group = cc_group["struct5"]
if sg["sg_name"] == cc_name:
for cc_group in sg["model_groups"]:
model_group = cc_group["models"]
for idx, model in reversed(list(enumerate(model_group))):
if any(model["int6"] == vignette for vignette in vignette_models):
if any(model["model_id"] == vignette for vignette in vignette_models):
# Remove the model to prevent it from loading
model_group.pop(idx)

Expand Down

0 comments on commit 491f024

Please sign in to comment.