public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); gasProps = def.mote as MoteProperties_GasCloud; relativeZOrder = ++GlobalOffsetCounter % 80; if (gasProps == null) { throw new Exception("Missing required gas mote properties in " + def.defName); } interpolatedScale.value = GetRandomGasScale(); interpolatedRotation.value = GetRandomGasRotation(); // uniformly distribute gas ticks to reduce per frame workload // wait for next tick to avoid registering while DistributedTickScheduler is mid-tick HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(() => HugsLibController.Instance.DistributedTicker.RegisterTickability(GasTick, gasProps.GastickInterval, this) , 1, this); PlayerAvoidanceGrids.AddAvoidanceSource(this, AvoidanceGridPathCost); }
public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { PlayerAvoidanceGrids.RemoveAvoidanceSource(this); base.DeSpawn(mode); }