SC2: some cleanup (#532)
* SC2: some cleanup * SC2: some cleanup in client
This commit is contained in:
parent
c93eeb3607
commit
ad99850192
|
@ -126,25 +126,16 @@ async def main():
|
||||||
if ctx.server_task is None:
|
if ctx.server_task is None:
|
||||||
ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop")
|
ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop")
|
||||||
|
|
||||||
input_task = None
|
|
||||||
if gui_enabled:
|
if gui_enabled:
|
||||||
ctx.run_gui()
|
ctx.run_gui()
|
||||||
ctx.run_cli()
|
ctx.run_cli()
|
||||||
|
|
||||||
if sys.stdin:
|
|
||||||
input_task = asyncio.create_task(console_loop(ctx), name="Input")
|
|
||||||
|
|
||||||
await ctx.exit_event.wait()
|
await ctx.exit_event.wait()
|
||||||
|
|
||||||
ctx.server_address = None
|
ctx.server_address = None
|
||||||
ctx.snes_reconnect_address = None
|
ctx.snes_reconnect_address = None
|
||||||
await ctx.shutdown()
|
await ctx.shutdown()
|
||||||
|
|
||||||
if ui_task:
|
|
||||||
await ui_task
|
|
||||||
|
|
||||||
if input_task:
|
|
||||||
input_task.cancel()
|
|
||||||
|
|
||||||
maps_table = ["ap_traynor01", "ap_traynor02", "ap_traynor03", "ap_thanson01", "ap_thanson02", "ap_thanson03a", "ap_thanson03b", "ap_ttychus01",
|
maps_table = ["ap_traynor01", "ap_traynor02", "ap_traynor03", "ap_thanson01", "ap_thanson02", "ap_thanson03a", "ap_thanson03b", "ap_ttychus01",
|
||||||
"ap_ttychus02", "ap_ttychus03", "ap_ttychus04", "ap_ttychus05", "ap_ttosh01", "ap_ttosh02", "ap_ttosh03a", "ap_ttosh03b",
|
"ap_ttychus02", "ap_ttychus03", "ap_ttychus04", "ap_ttychus05", "ap_ttosh01", "ap_ttosh02", "ap_ttosh03a", "ap_ttosh03b",
|
||||||
|
|
|
@ -41,9 +41,6 @@ class SC2WoLWorld(World):
|
||||||
locked_locations: typing.List[str]
|
locked_locations: typing.List[str]
|
||||||
location_cache: typing.List[Location]
|
location_cache: typing.List[Location]
|
||||||
|
|
||||||
def _get_sc2wol_data(self):
|
|
||||||
return {}
|
|
||||||
|
|
||||||
def __init__(self, world: MultiWorld, player: int):
|
def __init__(self, world: MultiWorld, player: int):
|
||||||
super(SC2WoLWorld, self).__init__(world, player)
|
super(SC2WoLWorld, self).__init__(world, player)
|
||||||
self.location_cache = []
|
self.location_cache = []
|
||||||
|
@ -51,7 +48,7 @@ class SC2WoLWorld(World):
|
||||||
|
|
||||||
def _create_items(self, name: str):
|
def _create_items(self, name: str):
|
||||||
data = get_full_item_list()[name]
|
data = get_full_item_list()[name]
|
||||||
return [self.create_item(name)] * data.quantity
|
return [self.create_item(name) for _ in range(data.quantity)]
|
||||||
|
|
||||||
def create_item(self, name: str) -> Item:
|
def create_item(self, name: str) -> Item:
|
||||||
data = get_full_item_list()[name]
|
data = get_full_item_list()[name]
|
||||||
|
@ -59,7 +56,7 @@ class SC2WoLWorld(World):
|
||||||
|
|
||||||
def create_regions(self):
|
def create_regions(self):
|
||||||
create_regions(self.world, self.player, get_locations(self.world, self.player),
|
create_regions(self.world, self.player, get_locations(self.world, self.player),
|
||||||
self.location_cache)
|
self.location_cache)
|
||||||
|
|
||||||
def generate_basic(self):
|
def generate_basic(self):
|
||||||
excluded_items = get_excluded_items(self, self.world, self.player)
|
excluded_items = get_excluded_items(self, self.world, self.player)
|
||||||
|
@ -81,10 +78,10 @@ class SC2WoLWorld(World):
|
||||||
return self.world.random.choice(filler_items)
|
return self.world.random.choice(filler_items)
|
||||||
|
|
||||||
def fill_slot_data(self):
|
def fill_slot_data(self):
|
||||||
slot_data = self._get_sc2wol_data()
|
slot_data = {}
|
||||||
for option_name in sc2wol_options:
|
for option_name in sc2wol_options:
|
||||||
option = getattr(self.world, option_name)[self.player]
|
option = getattr(self.world, option_name)[self.player]
|
||||||
if slot_data.get(option_name, None) is None and type(option.value) in {str, int}:
|
if type(option.value) in {str, int}:
|
||||||
slot_data[option_name] = int(option.value)
|
slot_data[option_name] = int(option.value)
|
||||||
return slot_data
|
return slot_data
|
||||||
|
|
||||||
|
@ -154,6 +151,7 @@ def get_item_pool(world: MultiWorld, player: int, excluded_items: Set[str]) -> L
|
||||||
|
|
||||||
return pool
|
return pool
|
||||||
|
|
||||||
|
|
||||||
def fill_item_pool_with_dummy_items(self: SC2WoLWorld, world: MultiWorld, player: int, locked_locations: List[str],
|
def fill_item_pool_with_dummy_items(self: SC2WoLWorld, world: MultiWorld, player: int, locked_locations: List[str],
|
||||||
location_cache: List[Location], pool: List[Item]):
|
location_cache: List[Location], pool: List[Item]):
|
||||||
for _ in range(len(location_cache) - len(locked_locations) - len(pool)):
|
for _ in range(len(location_cache) - len(locked_locations) - len(pool)):
|
||||||
|
|
Loading…
Reference in New Issue