public override void MapComponentTick() { if (Find.TickManager.TicksGame % 2000 != 0) { return; } groups.Clear(); allPlantsInGroup.Clear(); var plants = this.map.listerThings.ThingsInGroup(ThingRequestGroup.Plant); foreach (Plant item in plants) { #if DEBUG var timer = Stopwatch.StartNew(); #endif var group = GroupMaker.TryCreateGroup(this, item); if (group != null) { groups.Add(group); #if DEBUG timer.Stop(); Log.Message("Created group of " + group.Count + " " + group.PlantDef + " (" + timer.Elapsed.TotalMilliseconds.ToString("0.000 ms") + ")"); #endif } } }
public override void Update() { try { var t = Find.Selector.SingleSelectedThing; if (t == null) { return; } if (t is Plant) { #if DEBUG if (KeyBindingDefOf.Misc1.JustPressed) { GroupMaker.TryCreateGroup(Find.CurrentMap.GetComponent <MapCompGrowthSync>(), t as Plant, true); } #endif var group = GroupsUtils.GroupOf(t as Plant); if (group != null) { group.Draw(0); } } } catch (Exception ex) { //screw that bug, I can't fix it and it seems harmless. if (!(ex is InvalidCastException)) { throw ex; } } }