// Token: 0x06000013 RID: 19 RVA: 0x0000219C File Offset: 0x0000039C
        public override void Destroy(DestroyMode mode)
        {
            bool spawned = base.Spawned;
            Map  map     = base.Map;

            SmoothableWallUtility.Notify_BuildingDestroying(this, mode);
            base.Destroy(mode);
            InstallBlueprintUtility.CancelBlueprintsFor(this);
            if (mode == DestroyMode.Deconstruct && spawned)
            {
                SoundDefOf.Building_Deconstructed.PlayOneShot(new TargetInfo(base.Position, map, false));
            }
            if (mode == DestroyMode.KillFinalize && spawned)
            {
                ThingDef_MechanoidFigure thingDef_MechanoidFigure = (ThingDef_MechanoidFigure)this.def;
                if (thingDef_MechanoidFigure != null)
                {
                    if (thingDef_MechanoidFigure.soundDestroy != null)
                    {
                        thingDef_MechanoidFigure.soundDestroy.PlayOneShot(new TargetInfo(base.Position, map, false));
                    }
                }
            }
            if (Find.PlaySettings.autoRebuild && mode == DestroyMode.KillFinalize && base.Faction == Faction.OfPlayer && spawned && this.def.blueprintDef != null && this.def.IsResearchFinished && map.areaManager.Home[base.Position] && GenConstruct.CanPlaceBlueprintAt(this.def, base.Position, base.Rotation, map, false, null).Accepted)
            {
                GenConstruct.PlaceBlueprintForBuild(this.def, base.Position, map, base.Rotation, Faction.OfPlayer, base.Stuff);
            }
        }
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            bool spawned = base.Spawned;
            Map  map     = base.Map;

            SmoothableWallUtility.Notify_BuildingDestroying(this, mode);
            this.GetLord()?.Notify_BuildingLost(this);
            base.Destroy(mode);
            InstallBlueprintUtility.CancelBlueprintsFor(this);
            if (spawned)
            {
                switch (mode)
                {
                case DestroyMode.Deconstruct:
                    SoundDefOf.Building_Deconstructed.PlayOneShot(new TargetInfo(base.Position, map));
                    break;

                case DestroyMode.KillFinalize:
                    DoDestroyEffects(map);
                    break;
                }
            }
            if (spawned)
            {
                ThingUtility.CheckAutoRebuildOnDestroyed(this, mode, map, def);
            }
        }
 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);
     }
 }
Beispiel #4
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            Map map = base.Map;

            base.Destroy(mode);
            InstallBlueprintUtility.CancelBlueprintsFor(this);
            if (mode == DestroyMode.Deconstruct)
            {
                SoundDef.Named("BuildingDeconstructed").PlayOneShot(new TargetInfo(base.Position, map, false));
            }
        }
Beispiel #5
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);
         }
     }
 }
Beispiel #6
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);
             }
         }
     }
 }
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            Map map = base.Map;

            SmoothableWallUtility.Notify_BuildingDestroying(this, mode);
            base.Destroy(mode);
            InstallBlueprintUtility.CancelBlueprintsFor(this);
            if (mode == DestroyMode.Deconstruct)
            {
                SoundDefOf.Building_Deconstructed.PlayOneShot(new TargetInfo(base.Position, map, false));
            }
            if (Find.PlaySettings.autoRebuild && mode == DestroyMode.KillFinalize && base.Faction == Faction.OfPlayer && this.def != null && this.def.blueprintDef != null && this.def.IsResearchFinished)
            {
                GenConstruct.PlaceBlueprintForBuild(this.def, base.Position, map, base.Rotation, Faction.OfPlayer, base.Stuff);
            }
        }
Beispiel #8
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            bool spawned = base.Spawned;
            Map  map     = base.Map;

            SmoothableWallUtility.Notify_BuildingDestroying(this, mode);
            base.Destroy(mode);
            InstallBlueprintUtility.CancelBlueprintsFor(this);
            if (mode == DestroyMode.Deconstruct && spawned)
            {
                SoundDefOf.Building_Deconstructed.PlayOneShot(new TargetInfo(base.Position, map, false));
            }
            if (spawned)
            {
                ThingUtility.CheckAutoRebuildOnDestroyed(this, mode, map, this.def);
            }
        }
        //Altered the vanilla Destroy method from Building, so that it allows proper destruction of assets to this turret.
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);
            InstallBlueprintUtility.CancelBlueprintsFor((Thing)this);

            if (!this.selfLight.DestroyedOrNull())
            {
                this.selfLight = null;
            }
            if (!this.searchLight.DestroyedOrNull())
            {
                this.searchLight = null;
            }

            if (mode != DestroyMode.Deconstruct)
            {
                return;
            }
            SoundStarter.PlayOneShot(SoundDef.Named("BuildingDeconstructed"), new TargetInfo(Position, Map, false));
        }
Beispiel #10
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            bool wasSpawned = Spawned;
            var  map        = Map; // before Destroy()!

            // before Destroy(); the math is easier to do here
            SmoothableWallUtility.Notify_BuildingDestroying(this, mode);

            base.Destroy(mode);

            // (buildings can be reinstalled)
            InstallBlueprintUtility.CancelBlueprintsFor(this);

            if (mode == DestroyMode.Deconstruct && wasSpawned)
            {
                SoundDefOf.Building_Deconstructed.PlayOneShot(new TargetInfo(Position, map));
            }

            if (wasSpawned)
            {
                ThingUtility.CheckAutoRebuildOnDestroyed(this, mode, map, def);
            }
        }