Core: rename world to multiworld (#931)
				
					
				
			* rename references to `Multiworld` in core to `multiworld` instead of `world` * fix smz3 * fix oot * fix low hanging fruit * revert mysteriously broken spacing in world api.md * fix more randomly broken spacing * hate * that better be all of it * begrudgingly move over smw * ._. * missed some worlds * this is getting tedious now * Missed some self.world definitions Co-authored-by: espeon65536 <espeon65536@gmail.com> Co-authored-by: Zach Parks <zach@alliware.com>
This commit is contained in:
		| @@ -43,8 +43,8 @@ class RaftWorld(World): | ||||
|     required_client_version = (0, 3, 4) | ||||
|  | ||||
|     def generate_basic(self): | ||||
|         minRPSpecified = self.world.minimum_resource_pack_amount[self.player].value | ||||
|         maxRPSpecified = self.world.maximum_resource_pack_amount[self.player].value | ||||
|         minRPSpecified = self.multiworld.minimum_resource_pack_amount[self.player].value | ||||
|         maxRPSpecified = self.multiworld.maximum_resource_pack_amount[self.player].value | ||||
|         minimumResourcePackAmount = min(minRPSpecified, maxRPSpecified) | ||||
|         maximumResourcePackAmount = max(minRPSpecified, maxRPSpecified) | ||||
|         # Generate item pool | ||||
| @@ -56,21 +56,21 @@ class RaftWorld(World): | ||||
|         extraItemNamePool = [] | ||||
|         extras = len(location_table) - len(item_table) - 1 # Victory takes up 1 unaccounted-for slot | ||||
|         if extras > 0: | ||||
|             if (self.world.filler_item_types[self.player].value != 1): # Use resource packs | ||||
|             if (self.multiworld.filler_item_types[self.player].value != 1): # Use resource packs | ||||
|                 for packItem in resourcePackItems: | ||||
|                     for i in range(minimumResourcePackAmount, maximumResourcePackAmount + 1): | ||||
|                         extraItemNamePool.append(createResourcePackName(i, packItem)) | ||||
|  | ||||
|             if self.world.filler_item_types[self.player].value != 0: # Use duplicate items | ||||
|             if self.multiworld.filler_item_types[self.player].value != 0: # Use duplicate items | ||||
|                 dupeItemPool = item_table.copy() | ||||
|                 # Remove frequencies if necessary | ||||
|                 if self.world.island_frequency_locations[self.player].value != 5: # Not completely random locations | ||||
|                 if self.multiworld.island_frequency_locations[self.player].value != 5: # Not completely random locations | ||||
|                     dupeItemPool = (itm for itm in dupeItemPool if "Frequency" not in itm["name"]) | ||||
|                  | ||||
|                 # Remove progression or non-progression items if necessary | ||||
|                 if (self.world.duplicate_items[self.player].value == 0): # Progression only | ||||
|                 if (self.multiworld.duplicate_items[self.player].value == 0): # Progression only | ||||
|                     dupeItemPool = (itm for itm in dupeItemPool if itm["progression"] == True) | ||||
|                 elif (self.world.duplicate_items[self.player].value == 1): # Non-progression only | ||||
|                 elif (self.multiworld.duplicate_items[self.player].value == 1): # Non-progression only | ||||
|                     dupeItemPool = (itm for itm in dupeItemPool if itm["progression"] == False) | ||||
|                  | ||||
|                 dupeItemPool = list(dupeItemPool) | ||||
| @@ -84,23 +84,23 @@ class RaftWorld(World): | ||||
|                     raft_item = self.create_item_replaceAsNecessary(randomItem) | ||||
|                     pool.append(raft_item) | ||||
|  | ||||
|         self.world.itempool += pool | ||||
|         self.multiworld.itempool += pool | ||||
|  | ||||
|     def set_rules(self): | ||||
|         set_rules(self.world, self.player) | ||||
|         set_rules(self.multiworld, self.player) | ||||
|  | ||||
|     def create_regions(self): | ||||
|         create_regions(self.world, self.player) | ||||
|         create_regions(self.multiworld, self.player) | ||||
|      | ||||
|     def get_pre_fill_items(self): | ||||
|         if self.world.island_frequency_locations[self.player] in [0, 1, 2, 3]: | ||||
|             return [loc.item for loc in self.world.get_filled_locations()] | ||||
|         if self.multiworld.island_frequency_locations[self.player] in [0, 1, 2, 3]: | ||||
|             return [loc.item for loc in self.multiworld.get_filled_locations()] | ||||
|         return [] | ||||
|      | ||||
|     def create_item_replaceAsNecessary(self, name: str) -> Item: | ||||
|         isFrequency = "Frequency" in name | ||||
|         shouldUseProgressive = ((isFrequency and self.world.island_frequency_locations[self.player].value == 4) | ||||
|             or (not isFrequency and self.world.progressive_items[self.player].value)) | ||||
|         shouldUseProgressive = ((isFrequency and self.multiworld.island_frequency_locations[self.player].value == 4) | ||||
|             or (not isFrequency and self.multiworld.progressive_items[self.player].value)) | ||||
|         if shouldUseProgressive and name in progressive_table: | ||||
|             name = progressive_table[name] | ||||
|         return self.create_item(name) | ||||
| @@ -128,7 +128,7 @@ class RaftWorld(World): | ||||
|         return super(RaftWorld, self).collect_item(state, item, remove) | ||||
|  | ||||
|     def pre_fill(self): | ||||
|         if self.world.island_frequency_locations[self.player] == 0: | ||||
|         if self.multiworld.island_frequency_locations[self.player] == 0: | ||||
|             self.setLocationItem("Radio Tower Frequency to Vasagatan", "Vasagatan Frequency") | ||||
|             self.setLocationItem("Vasagatan Frequency to Balboa", "Balboa Island Frequency") | ||||
|             self.setLocationItem("Relay Station quest", "Caravan Island Frequency") | ||||
| @@ -136,7 +136,7 @@ class RaftWorld(World): | ||||
|             self.setLocationItem("Tangaroa Frequency to Varuna Point", "Varuna Point Frequency") | ||||
|             self.setLocationItem("Varuna Point Frequency to Temperance", "Temperance Frequency") | ||||
|             self.setLocationItem("Temperance Frequency to Utopia", "Utopia Frequency") | ||||
|         elif self.world.island_frequency_locations[self.player] == 1: | ||||
|         elif self.multiworld.island_frequency_locations[self.player] == 1: | ||||
|             self.setLocationItemFromRegion("RadioTower", "Vasagatan Frequency") | ||||
|             self.setLocationItemFromRegion("Vasagatan", "Balboa Island Frequency") | ||||
|             self.setLocationItemFromRegion("BalboaIsland", "Caravan Island Frequency") | ||||
| @@ -144,7 +144,7 @@ class RaftWorld(World): | ||||
|             self.setLocationItemFromRegion("Tangaroa", "Varuna Point Frequency") | ||||
|             self.setLocationItemFromRegion("Varuna Point", "Temperance Frequency") | ||||
|             self.setLocationItemFromRegion("Temperance", "Utopia Frequency") | ||||
|         elif self.world.island_frequency_locations[self.player] in [2, 3]: | ||||
|         elif self.multiworld.island_frequency_locations[self.player] in [2, 3]: | ||||
|             locationToFrequencyItemMap = { | ||||
|                 "Vasagatan": "Vasagatan Frequency", | ||||
|                 "BalboaIsland": "Balboa Island Frequency", | ||||
| @@ -172,37 +172,37 @@ class RaftWorld(World): | ||||
|                 else: | ||||
|                     currentLocation = availableLocationList[0] # Utopia (only one left in list) | ||||
|                 availableLocationList.remove(currentLocation) | ||||
|                 if self.world.island_frequency_locations[self.player] == 2: | ||||
|                 if self.multiworld.island_frequency_locations[self.player] == 2: | ||||
|                     self.setLocationItem(locationToVanillaFrequencyLocationMap[previousLocation], locationToFrequencyItemMap[currentLocation]) | ||||
|                 elif self.world.island_frequency_locations[self.player] == 3: | ||||
|                 elif self.multiworld.island_frequency_locations[self.player] == 3: | ||||
|                     self.setLocationItemFromRegion(previousLocation, locationToFrequencyItemMap[currentLocation]) | ||||
|                 previousLocation = currentLocation | ||||
|  | ||||
|         # Victory item | ||||
|         self.world.get_location("Utopia Complete", self.player).place_locked_item( | ||||
|         self.multiworld.get_location("Utopia Complete", self.player).place_locked_item( | ||||
|             RaftItem("Victory", ItemClassification.progression, None, player=self.player)) | ||||
|      | ||||
|     def setLocationItem(self, location: str, itemName: str): | ||||
|         itemToUse = next(filter(lambda itm: itm.name == itemName, self.world.itempool)) | ||||
|         self.world.itempool.remove(itemToUse) | ||||
|         self.world.get_location(location, self.player).place_locked_item(itemToUse) | ||||
|         itemToUse = next(filter(lambda itm: itm.name == itemName, self.multiworld.itempool)) | ||||
|         self.multiworld.itempool.remove(itemToUse) | ||||
|         self.multiworld.get_location(location, self.player).place_locked_item(itemToUse) | ||||
|      | ||||
|     def setLocationItemFromRegion(self, region: str, itemName: str): | ||||
|         itemToUse = next(filter(lambda itm: itm.name == itemName, self.world.itempool)) | ||||
|         self.world.itempool.remove(itemToUse) | ||||
|         itemToUse = next(filter(lambda itm: itm.name == itemName, self.multiworld.itempool)) | ||||
|         self.multiworld.itempool.remove(itemToUse) | ||||
|         location = random.choice(list(loc for loc in location_table if loc["region"] == region)) | ||||
|         self.world.get_location(location["name"], self.player).place_locked_item(itemToUse) | ||||
|         self.multiworld.get_location(location["name"], self.player).place_locked_item(itemToUse) | ||||
|      | ||||
|     def fill_slot_data(self): | ||||
|         return { | ||||
|             "IslandGenerationDistance": self.world.island_generation_distance[self.player].value, | ||||
|             "ExpensiveResearch": bool(self.world.expensive_research[self.player].value), | ||||
|             "DeathLink": bool(self.world.death_link[self.player].value) | ||||
|             "IslandGenerationDistance": self.multiworld.island_generation_distance[self.player].value, | ||||
|             "ExpensiveResearch": bool(self.multiworld.expensive_research[self.player].value), | ||||
|             "DeathLink": bool(self.multiworld.death_link[self.player].value) | ||||
|         } | ||||
|  | ||||
| def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None): | ||||
|     ret = Region(name, RegionType.Generic, name, player) | ||||
|     ret.world = world | ||||
|     ret.multiworld = world | ||||
|     if locations: | ||||
|         for location in locations: | ||||
|             loc_id = locations_lookup_name_to_id.get(location, 0) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 alwaysintreble
					alwaysintreble