private static bool Prefix(Thing __instance, DestroyMode mode)
            {
                MapComponent_MapEvents comp = null;

                if (__instance.Map != null)
                {
                    comp = __instance.Map.GetComponent <MapComponent_MapEvents>();
                }
                else if (__instance.ParentHolder is Thing t && t.Map != null)
                {
                    comp = t.Map.GetComponent <MapComponent_MapEvents>();
                }
                if (comp != null && comp.ToxicDamages.ContainsKey(__instance))
                {
                    //Thing newNest = ThingMaker.MakeThing(ThingDefOf.AIPersonaCore);
                    //GenSpawn.Spawn(newNest, building.Position, building.Map);
                    comp.ToxicDamages.Remove(__instance);
                    comp.ToxicDamagesThings.Remove(__instance);
                    if (PurpleIvyUtils.IsChunkOrMineable(__instance))
                    {
                        comp.ToxicDamagesChunks.Remove(__instance.Position);
                    }
                }
                return(true);
            }
示例#2
0
 public static void Notify_ThingHitPointsChanged(MapComponent_MapEvents comp, Thing b, int oldHitPoints)
 {
     if (comp == null || comp.ToxicDamages == null || !comp.ToxicDamages.ContainsKey(b) ||
         comp.ToxicDamages[b] == oldHitPoints || !b.Spawned)
     {
         return;
     }
     b.Map.mapDrawer.MapMeshDirty(b.Position, MapMeshFlag.Things);
 }