From 9ba1c913c9cde31ad91ead63df19e7c108ecd5a7 Mon Sep 17 00:00:00 2001
From: OBilo <54061981+Keshash@users.noreply.github.com>
Date: Fri, 20 Feb 2026 02:11:20 +0200
Subject: [PATCH 1/3] Detach worn bulk from normal bulk limit
---
Languages/English/Keyed/BulkAndWeight.xml | 2 +-
.../CombatExtended/Comps/CompInventory.cs | 32 ++++++++++++-------
.../Loadouts/Utility_Loadouts.cs | 3 +-
3 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/Languages/English/Keyed/BulkAndWeight.xml b/Languages/English/Keyed/BulkAndWeight.xml
index 5fd61cc803..d4787c3897 100644
--- a/Languages/English/Keyed/BulkAndWeight.xml
+++ b/Languages/English/Keyed/BulkAndWeight.xml
@@ -14,7 +14,7 @@
drug policy
loadout
Current weight: {1}\nCapacity: {0}\n\nMove speed factor: {2}\nMelee dodge chance factor: {3}\nEncumbrance penalty: {4}
- Current bulk: {1}\nCapacity: {0}\n\nWork speed factor: {2}\nMelee hit chance factor: {3}\nMelee dodge chance factor: {4}
+ Current bulk: {1}\nWorn bulk: {5}\nCapacity: {0}\n\nWork speed factor: {2}\nMelee hit chance factor: {3}\nMelee dodge chance factor: {4}
Current weight: {1}\nBase capacity: {0}\n\nMove speed factor: {2}\nMelee dodge chance factor: {3}\nEncumbrance penalty: {4}
Current bulk: {1}\nBase capacity: {0}\n\nWork speed factor: {2}\nMelee hit chance factor: {3}\nMelee dodge chance factor: {4}
Nothing
diff --git a/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs b/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
index e9e660cba9..ea20b66d9b 100755
--- a/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
+++ b/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
@@ -18,6 +18,7 @@ public class CompInventory : ThingComp
private const int CLEANUPTICKINTERVAL = 2100;
private float currentWeightCached;
private float currentBulkCached;
+ private float currentWornBulkCached;
private List ammoListCached = new List();
private List meleeWeaponListCached = new List();
private List rangedWeaponListCached = new List();
@@ -47,6 +48,15 @@ public float currentBulk
return currentBulkCached;
}
}
+
+ public float currentWornBulk
+ {
+ get
+ {
+ return currentWornBulkCached;
+ }
+ }
+
private float availableWeight
{
get
@@ -97,28 +107,28 @@ public float dodgeChanceFactorWeight
{
get
{
- return MassBulkUtility.DodgeWeightFactor(currentWeight, capacityWeight);
+ return MassBulkUtility.DodgeWeightFactor(currentWeight, capacityWeight) - (1 - MassBulkUtility.DodgeWeightFactor(currentWornBulk, CE_StatDefOf.CarryBulk.defaultBaseValue));
}
}
public float meleeHitChanceFactorBulk
{
get
{
- return MassBulkUtility.HitChanceBulkFactor(currentBulk, capacityBulk);
+ return MassBulkUtility.HitChanceBulkFactor(currentBulk, capacityBulk) - (1 - MassBulkUtility.HitChanceBulkFactor(currentWornBulk, CE_StatDefOf.CarryBulk.defaultBaseValue));
}
}
public float dodgeChanceFactorBulk
{
get
{
- return MassBulkUtility.DodgeChanceFactor(currentBulk, capacityBulk);
+ return MassBulkUtility.DodgeChanceFactor(currentBulk + currentWornBulkCached, capacityBulk) - (1 - MassBulkUtility.DodgeChanceFactor(currentWornBulk, CE_StatDefOf.CarryBulk.defaultBaseValue));
}
}
public float workSpeedFactor
{
get
{
- return MassBulkUtility.WorkSpeedFactor(currentBulk, capacityBulk);
+ return MassBulkUtility.WorkSpeedFactor(currentBulk, capacityBulk) - (1 - MassBulkUtility.WorkSpeedFactor(currentWornBulk, CE_StatDefOf.CarryBulk.defaultBaseValue));
}
}
public float encumberPenalty
@@ -223,6 +233,7 @@ public void UpdateInventory()
return;
}
float newBulk = 0f;
+ float newWornBulk = 0f;
float newWeight = 0f;
// Add equipped weapon
@@ -238,7 +249,7 @@ public void UpdateInventory()
{
float apparelBulk = apparel.GetStatValue(CE_StatDefOf.WornBulk);
float apparelWeight = apparel.GetStatValue(StatDefOf.Mass);
- newBulk += apparelBulk;
+ newWornBulk += apparelBulk;
newWeight += apparelWeight;
if (age > CLEANUPTICKINTERVAL && apparelBulk > 0 && (parentPawn?.Spawned ?? false) && (parentPawn.factionInt?.IsPlayer ?? false))
{
@@ -299,6 +310,7 @@ public void UpdateInventory()
}
}
currentBulkCached = newBulk;
+ currentWornBulkCached = newWornBulk;
currentWeightCached = newWeight;
}
@@ -313,20 +325,18 @@ public void UpdateInventory()
public bool CanFitInInventory(ThingDef thingDef, out int count, bool ignoreEquipment = false, bool useApparelCalculations = false)
{
float thingWeight;
- float thingBulk;
+ float thingBulk = 0f;
if (useApparelCalculations)
{
thingWeight = thingDef.GetStatValueAbstract(StatDefOf.Mass);
- thingBulk = thingDef.GetStatValueAbstract(CE_StatDefOf.WornBulk);
- if (thingWeight <= 0 && thingBulk <= 0)
+ if (thingWeight <= 0)
{
count = 1;
return true;
}
// Subtract the stat offsets we get from wearing this
thingWeight -= thingDef.equippedStatOffsets.GetStatOffsetFromList(CE_StatDefOf.CarryWeight);
- thingBulk -= thingDef.equippedStatOffsets.GetStatOffsetFromList(CE_StatDefOf.CarryBulk);
}
else
{
@@ -360,12 +370,11 @@ public bool CanFitInInventory(ThingDef thingDef, out int count, bool ignoreEquip
public bool CanFitInInventory(Thing thing, out int count, bool ignoreEquipment = false, bool useApparelCalculations = false)
{
float thingWeight;
- float thingBulk;
+ float thingBulk = 0f;
if (useApparelCalculations)
{
thingWeight = thing.GetStatValue(StatDefOf.Mass);
- thingBulk = thing.GetStatValue(CE_StatDefOf.WornBulk);
if (thingWeight <= 0 && thingBulk <= 0)
{
count = 1;
@@ -373,7 +382,6 @@ public bool CanFitInInventory(Thing thing, out int count, bool ignoreEquipment =
}
// Subtract the stat offsets we get from wearing this
thingWeight -= thing.def.equippedStatOffsets.GetStatOffsetFromList(CE_StatDefOf.CarryWeight);
- thingBulk -= thing.def.equippedStatOffsets.GetStatOffsetFromList(CE_StatDefOf.CarryBulk);
}
else
{
diff --git a/Source/CombatExtended/CombatExtended/Loadouts/Utility_Loadouts.cs b/Source/CombatExtended/CombatExtended/Loadouts/Utility_Loadouts.cs
index 82aad6776f..f0c097b0ef 100755
--- a/Source/CombatExtended/CombatExtended/Loadouts/Utility_Loadouts.cs
+++ b/Source/CombatExtended/CombatExtended/Loadouts/Utility_Loadouts.cs
@@ -137,7 +137,8 @@ public static string GetBulkTip(this Pawn pawn)
CE_StatDefOf.CarryBulk.ValueToString(comp.currentBulk, CE_StatDefOf.CarryBulk.toStringNumberSense),
comp.workSpeedFactor.ToStringPercent(),
comp.meleeHitChanceFactorBulk.ToStringPercent(),
- comp.dodgeChanceFactorBulk.ToStringPercent());
+ comp.dodgeChanceFactorBulk.ToStringPercent(),
+ CE_StatDefOf.WornBulk.ValueToString(comp.currentWornBulk));
}
else
{
From 666fd851d63283223786f8c7414d915b69d9dd7c Mon Sep 17 00:00:00 2001
From: OBilo <54061981+Keshash@users.noreply.github.com>
Date: Wed, 25 Feb 2026 13:48:01 +0200
Subject: [PATCH 2/3] reorder tooltip lines
---
Languages/English/Keyed/BulkAndWeight.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Languages/English/Keyed/BulkAndWeight.xml b/Languages/English/Keyed/BulkAndWeight.xml
index d4787c3897..aa306e91fb 100644
--- a/Languages/English/Keyed/BulkAndWeight.xml
+++ b/Languages/English/Keyed/BulkAndWeight.xml
@@ -14,7 +14,7 @@
drug policy
loadout
Current weight: {1}\nCapacity: {0}\n\nMove speed factor: {2}\nMelee dodge chance factor: {3}\nEncumbrance penalty: {4}
- Current bulk: {1}\nWorn bulk: {5}\nCapacity: {0}\n\nWork speed factor: {2}\nMelee hit chance factor: {3}\nMelee dodge chance factor: {4}
+ Current bulk: {1}\nCapacity: {0}\nWorn bulk: {5}\n\nWork speed factor: {2}\nMelee hit chance factor: {3}\nMelee dodge chance factor: {4}
Current weight: {1}\nBase capacity: {0}\n\nMove speed factor: {2}\nMelee dodge chance factor: {3}\nEncumbrance penalty: {4}
Current bulk: {1}\nBase capacity: {0}\n\nWork speed factor: {2}\nMelee hit chance factor: {3}\nMelee dodge chance factor: {4}
Nothing
From 6dc76f9873caa4d17c01817d179bd42b71b65481 Mon Sep 17 00:00:00 2001
From: OBilo <54061981+Keshash@users.noreply.github.com>
Date: Wed, 25 Feb 2026 13:48:05 +0200
Subject: [PATCH 3/3] whitespace
---
Source/CombatExtended/CombatExtended/Comps/CompInventory.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs b/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
index ea20b66d9b..0b78c92206 100755
--- a/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
+++ b/Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
@@ -121,7 +121,7 @@ public float dodgeChanceFactorBulk
{
get
{
- return MassBulkUtility.DodgeChanceFactor(currentBulk + currentWornBulkCached, capacityBulk) - (1 - MassBulkUtility.DodgeChanceFactor(currentWornBulk, CE_StatDefOf.CarryBulk.defaultBaseValue));
+ return MassBulkUtility.DodgeChanceFactor(currentBulk + currentWornBulkCached, capacityBulk) - (1 - MassBulkUtility.DodgeChanceFactor(currentWornBulk, CE_StatDefOf.CarryBulk.defaultBaseValue));
}
}
public float workSpeedFactor