def build_stone_workshop(name: str, components: List[Component]) -> Building: storages = stone_workshop_storages() components = components + stone_workshop_components(storages) workshop = Building("{name}'s stone workshop".format(name=name), storages) for component in components: workshop.components.add(component) return workshop
def build_brewery(name: str, components: List[Component]) -> Building: storages = brewery_storages() components = components + brewery_components(storages) brewery = Building("{name}'s brewery".format(name=name), storages) for component in components: brewery.components.add(component) return brewery
def build_warehouse(name: str, components: List[Component]) -> Building: storages: ResourceStoragesType = { Lumber: ResourceStorage(True, True, 50, 0), Stone: ResourceStorage(True, True, 50, 0), StoneSlab: ResourceStorage(True, True, 10, 0), TreeLog: ResourceStorage(True, True, 50, 0), } storage = Building("{name}'s storage".format(name=name), storages) return storage
def build_tavern(name: str, components: List[Component]) -> Building: storages = tavern_storages() # shop_items: Dict[Type[Resource], ResourceStorage] = { # Beer: tavern_storages[Beer], # Bread: tavern_storages[Bread], # Soup: tavern_storages[Soup] # } tavern = Building("{name}'s tavern".format(name=name), storages) components = components + tavern_components(storages) for component in components: tavern.components.add(component) return tavern
def build_construction_site(spec: ConstructionSpec, components: List[tuple], position: tuple) -> Building: storages: ResourceStoragesType = {} for resource, quantity in spec.construction_resources.items(): storages[resource] = ResourceStorage(True, False, quantity) construction_site = Building( spec.name, storages, ) construction_site.components.add(position) construction_site.components.add((Construction, spec)) return construction_site
def build_sawmill(name: str, components: List[tuple]) -> Building: sawmill_storages = { TreeLog: ResourceStorage(True, False, 10), Lumber: ResourceStorage(False, True, 50), } sawmill_pipelines: List[Pipeline] = [ Pipeline([PipelineInput(1, TreeLog, sawmill_storages[TreeLog])], PipelineOutput(5, Lumber, sawmill_storages[Lumber]), 2) ] sawmill = Building("{name}'s Sawmill".format(name=name), sawmill_storages) for component in components: sawmill.components.add(component) sawmill.components.add((Factory, sawmill_pipelines, 1)) return sawmill
def build_pig_farm(name: str, components: List[Component]) -> Building: farm_storages = { Pig: ResourceStorage(False, True, 2), Vegetables: ResourceStorage(True, False, 2), Wheat: ResourceStorage(True, False, 5) } farm_pipelines: List[Pipeline] = [ Pipeline([ PipelineInput(2, Wheat, farm_storages[Wheat]), PipelineInput(1, Vegetables, farm_storages[Vegetables]) ], PipelineOutput(1, Pig, farm_storages[Pig]), 100) ] farm = Building("{name}'s pig farm", farm_storages) for component in components: farm.components.add(component) farm.components.add((Factory, farm_pipelines, 1)) return farm
def build_farm(name: str, components: List[Component]) -> Building: farm_storages = { Honey: ResourceStorage(False, True, 5), Vegetables: ResourceStorage(False, True, 5), Wheat: ResourceStorage(False, True, 20), } farm_pipelines: List[Pipeline] = [ Pipeline([], PipelineOutput(1, Wheat, farm_storages[Wheat]), 25), Pipeline([], PipelineOutput(1, Honey, farm_storages[Honey]), 10), Pipeline([], PipelineOutput(1, Vegetables, farm_storages[Vegetables]), 20) ] farm = Building("{name}'s farm", farm_storages) for component in components: farm.components.add(component) farm.components.add((Factory, farm_pipelines, 3)) return farm