Пример #1
0
        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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
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);
            }
        }