Skip to content

Commit

Permalink
Bunch more renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
NewSoupVi committed Nov 5, 2023
1 parent ef36f09 commit cb7a384
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
12 changes: 6 additions & 6 deletions worlds/witness/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ class WitnessLocation(Location):
Archipelago Location for The Witness
"""
game: str = "The Witness"
check_hex: int = -1
entity_hex: int = -1

def __init__(self, player: int, name: str, address: Optional[int], parent, ch_hex: int = -1):
super().__init__(player, name, address, parent)
self.check_hex = ch_hex
self.entity_hex = ch_hex


def create_region(world: WitnessWorld, name: str, locat: WitnessPlayerLocations, region_locations=None, exits=None):
Expand All @@ -341,13 +341,13 @@ def create_region(world: WitnessWorld, name: str, locat: WitnessPlayerLocations,
for location in region_locations:
loc_id = locat.CHECK_LOCATION_TABLE[location]

check_hex = -1
entity_hex = -1
if location in StaticWitnessLogic.ENTITIES_BY_NAME:
check_hex = int(
StaticWitnessLogic.ENTITIES_BY_NAME[location]["checkHex"], 0
entity_hex = int(
StaticWitnessLogic.ENTITIES_BY_NAME[location]["entity_hex"], 0
)
location = WitnessLocation(
world.player, location, loc_id, ret, check_hex
world.player, location, loc_id, ret, entity_hex
)

ret.locations.append(location)
Expand Down
14 changes: 7 additions & 7 deletions worlds/witness/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def __init__(self, world: "WitnessWorld", player_logic: WitnessPlayerLogic):
self.PANEL_TYPES_TO_SHUFFLE.add("Obelisk Side")

for obelisk_loc in StaticWitnessLocations.OBELISK_SIDES:
obelisk_loc_hex = StaticWitnessLogic.ENTITIES_BY_NAME[obelisk_loc]["checkHex"]
obelisk_loc_hex = StaticWitnessLogic.ENTITIES_BY_NAME[obelisk_loc]["entity_hex"]
if player_logic.REQUIREMENTS_BY_HEX[obelisk_loc_hex] == frozenset({frozenset()}):
self.CHECK_LOCATIONS.discard(obelisk_loc)

Expand All @@ -524,17 +524,17 @@ def __init__(self, world: "WitnessWorld", player_logic: WitnessPlayerLogic):
self.CHECK_LOCATIONS.discard(StaticWitnessLogic.ENTITIES_BY_HEX[player_logic.VICTORY_LOCATION]["checkName"])

self.CHECK_LOCATIONS = self.CHECK_LOCATIONS - {
StaticWitnessLogic.ENTITIES_BY_HEX[check_hex]["checkName"]
for check_hex in player_logic.COMPLETELY_DISABLED_ENTITIES | player_logic.PRECOMPLETED_LOCATIONS
StaticWitnessLogic.ENTITIES_BY_HEX[entity_hex]["checkName"]
for entity_hex in player_logic.COMPLETELY_DISABLED_ENTITIES | player_logic.PRECOMPLETED_LOCATIONS
}

self.CHECK_PANELHEX_TO_ID = {
StaticWitnessLogic.ENTITIES_BY_NAME[ch]["checkHex"]: StaticWitnessLocations.ALL_LOCATIONS_TO_ID[ch]
StaticWitnessLogic.ENTITIES_BY_NAME[ch]["entity_hex"]: StaticWitnessLocations.ALL_LOCATIONS_TO_ID[ch]
for ch in self.CHECK_LOCATIONS
if StaticWitnessLogic.ENTITIES_BY_NAME[ch]["entityType"] in self.PANEL_TYPES_TO_SHUFFLE
}

dog_hex = StaticWitnessLogic.ENTITIES_BY_NAME["Town Pet the Dog"]["checkHex"]
dog_hex = StaticWitnessLogic.ENTITIES_BY_NAME["Town Pet the Dog"]["entity_hex"]
dog_id = StaticWitnessLocations.ALL_LOCATIONS_TO_ID["Town Pet the Dog"]
self.CHECK_PANELHEX_TO_ID[dog_hex] = dog_id

Expand All @@ -553,13 +553,13 @@ def __init__(self, world: "WitnessWorld", player_logic: WitnessPlayerLogic):

check_dict = {
StaticWitnessLogic.ENTITIES_BY_HEX[location]["checkName"]:
StaticWitnessLocations.get_id(StaticWitnessLogic.ENTITIES_BY_HEX[location]["checkHex"])
StaticWitnessLocations.get_id(StaticWitnessLogic.ENTITIES_BY_HEX[location]["entity_hex"])
for location in self.CHECK_PANELHEX_TO_ID
}

self.CHECK_LOCATION_TABLE = {**self.EVENT_LOCATION_TABLE, **check_dict}

def add_location_late(self, entity_name: str):
entity_hex = StaticWitnessLogic.ENTITIES_BY_NAME[entity_name]["checkHex"]
entity_hex = StaticWitnessLogic.ENTITIES_BY_NAME[entity_name]["entity_hex"]
self.CHECK_LOCATION_TABLE[entity_hex] = entity_name
self.CHECK_PANELHEX_TO_ID[entity_hex] = StaticWitnessLocations.get_id(entity_hex)
10 changes: 5 additions & 5 deletions worlds/witness/player_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ def make_options_adjustments(self, world: "WitnessWorld"):
loc_obj = StaticWitnessLogic.ENTITIES_BY_NAME[yaml_disabled_location]

if loc_obj["entityType"] == "EP" and world.options.shuffle_EPs != 0:
yaml_disabled_eps.append(loc_obj["checkHex"])
yaml_disabled_eps.append(loc_obj["entity_hex"])

if loc_obj["entityType"] in {"EP", "General", "Vault", "Discard"}:
self.EXCLUDED_LOCATIONS.add(loc_obj["checkHex"])
self.EXCLUDED_LOCATIONS.add(loc_obj["entity_hex"])

adjustment_linesets_in_order.append(["Disabled Locations:"] + yaml_disabled_eps)

Expand All @@ -422,10 +422,10 @@ def make_dependency_reduced_checklist(self):
Turns dependent check set into semi-independent check set
"""

for check_hex in self.DEPENDENT_REQUIREMENTS_BY_HEX.keys():
indep_requirement = self.reduce_req_within_region(check_hex)
for entity_hex in self.DEPENDENT_REQUIREMENTS_BY_HEX.keys():
indep_requirement = self.reduce_req_within_region(entity_hex)

self.REQUIREMENTS_BY_HEX[check_hex] = indep_requirement
self.REQUIREMENTS_BY_HEX[entity_hex] = indep_requirement

for item in self.PROG_ITEMS_ACTUALLY_IN_THE_GAME_NO_MULTI:
if item not in self.THEORETICAL_ITEMS:
Expand Down
6 changes: 3 additions & 3 deletions worlds/witness/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ def set_rules(world: "WitnessWorld", location_cache: Dict[str, Location]):
if location in world.locat.EVENT_LOCATION_TABLE:
real_location = location[:-7]

panel = StaticWitnessLogic.ENTITIES_BY_NAME[real_location]
check_hex = panel["checkHex"]
associated_entity = StaticWitnessLogic.ENTITIES_BY_NAME[real_location]
entity_hex = associated_entity["entity_hex"]

rule = make_lambda(check_hex, world)
rule = make_lambda(entity_hex, world)

location = location_cache[location] if location in location_cache\
else world.multiworld.get_location(location, world.player)
Expand Down
28 changes: 14 additions & 14 deletions worlds/witness/static_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,32 @@ def read_logic_file(self, lines):

entity_name_full = line_split.pop(0)

check_hex = entity_name_full[0:7]
entity_hex = entity_name_full[0:7]
entity_name = entity_name_full[9:-1]

required_panel_lambda = line_split.pop(0)

full_entity_name = current_region["shortName"] + " " + entity_name

if location_id == "Door" or location_id == "Laser":
self.ENTITIES_BY_HEX[check_hex] = {
self.ENTITIES_BY_HEX[entity_hex] = {
"checkName": full_entity_name,
"checkHex": check_hex,
"entity_hex": entity_hex,
"region": None,
"id": None,
"entityType": location_id
}

self.ENTITIES_BY_NAME[self.ENTITIES_BY_HEX[check_hex]["checkName"]] = self.ENTITIES_BY_HEX[check_hex]
self.ENTITIES_BY_NAME[self.ENTITIES_BY_HEX[entity_hex]["checkName"]] = self.ENTITIES_BY_HEX[entity_hex]

self.STATIC_DEPENDENT_REQUIREMENTS_BY_HEX[check_hex] = {
self.STATIC_DEPENDENT_REQUIREMENTS_BY_HEX[entity_hex] = {
"panels": parse_lambda(required_panel_lambda)
}

# Lasers and Doors exist in a region, but don't have a regional *requirement*
# If a laser is activated, you don't need to physically walk up to it for it to count
# As such, logically, they behave more as if they were part of the "Entry" region
self.ALL_REGIONS_BY_NAME["Entry"]["panels"].append(check_hex)
self.ALL_REGIONS_BY_NAME["Entry"]["panels"].append(entity_hex)
continue

required_item_lambda = line_split.pop(0)
Expand Down Expand Up @@ -143,24 +143,24 @@ def read_logic_file(self, lines):

eps_ints = {int(h, 16) for h in eps}

self.OBELISK_SIDE_ID_TO_EP_HEXES[int(check_hex, 16)] = eps_ints
self.OBELISK_SIDE_ID_TO_EP_HEXES[int(entity_hex, 16)] = eps_ints
for ep_hex in eps:
self.EP_TO_OBELISK_SIDE[ep_hex] = check_hex
self.EP_TO_OBELISK_SIDE[ep_hex] = entity_hex

self.ENTITIES_BY_HEX[check_hex] = {
self.ENTITIES_BY_HEX[entity_hex] = {
"checkName": full_entity_name,
"checkHex": check_hex,
"entity_hex": entity_hex,
"region": current_region,
"id": int(location_id),
"entityType": location_type
}

self.ENTITY_ID_TO_NAME[check_hex] = full_entity_name
self.ENTITY_ID_TO_NAME[entity_hex] = full_entity_name

self.ENTITIES_BY_NAME[self.ENTITIES_BY_HEX[check_hex]["checkName"]] = self.ENTITIES_BY_HEX[check_hex]
self.STATIC_DEPENDENT_REQUIREMENTS_BY_HEX[check_hex] = requirement
self.ENTITIES_BY_NAME[self.ENTITIES_BY_HEX[entity_hex]["checkName"]] = self.ENTITIES_BY_HEX[entity_hex]
self.STATIC_DEPENDENT_REQUIREMENTS_BY_HEX[entity_hex] = requirement

current_region["panels"].append(check_hex)
current_region["panels"].append(entity_hex)

def __init__(self, lines=None):
if lines is None:
Expand Down

0 comments on commit cb7a384

Please sign in to comment.