Vanilla-Expanded / VanillaExpandedFramework

Vanilla Expanded Framework for RimWorld
Other
74 stars 37 forks source link

[PipeSystem] CompConvertToResource ignores pipesystem def transferAmount. #23

Closed Zeracronius closed 1 year ago

Zeracronius commented 1 year ago

CompConvertToResource does not take network capacity into account. This means that it takes the entire stack of items, puts as much of it as it can into the network and then despawns everything deleting all excess. It also doesn't take the network transfer rate into account while despawning items. (PipNetDef.transferAmount)

It does provide a property to fetch network capacity, but it is never used.

https://github.com/Vanilla-Expanded/VanillaExpandedFramework/blob/f7abe05737e4f216ad14198ce6c5489b784f1e1b/Source/PipeSystem/PipeSystem/Comps/CompConvertToResource.cs#L59-L64

Zeracronius commented 1 year ago

Looking and testing this today, i now noticed that the issue with deleting resources have been fixed, but all code was centralised rather then using comps so I never noticed. Though it still ignores the pipesystem.def.transferAmount, so it instantly fills every storage in a single net tick. Potentially, this could be solved with "var resourceCanAdd = Math.Min(resourceToAdd, AvailableCapacity, def.transferAmount)" at https://github.com/Vanilla-Expanded/VanillaExpandedFramework/blob/35e3279edfa363f6ba139dd7605e023cf923f6a8/Source/PipeSystem/PipeSystem/PipeNet.cs#LL539C29-L539C43

KylianB commented 1 year ago

The pipesystem.def.transferAmount field is used for tank transfer rate when they are marked for transfer. I will keep this one for that, but I will add a field to either the PipeNetDef or the comps. I will update the issue when it's done.

KylianB commented 1 year ago

Commit 6da4857 add the convertAmount option to the PipeNetDef, it can be used to specify the amount of things converted to resource each net tick.