예제 #1
0
 public static void RegisterInRegions(Thing thing, Map map)
 {
     if (!ListerThings.EverListable(thing.def, ListerThingsUse.Region))
     {
         return;
     }
     GetTouchableRegions(thing, map, tmpRegions);
     for (int i = 0; i < tmpRegions.Count; i++)
     {
         ListerThings listerThings = tmpRegions[i].ListerThings;
         if (!listerThings.Contains(thing))
         {
             listerThings.Add(thing);
         }
     }
     tmpRegions.Clear();
 }
예제 #2
0
 public static void DeregisterInRegions(Thing thing, Map map)
 {
     if (!ListerThings.EverListable(thing.def, ListerThingsUse.Region))
     {
         return;
     }
     GetTouchableRegions(thing, map, tmpRegions, allowAdjacentEvenIfCantTouch: true);
     for (int i = 0; i < tmpRegions.Count; i++)
     {
         ListerThings listerThings = tmpRegions[i].ListerThings;
         if (listerThings.Contains(thing))
         {
             listerThings.Remove(thing);
         }
     }
     tmpRegions.Clear();
 }
        public static void RegisterInRegions(Thing thing, Map map)
        {
            ThingDef def = thing.def;

            if (ListerThings.EverListable(def, ListerThingsUse.Region))
            {
                RegionListersUpdater.GetTouchableRegions(thing, map, RegionListersUpdater.tmpRegions, false);
                for (int i = 0; i < RegionListersUpdater.tmpRegions.Count; i++)
                {
                    ListerThings listerThings = RegionListersUpdater.tmpRegions[i].ListerThings;
                    if (!listerThings.Contains(thing))
                    {
                        listerThings.Add(thing);
                    }
                }
            }
        }
예제 #4
0
        public static void DeregisterInRegions(Thing thing, Map map)
        {
            ThingDef def = thing.def;

            if (!ListerThings.EverListable(def, ListerThingsUse.Region))
            {
                return;
            }
            RegionListersUpdater.GetTouchableRegions(thing, map, RegionListersUpdater.tmpRegions, true);
            for (int i = 0; i < RegionListersUpdater.tmpRegions.Count; i++)
            {
                ListerThings listerThings = RegionListersUpdater.tmpRegions[i].ListerThings;
                if (listerThings.Contains(thing))
                {
                    listerThings.Remove(thing);
                }
            }
            RegionListersUpdater.tmpRegions.Clear();
        }