public void StartGrowthProcess() { this.growthCell = ThingMaker.MakeThing(InternalDefOf.GR_GrowthCell); CompGrowthCell cell = this.growthCell?.TryGetComp <CompGrowthCell>(); if (cell != null) { cell.genomeDominant = this.genomeDominant?.def; cell.genomeSecondary = this.genomeSecondary?.def; cell.genoframe = this.frame?.def; cell.booster = this.booster?.def; cell.mainResult = this.mainResult?.LabelCap ?? ""; cell.bodySize = this.mainResult?.RaceProps?.baseBodySize ?? 1; this.genomeDominant = null; this.genomeSecondary = null; this.frame = null; this.booster = null; this.mainResult = null; this.progress = 0f; } }
public void InitProcess(Thing growthCell) { CompGrowthCell growthComp = growthCell.TryGetComp <CompGrowthCell>(); PawnKindDef result = Core.GetHybrid(growthComp.genomeDominant, growthComp.genomeSecondary, growthComp.genoframe, growthComp.booster, out float swapChance, out float failureChance, out PawnKindDef swapResult, out PawnKindDef failureResult); this.booster = growthComp.booster; this.genoframe = growthComp.genoframe; this.genomeDominant = growthComp.genomeDominant; this.genomeSecondary = growthComp.genomeSecondary; hoursProcess = Props.hoursProcess * GenDate.TicksPerHour; float?timeMultiplier = booster?.GetModExtension <DefExtension_HybridChanceAlterer>()?.timeMultiplier; if (timeMultiplier != null && timeMultiplier != 0) { hoursProcess = (int)(hoursProcess * timeMultiplier); } hoursProcess = (int)(hoursProcess * GeneticRim_Mod.settings.GR_WombSpeedMultiplier); growthCell.Destroy(); if (swapChance != 0) { bool swap = Rand.Chance(swapChance); result = swap ? swapResult : result; } if (failureChance != 0) { failure = Rand.Chance(failureChance); this.failureResult = failureResult; } this.growingResult = result; this.progress = 0; if (result == null || result.RaceProps.baseBodySize > this.Props.maxBodySize) { failure = true; } }