LandfillSiteAI
阅读
2023-11-30更新
最新编辑:Lu_23333
阅读:
更新日期:2023-11-30
最新编辑:Lu_23333
LandfillSiteAI is a class extending PlayerBuildingAI representing garbage collection buildings.
Behaviour
Fill state
The current fill state of the landfill is calculated like so
int garbageCount = (int) buildingData.m_customBuffer1 * 1000 + (int) buildingData.m_garbageBuffer; bool full = (garbageCount >= this.m_garbageCapacity);
And is set like so
data.m_customBuffer1 = (ushort) (garbageCount / 1000); data.m_garbageBuffer = (ushort) (garbageCount - (int) data.m_customBuffer1 * 1000);
Collecting garbage
The ProduceGoods method lists transfer offers for garbage collection. As you can see the Priority is based on the number of owned vehicles with a transfer type of TransferReason.Garbage
Singleton<TransferManager>.instance.AddIncomingOffer( TransferManager.TransferReason.Garbage, new TransferManager.TransferOffer() { Priority = 2 - ownedGarbageTruckCount, Building = buildingID, Position = buildingData.m_position, Amount = 1, Active = true } );