public static void Notify_BuildingClaimed(Thing b) { if (AutoHomeAreaMaker.ShouldAdd() && b.def.building.expandHomeArea && b.Faction == Faction.OfPlayer) { AutoHomeAreaMaker.MarkHomeAroundThing(b); } }
public static void Notify_BuildingClaimed(Thing b) { if (!AutoHomeAreaMaker.ShouldAdd() || !b.def.building.expandHomeArea || b.Faction != Faction.OfPlayer) { return; } AutoHomeAreaMaker.MarkHomeAroundThing(b); }
public static void Notify_ZoneCellAdded(IntVec3 c, Zone zone) { if (AutoHomeAreaMaker.ShouldAdd()) { CellRect.CellRectIterator iterator = CellRect.CenteredOn(c, 4).ClipInsideMap(zone.Map).GetIterator(); while (!iterator.Done()) { zone.Map.areaManager.Home[iterator.Current] = true; iterator.MoveNext(); } } }
public static void MarkHomeAroundThing(Thing t) { if (AutoHomeAreaMaker.ShouldAdd()) { CellRect cellRect = new CellRect(t.Position.x - t.RotatedSize.x / 2 - 4, t.Position.z - t.RotatedSize.z / 2 - 4, t.RotatedSize.x + 8, t.RotatedSize.z + 8); cellRect.ClipInsideMap(t.Map); foreach (IntVec3 c in cellRect) { t.Map.areaManager.Home[c] = true; } } }
public static void Notify_BuildingSpawned(Thing b) { if (!AutoHomeAreaMaker.ShouldAdd() || !b.def.building.expandHomeArea || b.Faction != Faction.OfPlayer) { return; } CellRect cellRect = new CellRect(b.Position.x - b.RotatedSize.x / 2 - 4, b.Position.z - b.RotatedSize.z / 2 - 4, b.RotatedSize.x + 8, b.RotatedSize.z + 8); cellRect.ClipInsideMap(b.Map); foreach (IntVec3 current in cellRect) { b.Map.areaManager.Home[current] = true; } }
public static void Notify_BuildingSpawned(Thing b) { if (AutoHomeAreaMaker.ShouldAdd() && b.def.building.expandHomeArea && b.Faction == Faction.OfPlayer) { IntVec3 position = b.Position; int x = position.x; IntVec2 rotatedSize = b.RotatedSize; int minX = x - rotatedSize.x / 2 - 4; IntVec3 position2 = b.Position; int z = position2.z; IntVec2 rotatedSize2 = b.RotatedSize; int minZ = z - rotatedSize2.z / 2 - 4; IntVec2 rotatedSize3 = b.RotatedSize; int width = rotatedSize3.x + 8; IntVec2 rotatedSize4 = b.RotatedSize; CellRect cellRect = new CellRect(minX, minZ, width, rotatedSize4.z + 8); cellRect.ClipInsideMap(b.Map); foreach (IntVec3 item in cellRect) { ((Area)b.Map.areaManager.Home)[item] = true; } } }