Example #1
0
 public static void Child_tenMinuteUpdate_Postfix(Child __instance)
 {
     try
     {
         if (Game1.IsMasterGame && __instance.Age == 3 && Game1.timeOfDay == 1900)
         {
             __instance.IsWalkingInSquare = false;
             __instance.Halt();
             FarmHouse farmHouse = __instance.currentLocation as FarmHouse;
             if (farmHouse.characters.Contains(__instance))
             {
                 __instance.controller = new PathFindController(__instance, farmHouse, Misc.getChildBed(farmHouse, __instance.Name), -1, new PathFindController.endBehavior(__instance.toddlerReachedDestination));
                 if (__instance.controller.pathToEndPoint == null || !farmHouse.isTileOnMap(__instance.controller.pathToEndPoint.Last <Point>().X, __instance.controller.pathToEndPoint.Last <Point>().Y))
                 {
                     __instance.controller = null;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Monitor.Log($"Failed in {nameof(Child_tenMinuteUpdate_Postfix)}:\n{ex}", LogLevel.Error);
     }
 }