Skip to content

Commit e5554f8

Browse files
authored
SoE: create regions cleanup and speedup (#2361)
* SoE: create regions cleanup and speedup keep local reference instead of hitting multiworld cache also technically fixes a bug where all locations are in 'menu', not 'ingame' * SoE: somplify region connection
1 parent e87d5d5 commit e5554f8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

worlds/soe/__init__.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,23 @@ def create_regions(self):
224224
max_difficulty = 1 if self.multiworld.difficulty[self.player] == Difficulty.option_easy else 256
225225

226226
# TODO: generate *some* regions from locations' requirements?
227-
r = Region('Menu', self.player, self.multiworld)
228-
r.exits = [Entrance(self.player, 'New Game', r)]
229-
self.multiworld.regions += [r]
227+
menu = Region('Menu', self.player, self.multiworld)
228+
self.multiworld.regions += [menu]
230229

231230
def get_sphere_index(evermizer_loc):
232231
"""Returns 0, 1 or 2 for locations in spheres 1, 2, 3+"""
233232
if len(evermizer_loc.requires) == 1 and evermizer_loc.requires[0][1] != pyevermizer.P_WEAPON:
234233
return 2
235234
return min(2, len(evermizer_loc.requires))
236235

236+
# create ingame region
237+
ingame = Region('Ingame', self.player, self.multiworld)
238+
237239
# group locations into spheres (1, 2, 3+ at index 0, 1, 2)
238240
spheres: typing.Dict[int, typing.Dict[int, typing.List[SoELocation]]] = {}
239241
for loc in _locations:
240242
spheres.setdefault(get_sphere_index(loc), {}).setdefault(loc.type, []).append(
241-
SoELocation(self.player, loc.name, self.location_name_to_id[loc.name], r,
243+
SoELocation(self.player, loc.name, self.location_name_to_id[loc.name], ingame,
242244
loc.difficulty > max_difficulty))
243245

244246
# location balancing data
@@ -280,18 +282,16 @@ def sphere1_blocked_items_rule(item):
280282
late_locations = self.multiworld.random.sample(late_bosses, late_count)
281283

282284
# add locations to the world
283-
r = Region('Ingame', self.player, self.multiworld)
284285
for sphere in spheres.values():
285286
for locations in sphere.values():
286287
for location in locations:
287-
r.locations.append(location)
288+
ingame.locations.append(location)
288289
if location.name in late_locations:
289290
location.progress_type = LocationProgressType.PRIORITY
290291

291-
r.locations.append(SoELocation(self.player, 'Done', None, r))
292-
self.multiworld.regions += [r]
293-
294-
self.multiworld.get_entrance('New Game', self.player).connect(self.multiworld.get_region('Ingame', self.player))
292+
ingame.locations.append(SoELocation(self.player, 'Done', None, ingame))
293+
menu.connect(ingame, "New Game")
294+
self.multiworld.regions += [ingame]
295295

296296
def create_items(self):
297297
# add regular items to the pool

0 commit comments

Comments
 (0)