示例#1
0
        public override void Destroy(DestroyMode mode = DestroyMode.Kill)
        {
            Log.Error("Override invocation");
            if (base.Faction == Faction.OfColony)
            {

                ThingDef target = DefDatabase<ThingDef>.GetNamed("TableButcher");
                target.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("ButcherCorpseMechanoid"));
                //typeof(ThingDef).GetField("allRecipesCached", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(target, null);

                base.Destroy(mode);
                return;
            }

            if (base.equipment != null)
            {
                if (base.equipment.Primary != null)
                    base.equipment.DestroyEquipment(base.equipment.Primary);
            }
            if (base.apparel != null)
            {
                //base.apparel.WornApparelListForReading.Clear();
            }
            if (base.inventory != null)
            {
                base.inventory.container.Clear();
            }

            base.Destroy(mode);
        }
示例#2
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            // FCTODO: This isn't a great place for this considering it will be triggered when the plant is destroyed by *anything*, not just harvested,
            // but without being able to override additional base class methods, and not being able to change the harvesting job without rewriting it,
            // it's the best I've come up with for now.
            //
            // Turns out that checking for fire in the same cell isn't necessary as from testing, fire doesn't seem to use the same Vanish destroy mode as harvesting (neither does cold)
            // there may still be lingering fringe cases here though that I haven't considered that could theoretically destroy the crops and produce seeds.

            if (mode == DestroyMode.Vanish && m_CustomPlantDef != null && m_CustomPlantDef.SeedDef != null && growth > 0.99F)
            {
                if (Rand.Value < genome.baseSeedChance)
                {
                    Thing seedThing = ThingMaker.MakeThing(m_CustomPlantDef.SeedDef);
                    //if (seedThing is Thing_PlantSeedsItem)
                    //{
                    //    (seedThing as Thing_PlantSeedsItem).genome = genome;
                    //}

                    if (Rand.Value < genome.addSeedChance)
                    {
                        seedThing.stackCount = 2;
                    }
                    else
                    {
                        seedThing.stackCount = 1;
                    }

                    GenPlace.TryPlaceThing(seedThing, Position, ThingPlaceMode.Near);
                }
            }

            base.Destroy(mode);
        }
示例#3
0
        //private static Graphic FireGraphic = GraphicDatabase.Get_Flicker("Things/Special/Fire", ShaderDatabase.MotePostLight, false, Color.blue);
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);

            if (this.bound != null)
                this.bound.valid = false;
        }
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy( DestroyMode.Kill );

            if( this.Stuff != null )
            {

                var blocks = this.Stuff.defName;
                var rock = blocks.Remove( 0, "Blocks".Length );
                var rockDef = DefDatabase<ThingDef>.GetNamed( rock );

                if(
                    ( rockDef != null )&&
                    ( rockDef.building != null )&&
                    ( rockDef.building.mineableThing != null )
                )
                {
                    if( UnityEngine.Random.value < rockDef.building.mineableDropChance )
                    {
                        var chunkThing = ThingMaker.MakeThing( rockDef.building.mineableThing, null );
                        if( chunkThing != null )
                        {
                            var chunk = GenSpawn.Spawn( chunkThing, Position );
                            if( chunk.def.soundDrop != null)
                            {
                                chunk.def.soundDrop.PlayOneShot( Position );
                            }
                        }
                    }
                }

            }
        }
示例#5
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     if (this.symbiosisCluster.DestroyedOrNull() == false)
     {
         this.symbiosisCluster.NotifySymbiosisClusterRemoved(this);
     }
 }
 // ===================== Destroy =====================
 /// <summary>
 /// Destroy the plant and the associated glower if existing.
 /// </summary>
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     if (this.sporeSpawner.DestroyedOrNull() == false)
     {
         this.sporeSpawner.Destroy();
     }
     base.Destroy(mode);
 }
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     if (mode == DestroyMode.Deconstruct)
     {
         Deploy();
     }
 }
示例#8
0
 public override void PostDestroy(DestroyMode mode, bool wasSpawned)
 {
     // Check destroy mod passed
     if (mode == DestroyMode.Deconstruct)
     {
         SpawnLoot();
     }
 }
示例#9
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);

            // Small chance to spawn some pearl.
            if (Rand.Value < 0.02f)
            {
                GenSpawn.Spawn(Util_FishIndustry.PearlDef, this.Position);
            }
        }
 public override void PostDestroy( DestroyMode mode, bool wasSpawned )
 {
     base.PostDestroy( mode, wasSpawned );
     if( knownItems.NullOrEmpty() )
     {
         return;
     }
     foreach( var item in knownItems )
     {
         HideItemManager.RegisterForShow( item );
     }
     HideItemManager.DeregisterBuilding( parent );
 }
示例#11
0
文件: Vehicle.cs 项目: BBream/Vehicle
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);
            Dismount();
            foreach (Parts_TurretGun turretGun in turretGuns)
                turretGun.Destroy(mode);
            //Thing dummy;

            //Drop resources
            /*foreach (ThingCount thingCount in def.costList)
            {
                Thing thing = ThingMaker.MakeThing(thingCount.thingDef);
                thing.stackCount = thingCount.count / 2;
                GenThing.TryDropAndSetForbidden(thing, this.Position, ThingPlaceMode.Near, out dummy, true);
            }*/
        }
示例#12
0
        public static void HelicopterDestroy(Thing thing, DestroyMode mode = DestroyMode.Vanish)
        {
            if (!Thing.allowDestroyNonDestroyable && !thing.def.destroyable)
            {
                Log.Error("Tried to destroy non-destroyable thing " + thing, false);
                return;
            }
            if (thing.Destroyed)
            {
                Log.Error("Tried to destroy already-destroyed thing " + thing, false);
                return;
            }
            bool spawned = thing.Spawned;
            Map  map     = thing.Map;

            if (thing.Spawned)
            {
                thing.DeSpawn(mode);
            }
            Type      typ   = typeof(Thing);
            FieldInfo finfo = typ.GetField("mapIndexOrState", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            SByte     sbt   = -2;

            finfo.SetValue(thing, sbt);



            if (thing.def.DiscardOnDestroyed)
            {
                thing.Discard(false);
            }

            if (thing.holdingOwner != null)
            {
                thing.holdingOwner.Notify_ContainedItemDestroyed(thing);
            }
            MethodInfo minfo = typ.GetMethod("RemoveAllReservationsAndDesignationsOnThis", BindingFlags.NonPublic | BindingFlags.Instance);

            minfo.Invoke(thing, null);

            if (!(thing is Pawn))
            {
                thing.stackCount = 0;
            }
        }
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            base.DeSpawn();
            List <Pawn_Drone> drones = spawnedDrones.ToList();

            for (int i = 0; i < drones.Count; i++)
            {
                drones[i].Destroy();
            }
            if (droneAllowedArea != null)
            {
                //Deleate the old Zone
                ((DroneArea)droneAllowedArea).SetMutable(true);
                droneAllowedArea.Delete();
            }

            droneAllowedArea = null;
        }
示例#14
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     foreach (IntVec3 c in GenAdj.CellsOccupiedBy(this))
     {
         // Change the terrain here back to quarried stone, removing the walls
         Map.terrainGrid.SetTerrain(c, QuarryDefOf.QRY_QuarriedGround);
     }
     if (!QuarryMod.LetterSent && !TutorSystem.AdaptiveTrainingEnabled)
     {
         Find.LetterStack.ReceiveLetter(Static.LetterLabel, Static.LetterText, QuarryDefOf.CuproLetter, new RimWorld.Planet.GlobalTargetInfo(Position, Map));
         QuarryMod.Instance.Notify_LetterSent();
     }
     if (TutorSystem.AdaptiveTrainingEnabled)
     {
         LessonAutoActivator.TeachOpportunity(QuarryDefOf.QRY_ReclaimingSoil, OpportunityType.GoodToKnow);
     }
     base.Destroy(mode);
 }
示例#15
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (this.contents != null)
            {
                this.contents.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
            }
            Map map = base.Map;

            base.Destroy(mode);
            if (mode == DestroyMode.KillFinalize)
            {
                for (int i = 0; i < 1; i++)
                {
                    Thing thing = ThingMaker.MakeThing(ThingDefOf.ChunkSlagSteel, null);
                    GenPlace.TryPlaceThing(thing, base.Position, map, ThingPlaceMode.Near, null);
                }
            }
        }
示例#16
0
        public static bool DeSpawn(Explosion __instance, DestroyMode mode = DestroyMode.Vanish)
        {
            Thing thing = (Thing)__instance;

            thing.DeSpawn(mode);
            cellsToAffect(__instance).Clear();
            listIntVec3Stack.Push(cellsToAffect(__instance));
            cellsToAffect(__instance) = (List <IntVec3>)null;

            damagedThings(__instance).Clear();
            listThingsStack.Push(damagedThings(__instance));
            damagedThings(__instance) = (List <Thing>)null;

            addedCellsAffectedOnlyByDamage(__instance).Clear();
            hashSetIntVec3Stack.Push(addedCellsAffectedOnlyByDamage(__instance));
            addedCellsAffectedOnlyByDamage(__instance) = (HashSet <IntVec3>)null;
            return(false);
        }
示例#17
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            Pawn innerPawn = null;

            if (!Bugged)
            {
                innerPawn = InnerPawn;         // store the reference before removing him from the container so we can use it later
                NotifyColonistBar();
                innerContainer.Clear();
            }

            base.Destroy(mode);

            if (innerPawn != null)
            {
                Corpse.PostCorpseDestroy(innerPawn);
            }
        }
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            if (invisDoors?.Count > 0)
            {
                var tempDoors = new List <Building_DoorRegionHandler>(invisDoors);
                foreach (var door in invisDoors)
                {
                    if (door != null && door.Spawned)
                    {
                        tempDoors?.FirstOrDefault(z => z == door)?.DeSpawn();
                    }
                }
                tempDoors  = null;
                invisDoors = null;
            }

            base.DeSpawn(mode);
        }
示例#19
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     if (mode == DestroyMode.Cancel)
     {
         for (int i = 0; i < ingredients.Count; i++)
         {
             int num = GenMath.RoundRandom((float)ingredients[i].stackCount * 0.75f);
             if (num > 0)
             {
                 ingredients[i].stackCount = num;
                 GenPlace.TryPlaceThing(ingredients[i], base.Position, base.Map, ThingPlaceMode.Near);
             }
         }
         ingredients.Clear();
     }
     base.Destroy(mode);
     BoundBill = null;
 }
示例#20
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 (mode == DestroyMode.Deconstruct && spawned)
            {
                SoundDefOf.Building_Deconstructed.PlayOneShot(new TargetInfo(base.Position, map));
            }
            if (spawned)
            {
                ThingUtility.CheckAutoRebuildOnDestroyed(this, mode, map, def);
            }
        }
示例#21
0
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            if (sustainer != null)
            {
                if (sustainer.externalParams.sizeAggregator == null)
                {
                    sustainer.externalParams.sizeAggregator = new SoundSizeAggregator();
                }
                sustainer.externalParams.sizeAggregator.RemoveReporter(this);
            }

            var map = Map;     // before despawning

            base.DeSpawn(mode);

            //Recalculate paths after despawning
            RecalcPathsOnAndAroundMe(map);
        }
        public override void PostDestroy(DestroyMode mode, Map previousMap)
        {
            base.PostDestroy(mode, previousMap);

            //Kill de tous les hotes stockés
            if (storedMinds.Count != 0)
            {
                disconnectAllSurrogates();
                disconnectAllRemotelyControlledTurrets();
                //ATPP_destroyedMindsDueToDestroyedSkyCloudCore
                Find.LetterStack.ReceiveLetter("ATPP_destroyedMindsDueToDestroyedSkyCloudCore".Translate(storedMinds.Count), "ATPP_destroyedMindsDueToDestroyedSkyCloudCoreDesc".Translate(storedMinds.Count, getName()), LetterDefOf.ThreatBig);

                foreach (var p in storedMinds)
                {
                    p.Kill(null, null);
                }
            }
        }
示例#23
0
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            //Spawn Items in Queue on Minify
            for (int i = thingQueue.Count - 1; i >= 0; i--)
            {
                //some of the things contaned are marked as Destroyed for some reason. they should not be Destroyed
                if (thingQueue[i].Destroyed)
                {
                    thingQueue[i].ForceSetStateToUnspawned();
                }

                PlaceThingUtility.PRFTryPlaceThing(this, thingQueue[i], this.Position, this.Map, true);
            }

            base.DeSpawn(mode);

            prf_gamecomp.DeRegisterAssemblerQueue(this);
        }
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            base.DeSpawn(mode);
            cellsToAffect.Clear();
            SimplePool <List <IntVec3> > .Return(cellsToAffect);

            cellsToAffect = null;

            damagedThings.Clear();
            SimplePool <List <Thing> > .Return(damagedThings);

            damagedThings = null;

            addedCellsAffectedOnlyByDamage.Clear();
            SimplePool <HashSet <IntVec3> > .Return(addedCellsAffectedOnlyByDamage);

            addedCellsAffectedOnlyByDamage = null;
        }
示例#25
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     if (mode == DestroyMode.Kill)
     {
         this.ShipUnload(true);
     }
     if (mode == DestroyMode.Deconstruct)
     {
         this.ShipUnload(false);
     }
     if (mode == DestroyMode.Vanish)
     {
     }
     foreach (Building_ShipTurret current in this.assignedTurrets)
     {
         current.Destroy(mode);
     }
     base.Destroy(mode);
 }
示例#26
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            destroyedFlag = true;

            base.Destroy(mode);

            if ((countSteel > 0) && (steelDef != null))
            {
                // create the remaining resources as new resources at the refill position
                GenSpawn.Spawn(steelDef, refillPos, Map).stackCount = countSteel;
                countSteel = 0;
            }
            if ((countSilver > 0) && (silverDef != null))
            {
                // create the remaining resources as new resources at the refill position
                GenSpawn.Spawn(silverDef, refillPos, Map).stackCount = countSilver;
                countSilver = 0;
            }
        }
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (this.Map != null && comp.Props.createFilthWhenKilled)
            {
                EjectContents();
                for (int i = 0; i < 20; i++)
                {
                    IntVec3 c;
                    CellFinder.TryFindRandomReachableCellNear(this.Position, this.Map, 2, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c);
                    FilthMaker.TryMakeFilth(c, this.Map, comp.Props.filthToMake);
                }
                if (comp.Props.playSoundWhenKilled)
                {
                    SoundDef.Named(comp.Props.soundToPlay).PlayOneShot(new TargetInfo(this.Position, this.Map, false));
                }
            }

            base.Destroy(mode);
        }
示例#28
0
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            LaserGunDef defWeapon = equipmentDef as LaserGunDef;
            Vector3     a         = origin + Velocity(this.ExactRotation.eulerAngles.y) * (defWeapon == null ? 0.9f : defWeapon.barrelLength);
            Vector3     b         = ExactPosition;

            a.y = b.y = def.Altitude;
            SpawnBeam(a, b);
            if (this.def.impactReflection > 0)
            {
                Vector3 dir = (destination - origin).normalized;
                Rand.PushState();
                Vector3 c = ExactPosition - dir.RotatedBy(Rand.Range(-22.5f, 22.5f)) * 0.8f;
                Rand.PopState();
                SpawnBeamReflections(b, c, this.def.impactReflection);
            }

            base.DeSpawn(mode);
        }
示例#29
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            foreach( Thing t in info.containedThings )
            {
            t.Destroy( DestroyMode.Vanish );
            }

            base.Destroy(mode);

            if( mode == DestroyMode.Kill )
            {
            //Always leave slag on killed
            for(int i=0; i<1; i++ )
            {
                Thing chunk = ThingMaker.MakeThing( ThingDef.Named("ChunkSlag") );
                GenPlace.TryPlaceThing( chunk, Position, ThingPlaceMode.Near );
            }
            }
        }
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            // If the 'construction' of the unfinished building is 'failed', treat it like cancelling the unfinished thing but with construction failure percentages
            if (mode == DestroyMode.FailConstruction)
            {
                foreach (Thing ingredient in ingredients)
                {
                    int ingredientCountLeft = GenMath.RoundRandom(ingredient.stackCount * 0.5f);
                    if (ingredientCountLeft > 0)
                    {
                        ingredient.stackCount = ingredientCountLeft;
                        GenPlace.TryPlaceThing(ingredient, Position, Map, ThingPlaceMode.Near);
                    }
                }
                ingredients.Clear();
            }

            base.Destroy(mode);
        }
        //private void CheckIfItemIsAtReceivePoint()
        //{
        //    if (status != NanoPrinterStatus.Gathering)
        //        return;

        //    // Check if there is something at the receive position
        //    IntVec3 pos = collectorPos;
        //    IEnumerable<Thing> things = Map.listerThings.AllThings.Where(t => t.Position == pos);
        //    Thing foundThing = null;
        //    foreach (Thing thing in things)
        //    {
        //        if (thing.def.EverStorable(false))
        //        {
        //            foundThing = thing;
        //            break;
        //        }
        //    }
        //    if (foundThing != null)
        //        Notify_ReceivedThing(foundThing);
        //}


        #endregion


        // ===================== Destroy =====================
        #region Destroy

        /// <summary>
        /// Clean up when it is destroyed
        /// </summary>
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            // block further ticker work
            destroyedFlag = true;

            // create the stored resources as new resources at the refill position
            if (storageDefs.Count > 0)
            {
                for (int i = 0; i < storageDefs.Count; i++)
                {
                    if ((storageCounts[i] > 0) && (storageDefs[i] != null))
                    {
                        // create the item at this position
                        GenSpawn.Spawn(storageDefs[i], collectorPos, Map).stackCount = storageCounts[i];
                    }
                }
            }

            base.Destroy(mode);
        }
示例#32
0
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            if (powerComp.PowerOn && ((status == MedPodStatus.DiagnosisFinished) || (status == MedPodStatus.HealingStarted) || (status == MedPodStatus.HealingFinished)))
            {
                WakePatient(PatientPawn, false);
            }
            this.ForPrisoners = false;
            this.Medical      = false;

            // Remove the blocker region
            resultingBlocker.DeSpawn();

            Room room = this.GetRoom(RegionType.Set_Passable);

            base.DeSpawn(mode);
            if (room != null)
            {
                room.Notify_RoomShapeOrContainedBedsChanged();
            }
        }
示例#33
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            var map = Map; // before Destroy()!

            base.Destroy(mode);
            MoteMaker.ThrowMicroSparks(DrawPos, map);

            if (mode != DestroyMode.KillFinalize)
            {
                return;
            }

            foreach (var current in this.CellsAdjacent8WayAndInside())
            {
                if (map.roofGrid.RoofAt(current) != null) // if there is a roof
                {
                    map.roofGrid.SetRoof(current, null);
                }
            }
        }
示例#34
0
        //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));
        }
示例#35
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     if (!this.cryptosleepBay1.DestroyedOrNull())
     {
         this.cryptosleepBay1.Destroy();
     }
     if (!this.cryptosleepBay2.DestroyedOrNull())
     {
         this.cryptosleepBay2.Destroy();
     }
     if (!this.cargoBay1.DestroyedOrNull())
     {
         this.cargoBay1.Destroy();
     }
     if (!this.cargoBay2.DestroyedOrNull())
     {
         this.cargoBay2.Destroy();
     }
 }
        public override void PostDestroy(DestroyMode mode, Map previousMap)
        {
            base.PostDestroy(mode, previousMap);
            // If the turret wasn't minified, drop its stuff
            if (mode != DestroyMode.Vanish)
            {
                float resourceDropFraction = (mode == DestroyMode.KillFinalize) ? Props.destroyedResourceDropPct : Props.baseResourceDropPct;

                foreach (Thing thing in innerContainer)
                {
                    thing.stackCount = GenMath.RoundRandom(thing.stackCount * resourceDropFraction);
                    if (thing.stackCount == 0)
                    {
                        thing.Destroy();
                    }
                }

                innerContainer.TryDropAll(parent.Position, previousMap, ThingPlaceMode.Near);
            }
        }
示例#37
0
        public override void Destroy(DestroyMode mode = 0)
        {
            IntVec3 intVec = (base.Position != IntVec3.Invalid) ? base.Position : base.PositionHeld;
            Map     map    = (base.Map != null) ? base.Map : base.MapHeld;
            Building_BaseRobotRechargeStation rechargestation = this.rechargeStation;
            ThingDef thingDef = null;

            if (this != null && this.def2 != null && this.def2.destroyedDef != null)
            {
                thingDef = this.def2.destroyedDef;
            }
            base.Destroy(0);

            if (thingDef != null)
            {
                BaseRobot_disabled BaseRobot_disabled = (BaseRobot_disabled)GenSpawn.Spawn(thingDef, intVec, map);
                BaseRobot_disabled.stackCount      = 1;
                BaseRobot_disabled.rechargestation = rechargestation;
            }
        }
        public override void PostDestroy(DestroyMode mode, Map previousMap)
        {
            base.PostDestroy(mode, previousMap);

            if (string.IsNullOrEmpty(MessageKey))
            {
                return;
            }

            if (DestroyModes == null || !DestroyModes.Contains(mode))
            {
                return;
            }

            MoteMaker.ThrowText(
                parent.TrueCenter() + new Vector3(0.5f, 0f, 0.5f),
                previousMap,
                MessageKey.Translate(),
                Color.white);
        }
示例#39
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (mode == DestroyMode.Deconstruct)
            {
                var crateDef = this.def.costList[0].thingDef;
                var crate    = ThingMaker.MakeThing(crateDef, Stuff);

                int hitPoints = (HitPoints / MaxHitPoints) * crate.MaxHitPoints;
                crate.HitPoints = hitPoints;

                if (this.factionInt != Faction.OfPlayer)
                {
                    crate.SetForbidden(true);
                }

                GenSpawn.Spawn(crate, Position, Map);
            }

            base.Destroy(mode);
        }
示例#40
0
        public virtual void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (!Thing.allowDestroyNonDestroyable && !this.def.destroyable)
            {
                Log.Error("Tried to destroy non-destroyable thing " + this);
                return;
            }
            if (this.Destroyed)
            {
                Log.Error("Tried to destroy already-destroyed thing " + this);
                return;
            }
            bool spawned = this.Spawned;
            Map  map     = this.Map;

            if (this.Spawned)
            {
                this.DeSpawn();
            }
            this.mapIndexOrState = -2;
            if (this.def.DiscardOnDestroyed)
            {
                this.Discard(false);
            }
            CompExplosive compExplosive = this.TryGetComp <CompExplosive>();
            bool          flag          = compExplosive != null && compExplosive.destroyedThroughDetonation;

            if (spawned && !flag)
            {
                GenLeaving.DoLeavingsFor(this, map, mode);
            }
            if (this.holdingOwner != null)
            {
                this.holdingOwner.Notify_ContainedItemDestroyed(this);
            }
            this.RemoveAllReservationsAndDesignationsOnThis();
            if (!(this is Pawn))
            {
                this.stackCount = 0;
            }
        }
示例#41
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (mode == DestroyMode.KillFinalize)
            {
                this.ShipUnload(true);
            }
            if (mode == DestroyMode.Deconstruct)
            {
                this.ShipUnload(false);
            }
            if (mode == DestroyMode.Vanish)
            {
            }
            foreach (Building_ShipTurret current in this.assignedTurrets)
            {
                current.Destroy(mode);
            }

            DropShipUtility.currentShipTracker.RemoveShip(this);
            base.Destroy(mode);
        }
示例#42
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (mode != DestroyMode.KillFinalize)
            {
                float shipHealthProportion = (float)this.HitPoints / this.MaxHitPoints;
                if (shipHealthProportion < 1f)
                {
                    int delayInTicks = Mathf.RoundToInt(2f * WorldComponent_Partnership.medicalSpaceshipRequestedSupplyPeriodInTicks * (1f - shipHealthProportion));
                    Util_Misc.Partnership.nextMedicalSupplyMinTick[this.Map] += delayInTicks;
                    string spaceshipDamagedText = "-- Comlink with MiningCo. --\n\n"
                                                  + "\"Our medical spaceship was damaged during the last supply.\n"
                                                  + "Repairs will take some times.\n\n"
                                                  + "Remember the MiningCo. partnership contract stipulates that you must ensure landing ships security!\"\n\n"
                                                  + "-- End of transmission --";
                    Find.LetterStack.ReceiveLetter("Medical spaceship damaged", spaceshipDamagedText, LetterDefOf.NegativeEvent, new TargetInfo(this.Position, this.Map));
                }

                if (Util_Faction.MiningCoFaction.HostileTo(Faction.OfPlayer))
                {
                    EjectPlayerPawns();
                }

                // Transfer player pawns for orbital healing.
                List <Pawn> leftPawnsAboard = new List <Pawn>();
                foreach (Pawn pawn in this.pawnsAboard)
                {
                    if (pawn.Faction == Faction.OfPlayer)
                    {
                        Util_Misc.OrbitalHealing.Notify_PawnStartingOrbitalHealing(pawn, this.Map);
                    }
                    else
                    {
                        leftPawnsAboard.Add(pawn);
                    }
                }
                this.pawnsAboard = leftPawnsAboard.ListFullCopy();
            }

            base.Destroy(mode);
        }
示例#43
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     MoteThrower.ThrowMicroSparks(Position.ToVector3Shifted());
     if (mode == DestroyMode.Kill)
     {
         foreach (IntVec3 current in GenAdj.CellsAdjacent8WayAndInside(this))
         {
             if (current.GetRoof() != null)
             {
                 if (Find.RoofGrid.RoofAt(current).isThickRoof == true)
                 {
                     RoofDef roofType = DefDatabase<RoofDef>.GetNamed("RoofRockThin");
                     Find.RoofGrid.SetRoof(current, roofType);
                 }
                 else
                 {
                     Find.RoofGrid.SetRoof(current, null);
                 }
             }
         }
     }
 }
示例#44
0
 public override void PostDestroy( DestroyMode mode = DestroyMode.Vanish )
 {
     base.PostDestroy( mode );
     AirNetManager.NotifyCompDespawn( this );
 }
示例#45
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            ListerDroids.DeregisterDroid(this);

            base.Destroy(mode);
            if (mode == DestroyMode.Kill && this.KindDef.explodeOnDeath)
            {
                Messages.Message(this.LabelBase + " was destroyed!", MessageSound.Negative);
                GenExplosion.DoExplosion(this.Position, KindDef.explosionRadius, DamageDefOf.Bomb, this);
            }
        }
示例#46
0
        public override void PostDestroy(DestroyMode mode = DestroyMode.Vanish)
        {
            ItemContainer.Destroy();

            // Disconnect all infered power users
            if( poweredBelts != null )
                foreach( var b in poweredBelts )
                    b.UnregisterInferedPowerComponent( b );

            base.PostDestroy(mode);
        }
示例#47
0
 public override void PostDestroy( DestroyMode mode, bool wasSpawned)
 {
     base.PostDestroy(DestroyMode.Vanish, wasSpawned);
     AirNetManager.NotifyCompDespawn( this );
 }
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);

            this.outpostThingList = OG_Util.RefreshThingList(this.outpostThingList);
            string eventTitle = "Coralie out";
            string eventText = "   MiningCo. system maintenance request\n\n" +
                "Request author: Coralie\n" +
                "Function: MiningCo. outpost AI\n\n" +
                "Defect description:\n" +
                "Coralie here. I detect several severe dysfunctions.\n" +
                "- video sensors:    LINK DAMAGED\n" +
                "- threat sensors:   NO RESPONSE\n" +
                "- security systems: OFFLINE\n" +
                "- power status:     INTERNAL BAT LVL CRITICAL\n\n" +
                "I urgently request the sending of a repair tea-\n\n" +
                "*Grrz*... *Pchii*... *Fzzt*\n\n" +
                "---- End of transmision ---";
            if (this.Faction == Faction.OfPlayer)
            {
                Find.LetterStack.ReceiveLetter(eventTitle, eventText, LetterType.BadUrgent);
            }
            else
            {
                ChangeOutpostThingsFaction(null);
                LaunchSecurityDropPods(4, OG_Util.OutpostScoutDef, false);
                Find.LetterStack.ReceiveLetter(eventTitle, eventText, LetterType.BadNonUrgent);
            }
            ChangeOutpostTurretsFaction(null, true);
            ChangeOutpostDoorsFaction(null, true);
            Thing coralie = ThingMaker.MakeThing(ThingDef.Named("AIPersonaCore"));
            GenSpawn.Spawn(coralie, this.Position);
            OG_Util.DestroyOutpostArea();
        }
示例#49
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy();
     this.inventory.DropAll(this.Position);
 }
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     StopRotationSound();
 }
 public override void PostDestroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.PostDestroy(mode);
     Destroy();
 }
        // ===================== Destroying =====================

        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);

            for (int pylonIndex = 0; pylonIndex < this.pylonsList.Count; pylonIndex++)
            {
                IntVec3 pylonPosition = this.pylonsList[pylonIndex].Position;
                this.pylonsList[pylonIndex].Destroy(DestroyMode.Vanish);
                Thing destructiblePylon = ThingMaker.MakeThing(Util_MechanoidTerraformer.MechanoidPylonDestructibleDef);
                destructiblePylon.SetFaction(this.Faction);
                GenSpawn.Spawn(destructiblePylon, pylonPosition);
            }
        }
        /// <summary>
        ///     Destroys the specified mode.
        /// </summary>
        /// <param name="mode">The mode.</param>
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            // Destroy triggers.
            for (var i = 0; i < _trapTriggers.Count; i++)
            {
                var trapTrigger = _trapTriggers[i];

                if (trapTrigger.Destroyed == false)
                {
                    trapTrigger.Destroy(mode);
                }

                _trapTriggers.Remove(trapTrigger);
            }

            base.Destroy(mode);
        }
 public override void PostDestroy(DestroyMode mode, bool wasSpawned)
 {
     if (mode == DestroyMode.Kill && needsAutoRebuild)
         GenConstruct.PlaceBlueprintForBuild(parent.def.entityDefToBuild, parent.Position, parent.Rotation,
             Faction.OfPlayer, parent.Stuff);
 }
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     if (Charger != null)
         Charger.Destroy();
 }
示例#56
0
 public override void PostDestroy(DestroyMode mode = DestroyMode.Vanish)
 {
     // Scatter items to provide easy access
     ScatterItemsAround();
     base.PostDestroy(mode);
 }
        // ===================== Destroy =====================
        /// <summary>
        /// Destroy the mobile mineral sonar and reset its state when deconstructed.
        /// </summary>
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            base.Destroy(mode);

            if (mode == DestroyMode.Deconstruct)
            {
                this.scanRange = 1;
                this.scanProgress = 0;
                this.satelliteDishRotation = 0;
            }
        }
示例#58
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            this.storage.TryDropAll(this.Position, ThingPlaceMode.Near);

            if (mode == DestroyMode.Deconstruct)
                mode = DestroyMode.Kill;
            base.Destroy(mode);
        }
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy();
     this.storage.TryDropAll(this.Position, ThingPlaceMode.Near);
 }
示例#60
0
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     base.Destroy(mode);
     Find.DesignationManager.RemoveAllDesignationsOn(this);
 }