public override void PostMake() { base.PostMake(); m_CustomPlantDef = def as ThingDef_PlantWithSeeds; if (genome == null) genome = m_CustomPlantDef.genome.RandomGenome(); }
public override void ExposeData() { base.ExposeData(); m_CustomPlantDef = def as ThingDef_PlantWithSeeds; Scribe_Deep.LookDeep<PlantGenome>(ref genome, "genome"); if (genome == null) genome = m_CustomPlantDef.genome.RandomGenome(); }
private Thing GetBestSeedThingForSowing(Pawn pawn, IntVec3 cell, ThingDef_PlantWithSeeds customPlantDef) { Thing result = null; Predicate<Thing> validator = (Thing tempThing) => !tempThing.IsForbidden(pawn.Faction) && pawn.AnimalAwareOf(tempThing) && pawn.CanReserve(tempThing, 1); if (customPlantDef.SeedDef != null) { result = GenClosest.ClosestThingReachable(cell, ThingRequest.ForDef(customPlantDef.SeedDef), PathEndMode.ClosestTouch, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, null, -1, false); } return result; }
public override void SpawnSetup() { base.SpawnSetup(); m_CustomPlantDef = def as ThingDef_PlantWithSeeds; }