172 {
173 float baseWeight = GetInventoryAndCargoWeight(forceRecalc);
174 float ammoWeight;
175 float ammoDamage;
176 string bulletTypeName, ammoTypeName;
177
178 int muzzleCount = GetMuzzleCount();
179 #ifdef DEVELOPER
180 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
181 {
182 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
183 data1.
SetCalcDetails(
"TWPN: " + m_ConfigWeight+
"(item weight) + " + baseWeight +
"(contents weight)" );
184 }
185 #endif
186 for (int muzzleIndex = 0; muzzleIndex < muzzleCount; muzzleIndex++)
187 {
188
189 if (!IsChamberEmpty(muzzleIndex))
190 {
191 ammoTypeName = GetChamberAmmoTypeName(muzzleIndex);
192 ammoWeight +=
g_Game.ConfigGetFloat(
string.Format(
"CfgMagazines %1 weight", ammoTypeName));
193
194 #ifdef DEVELOPER
195 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
196 {
197 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
198 data2.
AddCalcDetails(
g_Game.ConfigGetFloat(
"CfgMagazines " + ammoTypeName +
" weight").ToString() +
"(chamber weight)");
199 }
200 #endif
201 }
202
203
204 if (HasInternalMagazine(muzzleIndex))
205 {
206 #ifdef DEVELOPER
207 float debugInternalMagWeight;
208 #endif
209 int cartridgeCount = GetInternalMagazineCartridgeCount(muzzleIndex);
210 for (int cartridgeIndex = 0; cartridgeIndex < cartridgeCount; cartridgeIndex++)
211 {
212 GetInternalMagazineCartridgeInfo(muzzleIndex, cartridgeIndex, ammoDamage, bulletTypeName);
214 #ifdef DEVELOPER
215 debugInternalMagWeight +=
g_Game.ConfigGetFloat(
"CfgMagazines " + ammoTypeName +
" weight");
216 #endif
217 }
218 #ifdef DEVELOPER
219
220 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
221 {
222 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
224 }
225 #endif
226 }
227
228 }
229 return ammoWeight + baseWeight + GetConfigWeightModified();
230 }
Bolt_Base Ammunition_Base
static float GetAmmoWeightByBulletType(string bulletType)
void AddCalcDetails(string details)
void SetCalcDetails(string details)
proto string ToString(bool simple=true)