AutoWorld: add post_fill
LttP: Move ShopSlotFill to post_fill
This commit is contained in:
		
							parent
							
								
									7ba4bfc0d5
								
							
						
					
					
						commit
						baa7992a7a
					
				
							
								
								
									
										6
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										6
									
								
								Main.py
								
								
								
								
							|  | @ -14,7 +14,7 @@ from BaseClasses import MultiWorld, CollectionState, Region, RegionType | ||||||
| from worlds.alttp.Items import item_name_groups | from worlds.alttp.Items import item_name_groups | ||||||
| from worlds.alttp.Regions import lookup_vanilla_location_to_entrance | from worlds.alttp.Regions import lookup_vanilla_location_to_entrance | ||||||
| from Fill import distribute_items_restrictive, flood_items, balance_multiworld_progression, distribute_planned | from Fill import distribute_items_restrictive, flood_items, balance_multiworld_progression, distribute_planned | ||||||
| from worlds.alttp.Shops import ShopSlotFill, SHOP_ID_START, total_shop_slots, FillDisabledShopSlots | from worlds.alttp.Shops import SHOP_ID_START, total_shop_slots, FillDisabledShopSlots | ||||||
| from Utils import output_path, get_options, __version__, version_tuple | from Utils import output_path, get_options, __version__, version_tuple | ||||||
| from worlds.generic.Rules import locality_rules, exclusion_rules | from worlds.generic.Rules import locality_rules, exclusion_rules | ||||||
| from worlds import AutoWorld | from worlds import AutoWorld | ||||||
|  | @ -198,9 +198,7 @@ def main(args, seed=None): | ||||||
|     elif world.algorithm == 'balanced': |     elif world.algorithm == 'balanced': | ||||||
|         distribute_items_restrictive(world) |         distribute_items_restrictive(world) | ||||||
| 
 | 
 | ||||||
|     logger.info("Filling Shop Slots") |     AutoWorld.call_all(world, 'post_fill') | ||||||
| 
 |  | ||||||
|     ShopSlotFill(world) |  | ||||||
| 
 | 
 | ||||||
|     if world.players > 1: |     if world.players > 1: | ||||||
|         balance_multiworld_progression(world) |         balance_multiworld_progression(world) | ||||||
|  |  | ||||||
|  | @ -138,6 +138,9 @@ class World(metaclass=AutoWorldRegister): | ||||||
|         This gets called once per present world type.""" |         This gets called once per present world type.""" | ||||||
|         pass |         pass | ||||||
| 
 | 
 | ||||||
|  |     def post_fill(self): | ||||||
|  |         """Optional Method that is called after regular fill. Can be used to do adjustments before output generation.""" | ||||||
|  | 
 | ||||||
|     def generate_output(self, output_directory: str): |     def generate_output(self, output_directory: str): | ||||||
|         """This method gets called from a threadpool, do not use world.random here. |         """This method gets called from a threadpool, do not use world.random here. | ||||||
|         If you need any last-second randomization, use MultiWorld.slot_seeds[slot] instead.""" |         If you need any last-second randomization, use MultiWorld.slot_seeds[slot] instead.""" | ||||||
|  |  | ||||||
|  | @ -159,6 +159,7 @@ def ShopSlotFill(world): | ||||||
|         shop_slots -= removed |         shop_slots -= removed | ||||||
| 
 | 
 | ||||||
|     if shop_slots: |     if shop_slots: | ||||||
|  |         logger.info("Filling LttP Shop Slots") | ||||||
|         del shop_slots |         del shop_slots | ||||||
| 
 | 
 | ||||||
|         from Fill import swap_location_item |         from Fill import swap_location_item | ||||||
|  |  | ||||||
|  | @ -229,6 +229,10 @@ class ALTTPWorld(World): | ||||||
|         from .Dungeons import fill_dungeons_restrictive |         from .Dungeons import fill_dungeons_restrictive | ||||||
|         fill_dungeons_restrictive(world) |         fill_dungeons_restrictive(world) | ||||||
| 
 | 
 | ||||||
|  |     @classmethod | ||||||
|  |     def stage_post_fill(cls, world): | ||||||
|  |         Shops.ShopSlotFill(world) | ||||||
|  | 
 | ||||||
|     def generate_output(self, output_directory: str): |     def generate_output(self, output_directory: str): | ||||||
|         world = self.world |         world = self.world | ||||||
|         player = self.player |         player = self.player | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue