예제 #1
0
 public static void Postfix(IntVec3 c, RoofDef def)
 {
     if (def == null)
     {
         DesignatorMoveBase.SetNoRoofFalse(c);
     }
 }
예제 #2
0
 public static void Postfix(IntVec3 c, RoofDef def)
 {
     if (def == null && Current.ProgramState == ProgramState.Playing)
     {
         DesignatorMoveBase.SetNoRoofFalse(c);
     }
 }
예제 #3
0
 public static void PostfixTryReplaceWithSolidThing(Thing createdThing)
 {
     if (createdThing is Building building && building.def.holdsRoof)
     {
         DesignatorMoveBase.RemoveBuildingFromCache(building);
     }
 }
 public static void Postfix(Designation __instance)
 {
     if (__instance.def == MoveBaseDefOf.MoveBase && __instance.target.Thing != null)
     {
         DesignatorMoveBase.Notify_Removing_Callback(__instance.target.Thing);
         InstallBlueprintUtility.CancelBlueprintsFor(__instance.target.Thing);
     }
 }
예제 #5
0
        public override void ExposeData()
        {
            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                DesignatorMoveBase.ClearCache();
                _lastUpdateTick = 0;
            }

            DesignatorMoveBase.ExposeData();
        }
예제 #6
0
 public static void DesignateThingPrefix(Designator __instance, Thing t)
 {
     if (__instance is Designator_Cancel cancel)
     {
         if (t.MapHeld.designationManager.DesignationOn(t, MoveBaseDefOf.MoveBase) != null)
         {
             DesignatorMoveBase.Notify_Removing_Callback(t);
             InstallBlueprintUtility.CancelBlueprintsFor(t);
         }
     }
 }
예제 #7
0
 public static void DesignateSingleCellPrefix(Designator __instance, IntVec3 c)
 {
     if (__instance is Designator_Cancel cancel)
     {
         foreach (Thing thing in c.GetThingList(__instance.Map))
         {
             if (thing.MapHeld.designationManager.DesignationOn(thing, MoveBaseDefOf.MoveBase) != null)
             {
                 DesignatorMoveBase.Notify_Removing_Callback(thing);
                 InstallBlueprintUtility.CancelBlueprintsFor(thing);
             }
         }
     }
 }
예제 #8
0
        public override void GameComponentTick()
        {
            base.GameComponentTick();
            if (_lastUpdateTick + UpdateInterval > Current.Game.tickManager.TicksGame)
            {
                return;
            }
            else
            {
                DesignatorMoveBase.PlaceWaitingBuildings();

                _lastUpdateTick += UpdateInterval;
                PerfProfile.OutputLog();
            }
        }
예제 #9
0
        /// <summary>
        /// Postfix method.
        /// </summary>
        /// <param name="t"></param>
        /// <param name="forced"></param>
        /// <param name="__result"></param>
        public static void Postfix(Thing t, bool forced, ref Job __result)
        {
            if (t is Blueprint_Install install && install.MiniToInstallOrBuildingToReinstall is Building building && building.def.holdsRoof)
            {
                if (forced)
                {
                    DesignatorMoveBase.AddBeingReinstalledBuilding(building);
                    return;
                }

                if (building.MapHeld.designationManager.DesignationOn(building, MoveBaseDefOf.MoveBase) != null)
                {
                    bool canRemove = true;
                    HashSet <IntVec3> roofInRange           = building.RoofInRange();
                    List <Building>   buildingsBeingRemoved = DesignatorMoveBase.GetBuildingsBeingReinstalled(building).Concat(building).ToList();
                    foreach (IntVec3 roof in roofInRange)
                    {
                        if (!roof.IsSupported(building.MapHeld, buildingsBeingRemoved))
                        {
                            building.MapHeld.areaManager.NoRoof[roof]    = true;
                            building.MapHeld.areaManager.BuildRoof[roof] = false;
                            DesignatorMoveBase.AddToRoofToRemove(roof, building);
                            canRemove = false;
                        }
                    }

                    if (canRemove)
                    {
                        DesignatorMoveBase.AddBeingReinstalledBuilding(building);
                    }
                    else
                    {
                        __result = null;
                    }
                }
            }
        }
 public static void Postfix(JobDriver_Uninstall __instance)
 {
     DesignatorMoveBase.UninstallJobCallback((Building)_building.GetValue(__instance), __instance.pawn.MapHeld);
 }