public static void Notify_ThingChanged(Thing thing) { if (StealAIDebugDrawer.debugDrawLord == null) { return; } StealAIDebugDrawer.CheckInitDebugDrawGrid(); if (thing.def.category != ThingCategory.Building && thing.def.category != ThingCategory.Item && thing.def.passability != Traversability.Impassable) { return; } if (thing.def.passability == Traversability.Impassable) { StealAIDebugDrawer.debugDrawLord = null; } else { int num = GenRadial.NumCellsInRadius(8f); float num2 = StealAIUtility.StartStealingMarketValueThreshold(StealAIDebugDrawer.debugDrawLord); for (int i = 0; i < num; i++) { IntVec3 intVec = thing.Position + GenRadial.RadialPattern[i]; if (intVec.InBounds(thing.Map)) { StealAIDebugDrawer.debugDrawGrid[intVec] = (StealAIDebugDrawer.TotalMarketValueAround(intVec, Find.CurrentMap, StealAIDebugDrawer.debugDrawLord.ownedPawns.Count) > num2); } } } }
public static void DebugDraw() { if (!DebugViewSettings.drawStealDebug) { StealAIDebugDrawer.debugDrawLord = null; return; } Lord lord = StealAIDebugDrawer.debugDrawLord; StealAIDebugDrawer.debugDrawLord = StealAIDebugDrawer.FindHostileLord(); if (StealAIDebugDrawer.debugDrawLord == null) { return; } StealAIDebugDrawer.CheckInitDebugDrawGrid(); float num = StealAIUtility.StartStealingMarketValueThreshold(StealAIDebugDrawer.debugDrawLord); if (lord != StealAIDebugDrawer.debugDrawLord) { foreach (IntVec3 intVec in Find.CurrentMap.AllCells) { StealAIDebugDrawer.debugDrawGrid[intVec] = (StealAIDebugDrawer.TotalMarketValueAround(intVec, Find.CurrentMap, StealAIDebugDrawer.debugDrawLord.ownedPawns.Count) > num); } } foreach (IntVec3 c in Find.CurrentMap.AllCells) { if (StealAIDebugDrawer.debugDrawGrid[c]) { CellRenderer.RenderCell(c, 0.5f); } } StealAIDebugDrawer.tmpToSteal.Clear(); for (int i = 0; i < StealAIDebugDrawer.debugDrawLord.ownedPawns.Count; i++) { Pawn pawn = StealAIDebugDrawer.debugDrawLord.ownedPawns[i]; Thing thing; if (StealAIUtility.TryFindBestItemToSteal(pawn.Position, pawn.Map, 7f, out thing, pawn, StealAIDebugDrawer.tmpToSteal)) { GenDraw.DrawLineBetween(pawn.TrueCenter(), thing.TrueCenter()); StealAIDebugDrawer.tmpToSteal.Add(thing); } } StealAIDebugDrawer.tmpToSteal.Clear(); }