// 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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
            }
        }