Example #1
0
        public static void Postfix(PawnPath __result, TraverseParms traverseParms, LocalTargetInfo dest)
        {
            if (__result != PawnPath.NotFound)
            {
                return;
            }
            if (traverseParms.pawn == null)
            {
                return;
            }
            var key = GetKey(traverseParms, dest);

            if (cache.TryGetValue(key, out var store) && GenTicks.TicksGame - store.second < 2500)
            {
                if (store.first > MAX_FAILS)
                {
                    cache.Remove(key);
                    traverseParms.pawn.Map?.reachability?.cache?.ClearFor(traverseParms.pawn);
                    LockConfig.Notify_Dirty();
                }
                else
                {
                    store.first += 1;
                    store.second = GenTicks.TicksGame;
                    cache[key]   = store;
                }
                return;
            }
            cache[key] = new Pair <int, int>(1, GenTicks.TicksGame);
        }
 public static void Postfix(CompAssignableToPawn __instance)
 {
     if (__instance?.parent?.def?.IsBed ?? false)
     {
         __instance.parent.Map?.reachability?.ClearCache();
         LockConfig.Notify_Dirty();
     }
 }
Example #3
0
 public static void Prefix(Building_Bed __instance)
 {
     __instance.Map?.reachability?.cache?.Clear();
     LockConfig.Notify_Dirty();
 }
Example #4
0
 public static void Prefix(Pawn_Ownership __instance)
 {
     __instance?.pawn?.Map?.reachability?.ClearCache();
     LockConfig.Notify_Dirty();
 }
Example #5
0
 public static void Postfix(Map map)
 {
     map?.reachability?.cache?.Clear();
     LockConfig.Notify_Dirty();
 }