diff --git a/.github/workflows/test_portal2_apworld.yml b/.github/workflows/test_portal2_apworld.yml deleted file mode 100644 index d6e3a3f89fc..00000000000 --- a/.github/workflows/test_portal2_apworld.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Test apworld -on: - pull_request: - branches: [ main ] - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: Eijebong/ap-actions/ap-tests@main - with: - apworld-path: worlds/portal2 - ap-version: 'latest' - python-version: '3.12' diff --git a/.github/workflows/verify_version.yml b/.github/workflows/verify_version.yml deleted file mode 100644 index c86cc080a9a..00000000000 --- a/.github/workflows/verify_version.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Verify Version Bump -on: - pull_request: - branches: [ main ] - -jobs: - check-version-bump: - # Only run if coming from development - if: github.head_ref == 'development' - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Necessary to see all tags - - - name: Get Latest Tag and PR Version - id: versions - run: | - # Get the most recent tag - LATEST_TAG=$(git describe --tags --abbrev=0) - # Extract version from JSON - PR_VERSION=$(jq -r '.world_version' worlds/portal2/archipelago.json) - - echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT - echo "pr_version=$PR_VERSION" >> $GITHUB_OUTPUT - - - name: Compare SemVer - shell: python - run: | - from packaging import version - import os - - latest = version.parse("${{ steps.versions.outputs.latest_tag }}") - current = version.parse("${{ steps.versions.outputs.pr_version }}") - - print(f"Latest Tag: {latest}") - print(f"PR Version: {current}") - - if current <= latest: - print(f"::error::world_version ({current}) must be greater than the latest tag ({latest})") - exit(1) - else: - print("Version check passed!") diff --git a/worlds/portal2/__init__.py b/worlds/portal2/__init__.py index b55132e3b86..96900ce0a44 100644 --- a/worlds/portal2/__init__.py +++ b/worlds/portal2/__init__.py @@ -22,12 +22,6 @@ class Portal2ExtrasFilePath(settings.UserFilePath): """The file path of the extras.txt file (used to generate the menu in game)""" description = "Portal 2 extras.txt file inside the mod" - is_windows = sys.platform == "win32" - is_linux = sys.platform == "linux" - extras_path = "C:/Program Files (x86)/Steam/steamapps/sourcemods/Portal2Archipelago/scripts/extras.txt" if is_windows else \ - "$HOME/.local/share/Steam/steamapps/sourcemods/Portal2Archipelago/scripts/extras.txt" if is_linux else "" # May may be user specific so cannot auto select - menu_file: Portal2ExtrasFilePath = Portal2ExtrasFilePath(extras_path) - class Portal2NetConPort(int): """The port set in the portal 2 launch options e.g. 3000""" diff --git a/worlds/portal2/client/P2Context.py b/worlds/portal2/client/P2Context.py index 7524868fac1..2755c142095 100644 --- a/worlds/portal2/client/P2Context.py +++ b/worlds/portal2/client/P2Context.py @@ -139,8 +139,9 @@ def __init__(self, name_text: str, count_text: str, on_release): ) self.name_label = MDLabel( - text=name_text, width=dp(150), size_hint_x=None, halign="left" + text=name_text, width=dp(130), size_hint_x=None, halign="left", shorten=True, shorten_from="right" ) + self.count_label = MDLabel( text=count_text, halign="right", diff --git a/worlds/portal2/client/Portal2Client.py b/worlds/portal2/client/Portal2Client.py index f27dae7472a..8a28f0f8bca 100644 --- a/worlds/portal2/client/Portal2Client.py +++ b/worlds/portal2/client/Portal2Client.py @@ -15,7 +15,6 @@ from ..mod_helpers.MapMenu import GameMapMenu from .DeathMessages import get_death_message from ..Locations import location_names_to_map_codes, map_codes_to_location_names, wheatley_maps_to_monitor_names, all_locations_table, wheatley_monitor_table, ratman_den_locations_table -from .. import Portal2World from ..Options import GameModeOption if __name__ == "__main__": @@ -106,13 +105,9 @@ def create_level_begin_command(self): return f"{';'.join(self.item_remove_commands)}\n" def update_menu(self, location_id: int = None): - menu_file = Portal2World.settings.menu_file check_completed = False if location_id is not None: check_completed = self.game_map_menu.complete_check(location_id) - # Write the menu to that file - with open(menu_file, "w", encoding='utf-8') as f: - f.write(str(self.game_map_menu)) self.client_map_menu.update_menu(self.game_map_menu.get_menu_info(), location_id) return check_completed diff --git a/worlds/portal2/test/__init__.py b/worlds/portal2/test/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/worlds/portal2/test/bases.py b/worlds/portal2/test/bases.py deleted file mode 100644 index 3d1d3faafa1..00000000000 --- a/worlds/portal2/test/bases.py +++ /dev/null @@ -1,5 +0,0 @@ -from test.bases import WorldTestBase - - -class Portal2TestBase(WorldTestBase): - game = "Portal 2" diff --git a/worlds/portal2/test/test_additional_checks.py b/worlds/portal2/test/test_additional_checks.py deleted file mode 100644 index 41c9716a55f..00000000000 --- a/worlds/portal2/test/test_additional_checks.py +++ /dev/null @@ -1,19 +0,0 @@ -from .bases import Portal2TestBase -from ..Options import GameModeOption -from ..Locations import wheatley_monitor_table, ratman_den_locations_table, cutscene_completion_table, map_complete_table, item_location_table - - -class AdditionalChecks(Portal2TestBase): - options = { - "game_mode": GameModeOption.NORMAL, - "cutscene_levels": True, - "wheatley_monitors": True, - "ratman_dens": True - } - - def test_all_additional_locations_placed(self) -> None: - """Test all additional locations are placed""" - location_names = [loc.name for loc in self.world.get_locations() if not(loc.name in map_complete_table or loc.name in item_location_table)] - location_names.remove("Beat Final Level") - additional_locations = list(wheatley_monitor_table) + list(ratman_den_locations_table) + list(cutscene_completion_table) - self.assertListEqual(sorted(additional_locations), sorted(location_names)) diff --git a/worlds/portal2/test/test_base_menu.py b/worlds/portal2/test/test_base_menu.py deleted file mode 100644 index 565c6809e96..00000000000 --- a/worlds/portal2/test/test_base_menu.py +++ /dev/null @@ -1,43 +0,0 @@ -from worlds.AutoWorld import call_all - -from .bases import Portal2TestBase -from ..Options import GameModeOption -from ..mod_helpers.MapMenu import GameMapMenu -from ..Locations import all_locations_table - -class FakeClient: - item_list: list[str] = [] - location_id_to_name: dict[int, str] = {data.id: name for name, data in all_locations_table.items()} - - -class BaseMenuTests(Portal2TestBase): - options = { - "game_mode": GameModeOption.NORMAL - } - - def setUp(self): - super().setUp() - self.client = FakeClient() - - def test_menu_generation(self) -> None: - from Fill import distribute_items_restrictive - - with self.subTest("Game", game=self.game, seed=self.multiworld.seed): - distribute_items_restrictive(self.multiworld) - call_all(self.multiworld, "post_fill") - - slot_data = self.world.fill_slot_data() - - menu = GameMapMenu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"]) - menu.generate_menu() - # Check menu is generated where the first map of each chapter says "command" and the rest say "command_deactivated" - menu_string = str(menu) - self.assertGreater(menu_string.count('"command_deactivated"'), 0) - self.assertEqual(menu_string.count('"command"'), 18) - - def test_menu_no_maps(self) -> None: - menu = GameMapMenu({1: [], 2: [], 3: []}, self.client) - menu.generate_menu() - menu_string = str(menu) - # Check menu is generated where the first map of each chapter says "No Maps In This Chapter" - self.assertEqual(menu_string.count("No Maps In This Chapter"), 3) \ No newline at end of file diff --git a/worlds/portal2/test/test_chaotic_game_mode.py b/worlds/portal2/test/test_chaotic_game_mode.py deleted file mode 100644 index 9bc132266d4..00000000000 --- a/worlds/portal2/test/test_chaotic_game_mode.py +++ /dev/null @@ -1,9 +0,0 @@ -from .bases import Portal2TestBase -from .test_normal_game_mode import NormalGameMode -from ..Options import GameModeOption - - -class ChaoticGameMode(NormalGameMode): - options = { - "game_mode": GameModeOption.CHAOTIC - } diff --git a/worlds/portal2/test/test_item_checks.py b/worlds/portal2/test/test_item_checks.py deleted file mode 100644 index 81a2f415ad8..00000000000 --- a/worlds/portal2/test/test_item_checks.py +++ /dev/null @@ -1,20 +0,0 @@ -from .bases import Portal2TestBase -from ..Options import GameModeOption -from ..ItemNames import portal_gun_2, potatos - -class ItemChecks(Portal2TestBase): - options = { - "game_mode": GameModeOption.NORMAL, - } - - def test_portal_gun_items_in_place(self) -> None: - """Testing if when Upgraded Portal Gun and PotatOS are in their places they are also put into slot data""" - self.world.get_location(portal_gun_2).item = self.world.create_item(portal_gun_2) - self.world.get_location(potatos).item = self.world.create_item(potatos) - - slot_data = self.world.fill_slot_data() - - self.assertTrue("portal_gun_upgrade_inplace" in slot_data) - self.assertTrue(slot_data["portal_gun_upgrade_inplace"] == True) - self.assertTrue("potatos_inplace" in slot_data) - self.assertTrue(slot_data["potatos_inplace"] == True) diff --git a/worlds/portal2/test/test_menu_additional_checks.py b/worlds/portal2/test/test_menu_additional_checks.py deleted file mode 100644 index c143b37c6ad..00000000000 --- a/worlds/portal2/test/test_menu_additional_checks.py +++ /dev/null @@ -1,63 +0,0 @@ -from worlds.AutoWorld import call_all - -from .test_base_menu import FakeClient -from .bases import Portal2TestBase -from ..Options import GameModeOption -from ..mod_helpers.MapMenu import GameMapMenu -from ..ItemNames import portal_gun_1, portal_gun_2, potatos -from ..mod_helpers.MapMenu import indicator_characters - -class AdditionalChecksMenuTests(Portal2TestBase): - options = { - "game_mode": GameModeOption.NORMAL, - "wheatley_monitors": True, - "ratman_dens": True, - "cutscene_levels": True, - "vitrified_doors": True, - } - - def setUp(self): - super().setUp() - self.client = FakeClient() - - def test_title_generation(self) -> None: - from Fill import distribute_items_restrictive - - with self.subTest("Game", game=self.game, seed=self.multiworld.seed): - distribute_items_restrictive(self.multiworld) - call_all(self.multiworld, "post_fill") - - slot_data = self.world.fill_slot_data() - - menu = GameMapMenu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"], vitrified_doors=slot_data["vitrified_doors"]) - menu.generate_menu() - menu_string = str(menu) - # Find map that includes Wheatley Monitors in the title and check it is correct - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["wheatley"]}{indicator_characters["wheatley"]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["wheatley"]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["ratman"]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["vitrified_door"]}{indicator_characters["vitrified_door"]}{indicator_characters["vitrified_door"]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters[portal_gun_1]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters[portal_gun_2]}" in menu_string) - self.assertTrue(f"{indicator_characters["map"]}{indicator_characters[potatos]}" in menu_string) - - def test_sub_location_completion(self) -> None: - from Fill import distribute_items_restrictive - - with self.subTest("Game", game=self.game, seed=self.multiworld.seed): - distribute_items_restrictive(self.multiworld) - call_all(self.multiworld, "post_fill") - - slot_data = self.world.fill_slot_data() - - menu = GameMapMenu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"]) - menu.generate_menu() - # Complete a map with a sub location and check the title updates - menu.complete_map(slot_data["location_name_to_id"]["Portal Gun Completion"]) - menu_string = str(menu) - self.assertTrue(f"✓{indicator_characters[portal_gun_1]}" in menu_string) - menu.complete_sub_location_check(portal_gun_1) - menu_string = str(menu) - self.assertTrue("✓✓" in menu_string) - \ No newline at end of file diff --git a/worlds/portal2/test/test_normal_game_mode.py b/worlds/portal2/test/test_normal_game_mode.py deleted file mode 100644 index b78d34114cc..00000000000 --- a/worlds/portal2/test/test_normal_game_mode.py +++ /dev/null @@ -1,16 +0,0 @@ -from .bases import Portal2TestBase -from ..Options import GameModeOption - - -class NormalGameMode(Portal2TestBase): - options = { - "game_mode": GameModeOption.NORMAL - } - - run_default_tests = False - - def test_no_duplicate_locations(self) -> None: - """Test there are no duplicate locations""" - location_names = [loc.name for loc in self.world.get_locations()] - location_names_dupes_removed = list(set(location_names)) - self.assertListEqual(sorted(location_names), sorted(location_names_dupes_removed)) diff --git a/worlds/portal2/test/test_open_world_game_mode.py b/worlds/portal2/test/test_open_world_game_mode.py deleted file mode 100644 index 9c520e2e072..00000000000 --- a/worlds/portal2/test/test_open_world_game_mode.py +++ /dev/null @@ -1,9 +0,0 @@ -from .bases import Portal2TestBase -from .test_normal_game_mode import NormalGameMode -from ..Options import GameModeOption - - -class OpenWorldGameMode(NormalGameMode): - options = { - "game_mode": GameModeOption.OPEN_WORLD - }