public void ScheduleReplacement(CompAutoReplaceable replaceableComp)
        {
            var building = replaceableComp.parent;

            if (building?.def == null)
            {
                return;
            }
            if ((building.Stuff == null && building.def.MadeFromStuff) || (building.Stuff != null && !building.def.MadeFromStuff))
            {
                RemoteTechController.Instance.Logger.Warning("Could not schedule {0} auto-replacement due to Stuff discrepancy.", building);
                return;
            }
            var report = GenConstruct.CanPlaceBlueprintAt(building.def, replaceableComp.ParentPosition, replaceableComp.ParentRotation, map);

            if (!report.Accepted)
            {
                RemoteTechController.Instance.Logger.Message($"Could not auto-replace {building.LabelCap}: {report.Reason}");
                return;
            }
            var blueprint = GenConstruct.PlaceBlueprintForBuild(building.def, replaceableComp.ParentPosition, map, replaceableComp.ParentRotation, Faction.OfPlayer, building.Stuff);
            var entry     = new ReplacementEntry {
                position     = replaceableComp.ParentPosition,
                unforbidTick = Find.TickManager.TicksGame + RemoteTechController.Instance.BlueprintForbidDuration * GenTicks.TicksPerRealSecond,
                savedVars    = new Dictionary <string, string>()
            };

            InvokeExposableCallbacks(building, entry.savedVars, LoadSaveMode.Saving);
            pendingSettings.Add(entry);
            if (RemoteTechController.Instance.BlueprintForbidDuration > 0)
            {
                blueprint.SetForbidden(true, false);
                pendingForbiddenBlueprints.Add(entry);
            }
        }
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     this.UpdateSwitchDesignation();
     explosiveComp = GetComp <CompCustomExplosive>();
     replaceComp   = GetComp <CompAutoReplaceable>()?.DisableGizmoAutoDisplay();
     channelsComp  = GetComp <CompChannelSelector>()?.Configure(true);
     this.RequireComponent(CustomProps);
     this.RequireComponent(BlinkerData);
     if (!respawningAfterLoad && CustomProps != null)
     {
         var typeShouldAutoArm =
             CustomProps.explosiveType == RemoteExplosiveType.Combat && RemoteTechController.Instance.SettingAutoArmCombat ||
             CustomProps.explosiveType == RemoteExplosiveType.Mining && RemoteTechController.Instance.SettingAutoArmMining ||
             CustomProps.explosiveType == RemoteExplosiveType.Utility && RemoteTechController.Instance.SettingAutoArmUtility;
         var builtFromAutoReplacedBlueprint = replaceComp?.WasAutoReplaced ?? false;
         if (typeShouldAutoArm && !builtFromAutoReplacedBlueprint)
         {
             Arm();
         }
     }
 }