gunplay massive lag / errors during fire
docssy opened this issue · 4 comments
Getting countless log entries like this.
Exception ticking Spark195502 (at (226, 0, 138)): System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary2[TKey,TValue].FindEntry (TKey key) [0x00008] in <567df3e0919241ba98db88bec4c6696f>:0 at System.Collections.Generic.Dictionary
2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
at Verse.GenCollection.TryGetValue[T,V] (System.Collections.Generic.IDictionary`2[TKey,TValue] dict, T key, V fallback) [0x00000] in <36108d57f84d49cabdae818c2a53fc38>:0
at Gunplay.GunplaySetup.GunProp (Verse.ThingDef equipment) [0x00001] in <2f5b41d5bd4342c5aaaf0eb677720897>:0
at Gunplay.Patch.PatchProjectileImpact.Prefix (Verse.Projectile __instance, Verse.Thing hitThing, UnityEngine.Vector3 ___origin) [0x0001b] in <2f5b41d5bd4342c5aaaf0eb677720897>:0
at (wrapper dynamic-method) Verse.Projectile.DMD<DMD<Impact_Patch1>?1628900864::Impact_Patch1>(Verse.Projectile,Verse.Thing)
at RimWorld.Spark.Impact (Verse.Thing hitThing) [0x00007] in <36108d57f84d49cabdae818c2a53fc38>:0
at (wrapper dynamic-method) Verse.Projectile.DMD<DMD<ImpactSomething_Patch1>?-557604736::ImpactSomething_Patch1>(Verse.Projectile)
at Verse.Projectile.Tick () [0x000ed] in <36108d57f84d49cabdae818c2a53fc38>:0
at (wrapper dynamic-method) Verse.TickList.DMD<DMD<Tick_Patch2>?-368684160::Tick_Patch2>(Verse.TickList)
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
Narrowed it down in your source files to this:
In Gunplay/Source/Patch/PatchProjectile.cs
[HarmonyPatch(typeof(Projectile), "Impact")]
class PatchProjectileImpact
{
static void Prefix(Projectile __instance, Thing hitThing, Vector3 ___origin)
{
Map map = __instance.Map;
if (map == null) return;
GunPropDef prop = GunplaySetup.GunProp(__instance.EquipmentDef);
if (prop == null) return;
Basically something related to the fire is calling suppression, as the __instance projectile, but it is null. Maybe doesn't exist, or was just deleted?
Are you sure you're not running one of earlier versions? This was a bug, and it just the same was happening with sparks from EMP explosions, but I did fix it in GunplaySetup.GunProp.
Dunno. Everything looks like its from March 25.
Any way for me to reproduce this in-game?