Factorio: fix accidental removal of fluids from make_balanced_recipe (#754)
This commit is contained in:
		
							parent
							
								
									9ac780102e
								
							
						
					
					
						commit
						2f53972c85
					
				| 
						 | 
					@ -501,6 +501,7 @@ def get_science_pack_pools() -> Dict[str, Set[str]]:
 | 
				
			||||||
item_stack_sizes: Dict[str, int] = items_future.result()
 | 
					item_stack_sizes: Dict[str, int] = items_future.result()
 | 
				
			||||||
non_stacking_items: Set[str] = {item for item, stack in item_stack_sizes.items() if stack == 1}
 | 
					non_stacking_items: Set[str] = {item for item, stack in item_stack_sizes.items() if stack == 1}
 | 
				
			||||||
stacking_items: Set[str] = set(item_stack_sizes) - non_stacking_items
 | 
					stacking_items: Set[str] = set(item_stack_sizes) - non_stacking_items
 | 
				
			||||||
 | 
					valid_ingredients: Set[str] = stacking_items | fluids
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# cleanup async helpers
 | 
					# cleanup async helpers
 | 
				
			||||||
pool.shutdown()
 | 
					pool.shutdown()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ from .Technologies import base_tech_table, recipe_sources, base_technology_table
 | 
				
			||||||
    all_ingredient_names, all_product_sources, required_technologies, get_rocket_requirements, \
 | 
					    all_ingredient_names, all_product_sources, required_technologies, get_rocket_requirements, \
 | 
				
			||||||
    progressive_technology_table, common_tech_table, tech_to_progressive_lookup, progressive_tech_table, \
 | 
					    progressive_technology_table, common_tech_table, tech_to_progressive_lookup, progressive_tech_table, \
 | 
				
			||||||
    get_science_pack_pools, Recipe, recipes, technology_table, tech_table, factorio_base_id, useless_technologies, \
 | 
					    get_science_pack_pools, Recipe, recipes, technology_table, tech_table, factorio_base_id, useless_technologies, \
 | 
				
			||||||
    fluids, stacking_items
 | 
					    fluids, stacking_items, valid_ingredients
 | 
				
			||||||
from .Shapes import get_shapes
 | 
					from .Shapes import get_shapes
 | 
				
			||||||
from .Mod import generate_mod
 | 
					from .Mod import generate_mod
 | 
				
			||||||
from .Options import factorio_options, MaxSciencePack, Silo, Satellite, TechTreeInformation, Goal
 | 
					from .Options import factorio_options, MaxSciencePack, Silo, Satellite, TechTreeInformation, Goal
 | 
				
			||||||
| 
						 | 
					@ -231,7 +231,7 @@ class Factorio(World):
 | 
				
			||||||
        """Generate a recipe from pool with time and cost similar to original * factor"""
 | 
					        """Generate a recipe from pool with time and cost similar to original * factor"""
 | 
				
			||||||
        new_ingredients = {}
 | 
					        new_ingredients = {}
 | 
				
			||||||
        # have to first sort for determinism, while filtering out non-stacking items
 | 
					        # have to first sort for determinism, while filtering out non-stacking items
 | 
				
			||||||
        pool: typing.List[str] = sorted(pool & stacking_items)
 | 
					        pool: typing.List[str] = sorted(pool & valid_ingredients)
 | 
				
			||||||
        # then sort with random data to shuffle
 | 
					        # then sort with random data to shuffle
 | 
				
			||||||
        self.world.random.shuffle(pool)
 | 
					        self.world.random.shuffle(pool)
 | 
				
			||||||
        target_raw = int(sum((count for ingredient, count in original.base_cost.items())) * factor)
 | 
					        target_raw = int(sum((count for ingredient, count in original.base_cost.items())) * factor)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue