bitburner-official / bitburner-src

Bitburner source code.
Other
837 stars 273 forks source link

BLADEBURNER: Change sleeveSize from property to getter #1746

Closed catloversg closed 2 weeks ago

catloversg commented 3 weeks ago

I have seen at least 3 reports about weird bugs in Bladeburner. All of them are caused by wrong sleeveSize.

sleeveSize is the number of Sleeves doing SleeveSupportWork. It's used in 2 places:

When a sleeve is assigned this task, sleeveSize is increased by 1. When that sleeve is assigned another task, sleeveSize is decreased by 1. At any moment, sleeveSize is just Player.sleevesSupportingBladeburner().length. In those reports, sleeveSize value is always wrong. There is even a report with 2-digit sleeveSize.

I have not found the root cause of this bug. When it happens, the player usually cannot recruit team members anymore. This PR mitigates this problem by calculating sleeveSize when it's needed. Reasons:

How to test:

Attached save file: bitburnerSave_1730536908_BN10x3.json.gz

d0sboots commented 2 weeks ago

Awesome. Exactly the kind of bugfix I love to see.