Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using RimWorld;
- using Verse;
- using Verse.Sound;
- namespace AlphaBehavioursAndEvents
- {
- // Token: 0x02000013 RID: 19
- public class CompMetamorphosis : ThingComp
- {
- // Token: 0x17000019 RID: 25
- // (get) Token: 0x06000056 RID: 86 RVA: 0x00003B01 File Offset: 0x00001D01
- public CompProperties_Metamorphosis Props
- {
- get
- {
- return (CompProperties_Metamorphosis)this.props;
- }
- }
- // Token: 0x06000057 RID: 87 RVA: 0x00003B0E File Offset: 0x00001D0E
- public override void PostExposeData()
- {
- base.PostExposeData();
- Scribe_Values.Look<int>(ref this.metamorphosisTick, "metamorphosisTick", 0, false);
- }
- // Token: 0x06000058 RID: 88 RVA: 0x00003B28 File Offset: 0x00001D28
- public override void CompTickRare()
- {
- base.CompTickRare();
- if (this.parent.Map != null)
- {
- this.metamorphosisTick++;
- if ((float)this.metamorphosisTick > (float)this.rareTicksInAYear * this.Props.timeInYears)
- {
- Faction faction = this.parent.Faction;
- GenSpawn.Spawn(PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDef.Named(this.Props.pawnToTurnInto), faction, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false, false, false, false, 0f, null, 1f, null, null, null, null, null, null, null, null, null, null, null, null)), CellFinder.RandomClosewalkCellNear(this.parent.Position, this.parent.Map, 3, null), this.parent.Map, WipeMode.Vanish);
- for (int i = 0; i < 20; i++)
- {
- IntVec3 c;
- CellFinder.TryFindRandomReachableCellNear(this.parent.Position, this.parent.Map, 2f, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), null, null, out c, 999999);
- FilthMaker.TryMakeFilth(c, this.parent.Map, ThingDefOf.Filth_AmnioticFluid, 1, FilthSourceFlags.None);
- }
- SoundDefOf.Hive_Spawn.PlayOneShot(new TargetInfo(this.parent.Position, this.parent.Map, false));
- this.parent.Destroy(DestroyMode.Vanish);
- }
- }
- }
- // Token: 0x06000059 RID: 89 RVA: 0x00003CB4 File Offset: 0x00001EB4
- public override string CompInspectStringExtra()
- {
- int numTicks = (int)(((float)this.rareTicksInAYear * this.Props.timeInYears - (float)this.metamorphosisTick) * 250f);
- return this.Props.reportString.Translate(numTicks.ToStringTicksToPeriod(false, false, false, true));
- }
- // Token: 0x0400001B RID: 27
- public int metamorphosisTick;
- // Token: 0x0400001C RID: 28
- public int rareTicksInAYear = 14400;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment