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