// Token: 0x06002896 RID: 10390 RVA: 0x00134DF4 File Offset: 0x001331F4 public virtual Thing ProduceEgg() { if (!this.Active) { Log.Error("LayEgg while not Active: " + this.parent, false); } this.eggProgress = 0f; int randomInRange = this.Props.eggCountRange.RandomInRange; if (randomInRange == 0) { return(null); } Thing thing; thing = ThingMaker.MakeThing(this.Props.eggDef, null); this.fertilizationCount = Mathf.Max(0, this.fertilizationCount - randomInRange); thing.stackCount = randomInRange; CompXenoHatcher compHatcher = thing.TryGetComp <CompXenoHatcher>(); if (compHatcher != null) { compHatcher.hatcheeFaction = this.parent.Faction; Pawn pawn = this.parent as Pawn; if (pawn != null) { compHatcher.hatcheeParent = pawn; } } return(thing); }
// Token: 0x060028F2 RID: 10482 RVA: 0x00136DF8 File Offset: 0x001351F8 public override void PreAbsorbStack(Thing otherStack, int count) { float t = (float)count / (float)(this.parent.stackCount + count); CompXenoHatcher comp = ((ThingWithComps)otherStack).GetComp <CompXenoHatcher>(); float b = comp.gestateProgress; this.gestateProgress = Mathf.Lerp(this.gestateProgress, b, t); }
// Token: 0x060028F3 RID: 10483 RVA: 0x00136E40 File Offset: 0x00135240 public override void PostSplitOff(Thing piece) { CompXenoHatcher comp = ((ThingWithComps)piece).GetComp <CompXenoHatcher>(); comp.gestateProgress = this.gestateProgress; comp.hatcheeParent = this.hatcheeParent; comp.otherParent = this.otherParent; comp.hatcheeFaction = this.hatcheeFaction; }
public override void CompPostTick(ref float severityAdjustment) { bool selected = Find.Selector.SelectedObjects.Contains(Pawn) && Prefs.DevMode; base.CompPostTick(ref severityAdjustment); if (!QueenPresent && !PredalienPresent) { float num = 1f / ((3 * Pawn.BodySize) * 60000f); if (this.conversionProgress < 1f) { this.conversionProgress += num; } } if (Find.TickManager.TicksGame % 300 == 0) { if (Pawn.CurrentBed() == null) { Pawn.health.RemoveHediff(this.parent); } #if DEBUG if (this.conversionProgress >= 1f && selected) { Log.Message(string.Format("QueenPresent: {0}, PredalienPresent: {1}, RoyalEggPresent: {2}, RoyalPresent: {3}", QueenPresent, PredalienPresent, RoyalEggPresent, RoyalPresent)); } #endif if (!QueenPresent) { if (this.conversionProgress >= 1f && XenomorphUtil.TotalSpawnedEggCount(MyMap) < (cocoonedCount / 2) && !XenomorphUtil.IsInfectedPawn(Pawn)) { float chance = Pawn.RaceProps.Humanlike ? 0.001f + ((float)EggConvertTicks / 1000) : .05f + ((float)EggConvertTicks / 500); EggConvertTicks++; if (Rand.Chance(chance)) { Thing thing = ThingMaker.MakeThing(eggDef, null); Building_XenoEgg _XenoEgg = (Building_XenoEgg)thing; CompXenoHatcher xenoHatcher = _XenoEgg.TryGetComp <CompXenoHatcher>(); if (!RoyalEggPresent && !RoyalPresent) { xenoHatcher.royalProgress = Pawn.BodySize; } MyCocoon.Destroy(); GenPlace.TryPlaceThing(thing, Pawn.Position != null ? Pawn.Position : Pawn.PositionHeld, Pawn.Map ?? Pawn.MapHeld, ThingPlaceMode.Direct); // Pawn.health.RemoveHediff(this.parent); Pawn.Destroy(); } else { #if DEBUG // Log.Message(string.Format("{0}, failed convert chance", conversionProgress)); #endif } } } } }