-
Notifications
You must be signed in to change notification settings - Fork 91
[Fix in #1039] Reloading a weapon does not update its weight/bulk values. #937
Comments
A simmilar issue occurs when unloading a weapon as well. The previously loaded ammo is added to the inventory, but its bulk/mass from being loaded in the gun remains until the inventory is altered again. |
The issue suggests that there's a missing CompInventory.UpdateInventory call in CompAmmoUser.LoadAmmo: LoadAmmo considers the case of ammo == null (unloading) without any calls to UpdateInventory. So, a fix would be to add "if (CompInventory != null) CompInventory.UpdateInventory();". |
Further inspection:
An alternative way to fix this issue is to have a statworker for both mass and bulk, which takes into consideration loaded bullets. This way, loaded guns are heavier also in caravans. This is the desired change:
The issue with such a change is that if there's other mods with custom StatWorker for Mass or Bulk, they are not accounted for properly. Perhaps there's an alternative way to update these stats on a Thing level. |
- CE_StatsReport_LoadedAmmo added to language keys (needs translation) - Stats.xml patched to add CombatExtended.StatPart_LoadedAmmo to Mass stat - Added file StatPart_LoadedAmmo - CompAmmoUser now immediately calls UpdateInventory WHENEVER CurMagCount is changed, as it should be - CompInventory stopped looking at loaded ammo for weight/bulk - StatPart_LoadedAmmo was added, which does everything previously done in CompInventory, but which is common in current RimWorld versions
Issue to be resolved:
|
- CE_StatsReport_LoadedAmmo added to language keys (needs translation) - Stats.xml patched to add CombatExtended.StatPart_LoadedAmmo to Mass stat - Added file StatPart_LoadedAmmo - CompAmmoUser now immediately calls UpdateInventory WHENEVER CurMagCount is changed, as it should be - CompInventory stopped looking at loaded ammo for weight/bulk - StatPart_LoadedAmmo was added, which does everything previously done in CompInventory, but which is common in current RimWorld versions - Bulk StatDef now uses StatPart_LoadedAmmo - AmmoUser CompProperties include a loadedAmmoBulkFactor with default value 0f. This allows RPG-7 and similar weapons to have a higher bulkiness (volume) when loaded. - StatPart_LoadedAmmo multiplies by loadedAmmoBulkFactor when parentStat is Bulk
Fix #937 (loaded ammo has weight/bulk update properly)
When reloading a weapon, the ammo's mass/bulk that is loaded into the gun is not accounted for after the reload, until the inventory is altered again (e.g. picking up/dropping a item, shooting a weapon, equipping a different weapon.)
The text was updated successfully, but these errors were encountered: