// 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 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 #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #6
0
        protected void DoEffect()
        {
            var wall          = base.TargetA.Thing.def.building.smoothedThing.defName;
            var rnd           = new System.Random();
            var pictureChance = rnd.Next(20);
            var xpGain        = 100f;

            if (pawn.skills != null)
            {
                pictureChance += pawn.skills.GetSkill(SkillDefOf.Artistic).Level;
            }
            if (pictureChance < 20)
            {
            }
            else
            {
                var pictureQuality    = 1;
                var pictureQualityMod = Rand.Value;
                if (pawn.skills != null)
                {
                    if (pawn.skills.GetSkill(SkillDefOf.Artistic).Level < 7)
                    {
                        if (pictureQualityMod > 0.67)
                        {
                            pictureQuality = 2;
                        }
                    }
                    else if (pawn.skills.GetSkill(SkillDefOf.Artistic).Level < 14)
                    {
                        if (pictureQualityMod > 0.67)
                        {
                            pictureQuality = 3;
                        }
                        else if (pictureQualityMod > 0.33)
                        {
                            pictureQuality = 2;
                        }
                    }
                    else
                    {
                        if (pictureQualityMod > 0.33)
                        {
                            pictureQuality = 3;
                        }
                        else
                        {
                            pictureQuality = 2;
                        }
                    }
                }
                var pictureChoice = rnd.Next(5);
                if (pictureQuality == 1)
                {
                    xpGain = 100f;
                    if (pictureChoice == 0)
                    {
                        wall += "XXAtom";
                    }
                    else if (pictureChoice == 1)
                    {
                        wall += "XXBeer";
                    }
                    else if (pictureChoice == 2)
                    {
                        wall += "XXCheese";
                    }
                    else if (pictureChoice == 3)
                    {
                        wall += "XXDoor";
                    }
                    else
                    {
                        wall += "XXShovel";
                    }
                }
                else if (pictureQuality == 2)
                {
                    xpGain = 200f;
                    if (pictureChoice == 0)
                    {
                        wall += "XXBoomalope";
                    }
                    else if (pictureChoice == 1)
                    {
                        wall += "XXForest";
                    }
                    else if (pictureChoice == 2)
                    {
                        wall += "XXHouse";
                    }
                    else if (pictureChoice == 3)
                    {
                        wall += "XXPlanet";
                    }
                    else
                    {
                        wall += "XXRocket";
                    }
                }
                else
                {
                    xpGain = 400f;
                    if (pictureChoice == 0)
                    {
                        wall += "XXGerbils";
                    }
                    else if (pictureChoice == 1)
                    {
                        wall += "XXIsland";
                    }
                    else if (pictureChoice == 2)
                    {
                        wall += "XXMan";
                    }
                    else if (pictureChoice == 3)
                    {
                        wall += "XXRose";
                    }
                    else
                    {
                        wall += "XXWoman";
                    }
                }
                pawn.skills.Learn(SkillDefOf.Artistic, xpGain, false);
            }
            SmoothableWallUtility.Notify_SmoothedByPawn(DecorateWall(base.TargetA.Thing, wall, pawn), pawn);
        }
Beispiel #7
0
 protected void DoEffect()
 {
     SmoothableWallUtility.Notify_SmoothedByPawn(SmoothableWallUtility.SmoothWall(base.TargetA.Thing, pawn), pawn);
 }