Commit e47aba8
committed
fix: prevent mineral creep infinite loop on insufficient resources
This fix addresses the remaining edge case where mineral creeps would
infinitely loop trying to transfer resources from the terminal when
insufficient amounts (1-4 units) were available.
Changes:
- Update validation threshold from === 0 to < LAB_REACTION_AMOUNT (5)
in both setStatePrepareReactionLab1WithResource and
setStatePrepareReactionLab2WithResource to match room cleanup logic
- Add reaction cleanup in handleWithdrawFromSource to delete
room.memory.reaction when resources are insufficient, preventing
immediate re-setting of the same failed state
- Enhance validation check to also verify resource amount meets
LAB_REACTION_AMOUNT threshold during withdrawal
This ensures consistent validation across all code paths and makes
the system self-healing by clearing invalid reactions immediately.1 parent 686d315 commit e47aba8
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | | - | |
496 | | - | |
| 495 | + | |
| 496 | + | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
498 | 502 | | |
499 | 503 | | |
500 | 504 | | |
| |||
0 commit comments