コード例 #1
0
 // Token: 0x06002628 RID: 9768 RVA: 0x001222BC File Offset: 0x001206BC
 public override void Tick()
 {
     if (base.Spawned)
     {
         this.sustainer.Maintain();
         Vector3 vector = base.Position.ToVector3Shifted();
         IntVec3 c;
         if (Rand.MTBEventOccurs(TeleportSpawner.FilthSpawnMTB, 1f, 1.TicksToSeconds()) && CellFinder.TryFindRandomReachableCellNear(base.Position, base.Map, TeleportSpawner.FilthSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c, 999999))
         {
             FilthMaker.MakeFilth(c, base.Map, TeleportSpawner.filthTypes.RandomElement <ThingDef>(), 1);
         }
         if (Rand.MTBEventOccurs(TeleportSpawner.DustMoteSpawnMTB, 1f, 1.TicksToSeconds()))
         {
             MoteMaker.ThrowDustPuffThick(new Vector3(vector.x, 0f, vector.z)
             {
                 y = AltitudeLayer.MoteOverhead.AltitudeFor()
             }, base.Map, Rand.Range(1.5f, 3f), new Color(1f, 1f, 1f, 2.5f));
         }
         if (this.secondarySpawnTick <= Find.TickManager.TicksGame)
         {
             this.sustainer.End();
             Map     map      = base.Map;
             IntVec3 position = base.Position;
             if (!this.innerContainer.NullOrEmpty())
             {
                 //        Log.Message(string.Format("{0} to drop", innerContainer.ContentsString));
                 this.innerContainer.TryDropAll(position, map, ThingPlaceMode.Near);
             }
             this.Destroy(DestroyMode.Vanish);
         }
     }
 }
コード例 #2
0
 public void DropBloodFilth()
 {
     if ((this.pawn.Spawned || this.pawn.ParentHolder is Pawn_CarryTracker) && this.pawn.SpawnedOrAnyParentSpawned && this.pawn.RaceProps.BloodDef != null)
     {
         FilthMaker.MakeFilth(this.pawn.PositionHeld, this.pawn.MapHeld, this.pawn.RaceProps.BloodDef, this.pawn.LabelIndefinite(), 1);
     }
 }
コード例 #3
0
        private Pawn DoBirthSpawn()
        {
            var mother = ((Hediff)this).pawn;
            PawnGenerationRequest request = new PawnGenerationRequest(transformIntoKind, mother.Faction, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false, false, false, (Predicate <Pawn>)null, (Predicate <Pawn>)null, new float?(), new float?(), new float?(), new Gender?(), new float?(), (string)null);
            Pawn pawn = (Pawn)null;

            pawn = PawnGenerator.GeneratePawn(request);
            if (PawnUtility.TrySpawnHatchedOrBornPawn(pawn, (Thing)mother))
            {
                if (pawn.playerSettings != null && mother.playerSettings != null)
                {
                    pawn.playerSettings.AreaRestriction = mother.playerSettings.AreaRestriction;
                }
                if (pawn.RaceProps.IsFlesh)
                {
                    pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, pawn);
                }
            }
            else
            {
                Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Decide);
            }
            TaleRecorder.RecordTale(TaleDefOf.GaveBirth, (object)mother, (object)pawn);

            if (!pawn.Spawned)
            {
                return(pawn);
            }
            FilthMaker.MakeFilth(mother.Position, mother.Map, ThingDefOf.Filth_AmnioticFluid, mother.LabelIndefinite(), 5);
            mother.caller?.DoCall();
            pawn.caller?.DoCall();
            return(pawn);
        }
コード例 #4
0
        private void ExplosiveTransformation(ThingDef thingDef, PawnKindDef pawnKindDef)
        {
            TransformPawn(transformInto, transformIntoKind);
            var chicken = DoBirthSpawn();

            if (chicken != null && !pawn.Dead)
            {
                //blood mess

                pawn.filth.GainFilth(ThingDefOf.Filth_CorpseBile);
                pawn.filth.GainFilth(ThingDefOf.Filth_Blood);
                pawn.filth.GainFilth(ThingDefOf.Filth_Ash);

                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_CorpseBile, 4);
                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, 20);
                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Ash, 10);

                GenExplosion.DoExplosion(pawn.Position, pawn.Map, 4f, DamageDefOf.Smoke, chicken);

                HealthUtility.DamageUntilDowned(pawn, true);
            }


            didIt = true;
        }
コード例 #5
0
        public override IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency)
        {
            using (IEnumerator <Thing> enumerator = this.InnerPawn.ButcherProducts(butcher, efficiency).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Thing t = enumerator.Current;
                    yield return(t);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (this.InnerPawn.RaceProps.BloodDef != null)
            {
                FilthMaker.MakeFilth(butcher.Position, butcher.Map, this.InnerPawn.RaceProps.BloodDef, this.InnerPawn.LabelIndefinite(), 1);
            }
            if (this.InnerPawn.RaceProps.Humanlike)
            {
                butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse, null);
                foreach (Pawn item in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction))
                {
                    if (item != butcher && item.needs != null && item.needs.mood != null && item.needs.mood.thoughts != null)
                    {
                        item.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse, null);
                    }
                }
                TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, butcher);
            }
            yield break;
IL_0231:
            /*Error near IL_0232: Unexpected return in MoveNext()*/;
        }
コード例 #6
0
ファイル: TunnelSpawner.cs プロジェクト: tptp7979/NewRatkin
        public override void Tick()
        {
            if (Spawned)
            {
                sustainer.Maintain();
                Vector3 vector = Position.ToVector3Shifted();
                IntVec3 c;
                if (Rand.MTBEventOccurs(FilthSpawnMTB, 1f, 5.TicksToSeconds()) && CellFinder.TryFindRandomReachableCellNear(Position, Map, FilthSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c, 999999))
                {
                    FilthMaker.MakeFilth(c, Map, RatkinTunnelUtility.filthTypes.RandomElement <ThingDef>(), 1);
                }

                if (Rand.MTBEventOccurs(DustMoteSpawnMTB, 1f, 1.TicksToSeconds()))
                {
                    MoteMaker.ThrowDustPuffThick(new Vector3(vector.x, 0f, vector.z)
                    {
                        y = AltitudeLayer.MoteOverhead.AltitudeFor()
                    }, Map, Rand.Range(1.5f, 3f), new Color(1f, 1f, 1f, 2.5f));
                }
                if (secondarySpawnTick <= Find.TickManager.TicksGame)
                {
                    sustainer.End();
                    Map     map      = Map;
                    IntVec3 position = Position;
                    Destroy(DestroyMode.Vanish);
                    if (spawnTunnel)
                    {
                        Building_ThiefTunnel tunnel = (Building_ThiefTunnel)GenSpawn.Spawn(ThingMaker.MakeThing(RatkinBuildingDefOf.RK_ThiefTunnel, null), position, map, WipeMode.Vanish);
                        tunnel.SetFaction(Find.FactionManager.FirstFactionOfDef(RatkinFactionDefOf.Rakinia), null);
                    }
                }
            }
        }
コード例 #7
0
        private void Impact()
        {
            for (int i = 0; i < 6; i++)
            {
                Vector3 loc = base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f);
                MoteMaker.ThrowDustPuff(loc, 1.2f);
            }
            MoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), 2f);
            Deepstriker deepStriker = (Deepstriker)ThingMaker.MakeThing(tdef.RemainingDef, null);

            deepStriker.info = this.contents;
            GenSpawn.Spawn(deepStriker, base.Position, base.Rotation);
            RoofDef roof = base.Position.GetRoof();

            if (roof != null)
            {
                if (!roof.soundPunchThrough.NullOrUndefined())
                {
                    roof.soundPunchThrough.PlayOneShot(base.Position);
                }
                if (roof.filthLeaving != null)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        FilthMaker.MakeFilth(base.Position, roof.filthLeaving, 1);
                    }
                }
            }
            this.Destroy(DestroyMode.Vanish);
        }
コード例 #8
0
 public override IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency)
 {
     foreach (Thing t in this.InnerPawn.ButcherProducts(butcher, efficiency))
     {
         yield return(t);
     }
     if (this.InnerPawn.RaceProps.BloodDef != null)
     {
         FilthMaker.MakeFilth(butcher.Position, butcher.Map, this.InnerPawn.RaceProps.BloodDef, this.InnerPawn.LabelIndefinite(), 1);
     }
     if (this.InnerPawn.RaceProps.Humanlike)
     {
         butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse, null);
         foreach (Pawn pawn in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction))
         {
             if (pawn != butcher && pawn.needs != null && pawn.needs.mood != null && pawn.needs.mood.thoughts != null)
             {
                 pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse, null);
             }
         }
         TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, new object[]
         {
             butcher
         });
     }
     yield break;
 }
コード例 #9
0
 public static void TryCastNextBurstShot_Postfix(Verb __instance)
 {
     if (__instance.verbProps.muzzleFlashScale > 0.01f && __instance.verbProps.verbClass != typeof(Verb_ShootOneUse))
     {
         if (__instance.CasterIsPawn)
         {
             ThingDef filth = BulletCasingMoteDefOf.Filth_BulletCasingsCharge;
             if (__instance.CasterPawn.equipment.Primary.def.defName.Contains("Charge", StringComparison.OrdinalIgnoreCase))
             {
                 ThrowCasing(__instance.CasterPawn, __instance.caster.Map, __instance.GetProjectile().projectile.GetDamageAmount(1f), BulletCasingMoteDefOf.Mote_BulletCasing_Charge);
             }
             else if (__instance.CasterPawn.equipment.Primary.def.defName.Contains("Shotgun", StringComparison.OrdinalIgnoreCase))
             {
                 ThrowCasing(__instance.CasterPawn, __instance.caster.Map, __instance.GetProjectile().projectile.GetDamageAmount(1f), BulletCasingMoteDefOf.Mote_BulletCasing_Shotgun);
                 filth = BulletCasingMoteDefOf.Filth_BulletCasingsShotgun;
             }
             else
             {
                 ThrowCasing(__instance.CasterPawn, __instance.caster.Map, __instance.GetProjectile().projectile.GetDamageAmount(1f), BulletCasingMoteDefOf.Mote_BulletCasing);
                 filth = BulletCasingMoteDefOf.Filth_BulletCasingsRifle;
             }
             if (Rand.Value > 0.9f && BulletCasingMoteSettings.filth)
             {
                 IntVec3 randomCell = new IntVec3(Rand.Range(__instance.caster.Position.x - 1, __instance.caster.Position.x + 1), 0, Rand.Range(__instance.caster.Position.z - 1, __instance.caster.Position.z + 1));
                 FilthMaker.MakeFilth(randomCell, __instance.caster.Map, filth);
             }
         }
         else if (__instance.caster.def != ThingDefOf.Turret_Mortar)
         {
             ThrowCasingTurret(__instance.caster, __instance.caster.Map, __instance.GetProjectile().projectile.GetDamageAmount(1f), BulletCasingMoteDefOf.Mote_BulletCasing);
         }
     }
 }
コード例 #10
0
        public override void Tick()
        {
            base.Tick();

            if (!Settings.allowPawnsToGetWet || !this.pawn.Position.IsValid || this.pawn.MapHeld == null || !this.pawn.Position.InBounds(this.pawn.MapHeld))
            {
                return;
            }

            float wetness = this.wetnessRate();

            if (wetness > 0)
            {
                this.Severity     += wetness / 1000;
                this.wetnessLevel += wetness;
                if (this.wetnessLevel < 0)
                {
                    this.wetnessLevel = 0;
                }
                if (this.Severity > .62 && (this.ageTicks % 1000 == 0))
                {
                    FilthMaker.MakeFilth(this.pawn.Position, this.pawn.MapHeld, ThingDef.Named("TKKN_FilthPuddle"), 1);
                    this.Severity -= .3f;
                }
            }
            else
            {
                this.Severity += wetness / 1000;
            }
        }
コード例 #11
0
 private void LeaveFilth(IntVec3 pos, Map map)
 {
     if (pos.InBounds(map) && pos.Walkable(map))
     {
         FilthMaker.MakeFilth(pos, map, Props.filthLeaving, 1);
     }
 }
 private static IEnumerable <Thing> ButcherProducts(Corpse __instance, Pawn butcher, float efficiency)
 {
     //        Log.Message("ButcherProducts_BloodReplacer");
     foreach (Thing t in __instance.InnerPawn.ButcherProducts(butcher, efficiency))
     {
         yield return(t);
     }
     if (bloodReplacer != null)
     {
         //        Log.Message("ButcherProducts_BloodReplacer bloodReplacer");
         if (bloodReplacer.bloodDef != null)
         {
             Log.Message("ButcherProducts_BloodReplacer bloodDef");
             FilthMaker.MakeFilth(butcher.Position, butcher.Map, bloodReplacer.bloodDef, __instance.InnerPawn.LabelIndefinite(), 1);
         }
     }
     if (__instance.InnerPawn.RaceProps.Humanlike)
     {
         butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse, null);
         foreach (Pawn pawn in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction))
         {
             if (pawn != butcher && pawn.needs != null && pawn.needs.mood != null && pawn.needs.mood.thoughts != null)
             {
                 pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse, null);
             }
         }
         TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, new object[]
         {
             butcher
         });
     }
     yield break;
 }
コード例 #13
0
        public override DamageWorker.DamageResult Apply(DamageInfo dinfo, Thing victim)
        {
            Pawn pawn = victim as Pawn;

            if (pawn != null && pawn.Faction == Faction.OfPlayer)
            {
                Find.TickManager.slower.SignalForceNormalSpeedShort();
            }
            Map map = victim.Map;

            DamageWorker.DamageResult damageResult = base.Apply(dinfo, victim);
            if (!damageResult.deflected && !dinfo.InstantPermanentInjury)
            {
                victim.TryAttachFire(Rand.Range(0.15f, 0.25f));
            }
            if (victim.Destroyed && map != null && pawn == null)
            {
                foreach (IntVec3 c in victim.OccupiedRect())
                {
                    FilthMaker.MakeFilth(c, map, ThingDefOf.Filth_Ash, 1);
                }
                Plant plant = victim as Plant;
                if (plant != null && victim.def.plant.IsTree && plant.LifeStage != PlantLifeStage.Sowing && victim.def != ThingDefOf.BurnedTree)
                {
                    DeadPlant deadPlant = (DeadPlant)GenSpawn.Spawn(ThingDefOf.BurnedTree, victim.Position, map, WipeMode.Vanish);
                    deadPlant.Growth = plant.Growth;
                }
            }
            return(damageResult);
        }
コード例 #14
0
        private void checkAllThatInsidesForGunk()
        {
            bool ohHellNahWeAMutant = false;

            foreach (BodyPartDef astarteBodyPart in Constants.AstarteBodyParts)
            {
                IEnumerable <BodyPartRecord> bodyPartRecords =
                    pawn.def.race.body.GetPartsWithDef(astarteBodyPart).ToList();
                if (bodyPartRecords.Count() <= 1)
                {
                    continue;
                }
                ohHellNahWeAMutant = true;
                Log.Message(
                    "Uh Oh this Astarte is a damn mutant, they got more than one copy of the astarte organs [" +
                    bodyPartRecords.First() + "]");
                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, 6);
                break;
            }

            if (!ohHellNahWeAMutant)
            {
                return;
            }
        }
コード例 #15
0
        private static void DropRoofInCellPhaseTwo(IntVec3 c, Map map)
        {
            RoofDef roofDef = map.roofGrid.RoofAt(c);

            if (roofDef == null)
            {
                return;
            }
            if (roofDef.filthLeaving != null)
            {
                FilthMaker.MakeFilth(c, map, roofDef.filthLeaving, 1);
            }
            if (roofDef.VanishOnCollapse)
            {
                map.roofGrid.SetRoof(c, null);
            }
            CellRect bound = CellRect.CenteredOn(c, 2);

            foreach (Pawn current in from pawn in map.mapPawns.AllPawnsSpawned
                     where bound.Contains(pawn.Position)
                     select pawn)
            {
                TaleRecorder.RecordTale(TaleDefOf.CollapseDodged, new object[]
                {
                    current
                });
            }
        }
コード例 #16
0
        public override IEnumerable <Thing> ButcherProducts(Pawn butcher, float efficiency)
        {
            foreach (var t in InnerPawn.ButcherProducts(butcher, efficiency))
            {
                yield return(t);
            }

            //Spread blood
            if (InnerPawn.RaceProps.BloodDef != null)
            {
                FilthMaker.MakeFilth(butcher.Position, butcher.Map, InnerPawn.RaceProps.BloodDef, InnerPawn.LabelIndefinite());
            }

            //Thought/tale for butchering humanlike
            if (InnerPawn.RaceProps.Humanlike)
            {
                butcher.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.ButcheredHumanlikeCorpse);
                foreach (var p in butcher.Map.mapPawns.SpawnedPawnsInFaction(butcher.Faction))
                {
                    if (p == butcher || p.needs == null || p.needs.mood == null || p.needs.mood.thoughts == null)
                    {
                        continue;
                    }
                    p.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowButcheredHumanlikeCorpse);
                }
                TaleRecorder.RecordTale(TaleDefOf.ButcheredHumanlikeCorpse, butcher);
            }
        }
コード例 #17
0
        private void ShipImpact()
        {
            //     Log.Message("ShipImpact at " + this.Position.ToString() + " with truecenter" + Gen.TrueCenter(this).ToString() + " and ticks: " + this.containingShip.drawTickOffset.ToString());
            this.containingShip.shipState = ShipState.Stationary;

            for (int i = 0; i < 6; i++)
            {
                Vector3 loc = base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f);
                MoteMaker.ThrowDustPuff(loc, base.Map, 1.2f);
            }
            MoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
            RoofDef roof = this.Position.GetRoof(this.Map);

            if (roof != null)
            {
                if (!roof.soundPunchThrough.NullOrUndefined())
                {
                    roof.soundPunchThrough.PlayOneShot(new TargetInfo(base.Position, base.Map, false));
                }
                if (roof.filthLeaving != null)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        FilthMaker.MakeFilth(base.Position, base.Map, roof.filthLeaving, 1);
                    }
                }
            }
            GenSpawn.Spawn(this.containingShip, base.Position, this.Map, this.containingShip.Rotation);

            this.containingShip.ShipUnload(false, this.dropPawnsOnTochdown, this.dropItemsOnTouchdown);
            this.DeSpawn();
        }
コード例 #18
0
        public override void UsedThisTick()
        {
            base.UsedThisTick();
            lastUsedTick = Find.TickManager.TicksGame;
            if (effecter == null)
            {
                EffecterDef effecterDef = DefDatabase <EffecterDef> .GetNamedSilentFail("Drill");

                if (effecterDef == null)
                {
                    return;
                }
                effecter = effecterDef.Spawn();
            }
            else
            {
                effecter.EffectTick(this, this);
            }

            if (Find.TickManager.TicksGame % FilthRate == 0)
            {
                FilthMaker.MakeFilth(this.RandomAdjacentCell8Way(), MapHeld, FilthDef);
            }
            if (lastStartedTick + TicksUntilDamage < Find.TickManager.TicksGame)
            {
                lastStartedTick = Find.TickManager.TicksGame;
                Vein.TakeDamage(new DamageInfo(DamageDefOf.Crush, DamageRate));
            }
        }
コード例 #19
0
        public override void Resolve(ResolveParams rp)
        {
            Map         map         = BaseGen.globalSettings.map;
            TerrainGrid terrainGrid = map.terrainGrid;
            TerrainDef  terrainDef  = rp.floorDef ?? BaseGenUtility.RandomBasicFloorDef(rp.faction, false);
            bool?       floorOnlyIfTerrainSupports = rp.floorOnlyIfTerrainSupports;
            bool        flag = floorOnlyIfTerrainSupports.HasValue && floorOnlyIfTerrainSupports.Value;

            CellRect.CellRectIterator iterator = rp.rect.GetIterator();
            while (!iterator.Done())
            {
                if (!rp.chanceToSkipFloor.HasValue || !Rand.Chance(rp.chanceToSkipFloor.Value))
                {
                    if (!flag || GenConstruct.CanBuildOnTerrain(terrainDef, iterator.Current, map, Rot4.North, null))
                    {
                        terrainGrid.SetTerrain(iterator.Current, terrainDef);
                        if (rp.filthDef != null)
                        {
                            FilthMaker.MakeFilth(iterator.Current, map, rp.filthDef, (!rp.filthDensity.HasValue) ? 1 : Mathf.RoundToInt(rp.filthDensity.Value.RandomInRange));
                        }
                    }
                }
                iterator.MoveNext();
            }
        }
コード例 #20
0
        public void Hatch()
        {
            if (this.parent.Map.IsPlayerHome)
            {
                FilthMaker.MakeFilth(this.parent.Position, this.parent.Map, ThingDefOf.Filth_AmnioticFluid, 1);


                for (int i = 0; i < this.parent.stackCount; i++)
                {
                    if (rand.NextDouble() < 0.9)
                    {
                        request = new PawnGenerationRequest(this.Props.hatcherPawn, Faction.OfPlayer, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false);
                    }
                    else
                    {
                        request   = new PawnGenerationRequest(PawnKindDef.Named("GR_AberrantFleshbeast"), null, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false);
                        WasMutant = true;
                    }
                    Pawn pawn = PawnGenerator.GeneratePawn(request);
                    if (PawnUtility.TrySpawnHatchedOrBornPawn(pawn, this.parent))
                    {
                        if (pawn != null)
                        {
                            if (this.hatcheeParent != null)
                            {
                                if (pawn.playerSettings != null && this.hatcheeParent.playerSettings != null && this.hatcheeParent.Faction == this.hatcheeFaction)
                                {
                                    pawn.playerSettings.AreaRestriction = this.hatcheeParent.playerSettings.AreaRestriction;
                                }
                                if (pawn.RaceProps.IsFlesh)
                                {
                                    pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, this.hatcheeParent);
                                }
                            }
                            if (this.otherParent != null && (this.hatcheeParent == null || this.hatcheeParent.gender != this.otherParent.gender) && pawn.RaceProps.IsFlesh)
                            {
                                pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, this.otherParent);
                            }
                            if (WasMutant)
                            {
                                Messages.Message("GR_ANewCreatureWasBornMutant".Translate(), pawn, MessageTypeDefOf.NegativeEvent);
                            }
                            else
                            {
                                Messages.Message("GR_ANewCreatureWasBorn".Translate(), pawn, MessageTypeDefOf.PositiveEvent);
                            }
                        }
                        if (this.parent.Spawned)
                        {
                            FilthMaker.MakeFilth(this.parent.Position, this.parent.Map, ThingDefOf.Filth_AmnioticFluid, 1);
                        }
                    }
                    else
                    {
                        Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                    }
                }
                this.parent.Destroy(DestroyMode.Vanish);
            }
        }
コード例 #21
0
        public void CheckStatus()
        {
            if (IsLoaded)
            {
                if (this.innerContainer.Count != 0)
                {
                    if (NearestBloodTank != null)
                    {
                        float difference = 0.0f;
                        bloodLoaded = DetermineBloodRemaining(Occupant, out difference);
                        if (difference > 0.0f)
                        {
                            NearestBloodTank.TryGetComp <CompBloodTank>().AddBlood(difference);
                            FilthMaker.MakeFilth(this.Position.RandomAdjacentCell8Way(), this.Map, ThingDefOf.FilthBlood);
                        }
                    }
                }
            }
            bool flag1 = false;

            if (lastLoader != null)
            {
                //foreach (Pawn current in this.Map.mapPawns.FreeColonistsSpawned)
                //{
                if (lastLoader.CurJob.def.defName == "BloodHaulPrisoner")
                {
                    flag1 = true;
                }
                //}
            }
            this.isLoading = flag1;
        }
コード例 #22
0
        public override void GameConditionTick()
        {
            base.GameConditionTick();

            IntVec3 newFilthLoc = CellFinderLoose.RandomCellWith((IntVec3 sq) => sq.Standable(AffectedMaps[0]) && !AffectedMaps[0].roofGrid.Roofed(sq), AffectedMaps[0], 1000);

            FilthMaker.MakeFilth(newFilthLoc, AffectedMaps[0], ThingDefOf.Filth_Vomit);
        }
コード例 #23
0
 public override void CompTick()
 {
     this.mucusProgress += 1;
     if (this.mucusProgress > 60)
     {
         FilthMaker.MakeFilth(this.parent.PositionHeld, this.parent.MapHeld, ThingDef.Named("GR_FilthMucus"), 1);
         this.mucusProgress = 0;
     }
 }
コード例 #24
0
        public void SpawnDude()
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.M7MechPawn, Faction.OfPlayer, PawnGenerationContext.NonPlayer);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            FilthMaker.MakeFilth(base.Position, base.Map, RimWorld.ThingDefOf.Filth_RubbleBuilding, 30);

            GenSpawn.Spawn(pawn, base.Position, base.Map);
        }
コード例 #25
0
        private void GrowLowRockFormationFrom(IntVec3 root, Map map)
        {
            ThingDef        filth_RubbleRock = ThingDefOf.Filth_RubbleRock;
            ThingDef        mineableThing    = Find.World.NaturalRockTypesIn(map.Tile).RandomElement <ThingDef>().building.mineableThing;
            Rot4            random           = Rot4.Random;
            MapGenFloatGrid elevation        = MapGenerator.Elevation;
            IntVec3         intVec           = root;

            while (true)
            {
                Rot4 random2 = Rot4.Random;
                if (!(random2 == random))
                {
                    intVec += random2.FacingCell;
                    if (!intVec.InBounds(map) || intVec.GetEdifice(map) != null || intVec.GetFirstItem(map) != null)
                    {
                        break;
                    }
                    if (elevation[intVec] > 0.55f)
                    {
                        return;
                    }
                    if (!map.terrainGrid.TerrainAt(intVec).affordances.Contains(TerrainAffordanceDefOf.Heavy))
                    {
                        return;
                    }
                    GenSpawn.Spawn(mineableThing, intVec, map, WipeMode.Vanish);
                    IntVec3[] adjacentCellsAndInside = GenAdj.AdjacentCellsAndInside;
                    for (int i = 0; i < adjacentCellsAndInside.Length; i++)
                    {
                        IntVec3 b = adjacentCellsAndInside[i];
                        if (Rand.Value < 0.5f)
                        {
                            IntVec3 c = intVec + b;
                            if (c.InBounds(map))
                            {
                                bool         flag      = false;
                                List <Thing> thingList = c.GetThingList(map);
                                for (int j = 0; j < thingList.Count; j++)
                                {
                                    Thing thing = thingList[j];
                                    if (thing.def.category != ThingCategory.Plant && thing.def.category != ThingCategory.Item && thing.def.category != ThingCategory.Pawn)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    FilthMaker.MakeFilth(c, map, filth_RubbleRock, 1);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #26
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil to = new Toil()
            {
                initAction = delegate
                {
                    ticksLeft = Rand.Range(300, 900);
                    int     num = 0;
                    IntVec3 c;
                    while (true)
                    {
                        c = pawn.Position + GenAdj.AdjacentCellsAndInside[Rand.Range(0, 9)];
                        num++;
                        if (num > 12)
                        {
                            break;
                        }
                        if (c.InBounds(pawn.Map) && c.Standable(pawn.Map))
                        {
                            goto IL_A1;
                        }
                    }
                    c = pawn.Position;
IL_A1:
                    pawn.CurJob.targetA = c;
                    pawn.rotationTracker.FaceCell(c);
                    pawn.pather.StopDead();
                },
                tickAction = delegate
                {
                    int curTicks = ticksLeft;
                    if (curTicks % 150 == 149)
                    {
                        FilthMaker.MakeFilth(pawn.CurJob.targetA.Cell, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelIndefinite());
                        if (pawn.BloodNeed() is Need_Blood n && n.CurBloodPoints > 0)
                        {
                            n.AdjustBlood(-1);
                        }
                    }
                    ticksLeft--;

                    if (curTicks - 1 <= 0)
                    {
                        ReadyForNextToil();
                        TaleRecorder.RecordTale(TaleDefOf.Vomited, new object[]
                        {
                            pawn
                        });
                    }
                }
            };

            to.defaultCompleteMode = ToilCompleteMode.Never;
            to.WithEffect(VampDefOfTwo.ROMV_BloodVomit, TargetIndex.A);
            to.PlaySustainerOrSound(() => SoundDef.Named("Vomit"));
            yield return(to);
        }
コード例 #27
0
 public override void CompPostTick()
 {
     base.CompPostTick();
     if (lastTick < Find.TickManager.TicksGame + 600)
     {
         FilthMaker.MakeFilth(this.Pawn.DrawPos.ToIntVec3(), ThingDefOf.FilthVomit, 1);
         lastTick = Find.TickManager.TicksGame;
     }
 }
コード例 #28
0
        public virtual void aftersex(Pawn pawn, Pawn part, bool violent = false, bool isCoreLovin = false, bool isAnalSex = false)
        {
            var pawn_name = (pawn != null) ? pawn.NameStringShort : "NULL";
            var part_name = (pawn != null) ? part.NameStringShort : "NULL";

            //--Log.Message("[RJW]" + this.GetType().ToString() + "::aftersex( " + pawn_name + ", " + part_name + " ) called");
            pawn.rotationTracker.Face(part.DrawPos);
            pawn.rotationTracker.FaceCell(part.Position);

            part.rotationTracker.Face(pawn.DrawPos);
            part.rotationTracker.FaceCell(pawn.Position);

            if (violent)
            {
                pawn.Drawer.Notify_MeleeAttackOn(part);
            }

            if (xxx.config.sounds_enabled)
            {
                SoundDef.Named("Cum").PlayOneShot(new TargetInfo(part.Position, pawn.Map, false));
            }

            bool pawnIsNotHuman = xxx.is_animal(pawn);
            bool partIsNotHuman = xxx.is_animal(part);

            //--Log.Message("[RJW]" + this.GetType().ToString() + "::aftersex( " + pawn_name + ", " + part_name + " ) - applying cum effect");
            if (xxx.config.cum_enabled)
            {
                int pawn_cum = pawnIsNotHuman ? 4 : Math.Min((int)(pawn.RaceProps.lifeExpectancy / pawn.ageTracker.AgeBiologicalYears), 2);
                int part_cum = partIsNotHuman ? 4 : Math.Min((int)(part.RaceProps.lifeExpectancy / part.ageTracker.AgeBiologicalYears), 2);
                if (pawn.gender == Gender.Female)
                {
                    pawn_cum /= 2;
                }
                if (part.gender == Gender.Female)
                {
                    part_cum /= 2;
                }
                FilthMaker.MakeFilth(pawn.PositionHeld, pawn.MapHeld, xxx.cum, pawn.LabelIndefinite(), pawn_cum);
                if (!isCoreLovin)
                {
                    FilthMaker.MakeFilth(part.PositionHeld, part.MapHeld, xxx.cum, part.LabelIndefinite(), part_cum);
                }
            }

            //--Log.Message("[RJW]" + this.GetType().ToString() + "::aftersex( " + pawn_name + ", " + part_name + " ) - checking satisfaction");
            xxx.satisfy(pawn, part, violent, isCoreLovin);
            //--Log.Message("[RJW]" + this.GetType().ToString() + "::aftersex( " + pawn_name + ", " + part_name + " ) - checking thoughts");
            think_after_sex(pawn, part, violent, isCoreLovin);

            std.roll_to_catch(pawn, part);

            Impregnate(pawn, part, isAnalSex);
            //--Log.Message("[RJW]" + this.GetType().ToString() + "::aftersex( " + pawn_name + ", " + part_name + " ) - checking disease");
        }
コード例 #29
0
        private void GrowLowRockFormationFrom(IntVec3 root, Map map)
        {
            ThingDef        rockRubble    = ThingDefOf.Filth_RubbleRock;
            ThingDef        mineableThing = Find.World.NaturalRockTypesIn(map.Tile).RandomElement <ThingDef>().building.mineableThing;
            Rot4            excludedDir   = Rot4.Random;
            MapGenFloatGrid elevation     = MapGenerator.Elevation;
            IntVec3         cell          = root;
            int             maxRockChunks = MaxRockChunksPerGroup.RandomInRange;

            for (int i = 0; i < maxRockChunks; i++)
            {
                Rot4 nextDir = Rot4Utility.RandomButExclude(excludedDir);
                cell += nextDir.FacingCell;
                if (!cell.InBounds(map) || cell.GetEdifice(map) != null || cell.GetFirstItem(map) != null)
                {
                    break;
                }
                if (elevation[cell] < ThreshLooseRock)
                {
                    break;
                }
                List <TerrainAffordanceDef> affordances = map.terrainGrid.TerrainAt(cell).affordances;
                if (!(affordances.Contains(TerrainAffordanceDefOf.Medium) || affordances.Contains(TerrainAffordanceDefOf.Heavy)))
                {
                    break;
                }
                GenSpawn.Spawn(mineableThing, cell, map);
                foreach (IntVec3 adjCell in GenAdj.AdjacentCellsAndInside)
                {
                    if (Rand.Value < RubbleProbability)
                    {
                        continue;
                    }
                    IntVec3 c = cell + adjCell;
                    if (c.InBounds(map))
                    {
                        bool         cellUsed  = false;
                        List <Thing> thingList = c.GetThingList(map);
                        for (int j = 0; j < thingList.Count; j++)
                        {
                            Thing thing = thingList[j];
                            if (thing.def.category != ThingCategory.Plant && thing.def.category != ThingCategory.Item && thing.def.category != ThingCategory.Pawn)
                            {
                                cellUsed = true;
                                break;
                            }
                        }
                        if (!cellUsed)
                        {
                            FilthMaker.MakeFilth(c, map, rockRubble, 1);
                        }
                    }
                }
            }
        }
コード例 #30
0
        public static void DoMutation(Pawn premutant)
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.AbominationAtlas, Faction.OfMechanoids, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            FilthMaker.MakeFilth(premutant.Position, premutant.Map, RimWorld.ThingDefOf.FilthAmnioticFluid, premutant.LabelIndefinite(), 10);
            FilthMaker.MakeFilth(premutant.Position, premutant.Map, RimWorld.ThingDefOf.FilthBlood, premutant.LabelIndefinite(), 10);

            GenSpawn.Spawn(pawn, premutant.Position, premutant.Map);
            pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent, null, true, false, null);
        }