def test_ticket_979(s, p): settlement, island = settle(s) storage_collectors = settlement.branch_office.get_local_collectors() farm = _build_farm(30, 30, BUILDINGS.POTATO_FIELD_CLASS, island, settlement, p) # Let it work for a bit s.run(seconds=60) assert farm.inventory[RES.FOOD_ID] # The settlement inventory is already full of food (from the ship): dispose of it assert settlement.inventory[RES.FOOD_ID] > 0 settlement.inventory.alter(RES.FOOD_ID, -settlement.inventory[RES.FOOD_ID]) assert settlement.inventory[RES.FOOD_ID] == 0 # Build a road, connecting farm and branch office for y in range(23, 30): assert Build(BUILDINGS.TRAIL_CLASS, 30, y, island, settlement=settlement)(p) # Step forward in time until a collector picked a job got_job = False while not got_job: s.run() if any(c.job for c in storage_collectors): got_job = True Tear(farm)(p) # Let the collector reach the not existing target s.run(seconds=10)
def test_ticket_979(s, p): settlement, island = settle(s) storage_collectors = settlement.warehouse.get_component(CollectingComponent).get_local_collectors() farm = _build_farm(30, 30, BUILDINGS.POTATO_FIELD, island, settlement, p) # Let it work for a bit s.run(seconds=60) assert farm.get_component(StorageComponent).inventory[RES.FOOD] # Depending on auto unloading (which we aren't interested in here), # the settlement inventory may already be full of food: dispose of it settlement.get_component(StorageComponent).inventory.alter(RES.FOOD, -settlement.get_component(StorageComponent).inventory[RES.FOOD]) assert settlement.get_component(StorageComponent).inventory[RES.FOOD] == 0 # Build a road, connecting farm and warehouse for y in range(23, 30): assert Build(BUILDINGS.TRAIL, 30, y, island, settlement=settlement)(p) # Step forward in time until a collector picked a job got_job = False while not got_job: s.run() if any(c.job for c in storage_collectors): got_job = True Tear(farm)(p) # Let the collector reach the not existing target s.run(seconds=10)
def test_ticket_1523(s, p): settlement, island = settle(s) farm = _build_farm(30, 30, BUILDINGS.POTATO_FIELD, island, settlement, p) # Let it work for a bit s.run(seconds=60) assert farm.get_component(StorageComponent).inventory[RES.FOOD] assert isinstance(farm.get_component(Producer)._Producer__utilisation, FieldUtilisation) # Should be 0.5 assert not farm.get_component(Producer).capacity_utilisation_below(0.4) assert farm.get_component(Producer).capacity_utilisation > 0.4
def test_ticket_1016(s, p): settlement, island = settle(s) farm = _build_farm(30, 30, BUILDINGS.POTATO_FIELD_CLASS, island, settlement, p) # tear down job target, then home building (in the same tick) torn_down = False while not torn_down: s.run(seconds=1) for col in farm._CollectingBuilding__collectors: if col.job: Tear(col.job.object)(p) Tear(farm)(p) torn_down = True break s.run(seconds=30)
def test_ticket_1016(s, p): settlement, island = settle(s) farm = _build_farm(30, 30, BUILDINGS.POTATO_FIELD, island, settlement, p) # tear down job target, then home building (in the same tick) torn_down = False while not torn_down: s.run(seconds=1) for col in farm.get_component(CollectingComponent)._CollectingComponent__collectors: if col.job: Tear(col.job.object)(p) Tear(farm)(p) torn_down = True break s.run(seconds=30)