SinguloStation13 / SinguloStation13-Archived

GNU Affero General Public License v3.0
3 stars 12 forks source link

[BUG] Rapid cable layers can be overfilled #83

Open KubeRoot opened 3 years ago

KubeRoot commented 3 years ago

Reproduction:

Get an empty rapid cable layer. Create a stack of over 90 cables. Put the cables into the rapid cable layer. The rapid cable layer will accept all the cables, despite only having 90 capacity.

Additional notes:

Cable stack size was previously raised from 30, which is below any RCL capacity, to 300. This might be related to the issue.

Likely figured out the issue:

        if(!loaded)
            if(!user.transferItemToLoc(W, src))
                to_chat(user, "<span class='warning'>[src] is stuck to your hand!</span>")
                return
            else
                loaded = W //W.loc is src at this point.
                loaded.max_amount = max_amount //We store a lot.
                return

If there is no cable in the RCL, it moves the whole cable stack into the RCL and sets its capacity to the RCL capacity. But because the cable can actually already have more capacity than the RCL, leading the action to creating an over-capacity cable stack being stored in the RCL.

Urumasi commented 3 years ago

Potential fix is to increase the limit of RCLs similar to cable coils to 900

Laboredih123 commented 3 years ago

bruh this wasnt closed