Clean up residual construction materials after construction complete
Closed this issue · 10 comments
Is this literally just doing a building.resources = {}
when building is complete in tickTile
?
Or is there more to it.
It's not that simple :-)
The problem is, when the building finishes construction, there might be resources being transported to the building, which will arrive after the building finishes.
So a better place to look is why more than needed resources are being transported?
I feel like this should not set completed = false;
// Will be full
if (amountArrived + getAmountInTransit(xy, res, gs) >= amount) {
completed = false;
// continue;
return false;
}
I would have thought if it will be full then it will be completed.
CivIdle/shared/logic/Update.ts
Line 209 in 443b62a
Actually ignore that, otherwise it will complete the building below, when resources are still in transit.
Instead of a boolean, it should be an enum and a small state machine:
State = { Transporting, Completing, Completed }
Will this code change with New Construction/Upgrade Flow
in 0.3.0? If not I can have a play around with this and try and get it so only the needed amount are transported.
No. This should be a simple fix - I can fix it in the next build - if you want to double check whether my fix is good :-)
I can, but actually thinking about it.
The call to transportResource
passes in builderCapacityPerResource
, I think it's the first one, should this value not be less if the amount left to transport is less then buildingCapacityPerResource
I can, but actually thinking about it.
The call to
transportResource
passes inbuilderCapacityPerResource
, I think it's the first one, should this value not be less if the amount left to transport is less thenbuildingCapacityPerResource
Does this fix look good to you? 3307990
That looks good to me 👍