nyfrk / Settlers4-Coalfix

A plugin for the settlers 4 that fixes the infamous coal bug.
MIT License
2 stars 1 forks source link

diggers bug #1

Closed Pp-4 closed 2 years ago

Pp-4 commented 2 years ago

sometimes too many diggers are assigned to a new construction, causing them to get stuck on the construction site , happens mostly when constructing small buildings. Bug occurs on history edition , don't know about other versions

nyfrk commented 2 years ago

Thanks for the report. I guess that the first patch imposed by the plugin also tinkers with the diggers in some way. Looks like the diggers get assigned faster to a building than the game can track. We probably have to insert a condition to somehow exclude diggers from the removed delay.

I will have a look into it.

nyfrk commented 2 years ago

I think I found the problem. It is caused by the third patch named "CarrierSiteJobCreation". This does indeed not just affect carriers but also diggers and builders. Therefore the bug probably also affects builders. The "CarrierSiteJobCreation" Patch is invoked per building for as long as it is under construction. The problem is: A digger takes 9 ticks to walk to a neighboring field (and some additional ticks to start working). However, when we assign multiple diggers to the same dig-position, we will run into a problem since settlers will push themselves away whenever a field is about to be occupied twice. The digger/builder does not have enough time to start working on the field. When a settlers works a field it cannot be pushed away by other settlers - which will prevent the push-away situation. However since no worker can start working the field we effectively deny any worker to process the last field.

So, what would be the best fix? We could just remove the patch and increase the delay back to 15 ticks thus being save since it would be greater than the 9 ticks walkspeed and it would be enough time for a digger/builder to start working a field. We could also get deeper into the logic function to differentiate between builders, diggers or carriers while the building is under construction - selectively applying the patch for carriers only or as long as there is enough fields to be worked on.

The bug does not occur anymore in version 1.6.