public override void PostSplitOff(Thing piece) { CompExplodingHatcher comp = ((ThingWithComps)piece).GetComp <CompExplodingHatcher>(); comp.gestateProgress = this.gestateProgress; comp.hatcheeParent = this.hatcheeParent; comp.otherParent = this.otherParent; comp.hatcheeFaction = this.hatcheeFaction; }
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; if (this.fertilizationCount > 0) { thing = ThingMaker.MakeThing(this.Props.eggFertilizedDef, null); this.fertilizationCount = Mathf.Max(0, this.fertilizationCount - randomInRange); } else { thing = ThingMaker.MakeThing(this.Props.eggUnfertilizedDef, null); } thing.stackCount = randomInRange; CompExplodingHatcher compHatcher = thing.TryGetComp <CompExplodingHatcher>(); if (compHatcher != null) { compHatcher.hatcheeFaction = this.parent.Faction; Pawn pawn = this.parent as Pawn; if (pawn != null) { compHatcher.hatcheeParent = pawn; } if (this.fertilizedBy != null) { compHatcher.otherParent = this.fertilizedBy; } } return(thing); }