public void LearnAndShareBuildingThreats() { //Log.Message("sharing threats"); List <Pawn> allPawns = this.Pawn.Map.mapPawns.AllPawnsSpawned; for (int i = 0; i < allPawns.Count; i++) { Pawn p = allPawns[i]; if (p != this.Pawn && p.Faction == this.Pawn.Faction) { if (p.def == TorannMagicDefOf.TM_SkeletonLichR) { CompSkeletonLichController comp = p.GetComp <CompSkeletonLichController>(); if (comp != null && comp.buildingThreats != null && comp.buildingThreats.Count > 0) { this.buildingThreats.AddRange(comp.buildingThreats); comp.buildingThreats.AddRange(this.buildingThreats); } } else if (p.def == TorannMagicDefOf.TM_GiantSkeletonR) { CompSkeletonController comp = p.GetComp <CompSkeletonController>(); if (comp != null && comp.buildingThreats != null && comp.buildingThreats.Count > 0) { this.buildingThreats.AddRange(comp.buildingThreats); comp.buildingThreats.AddRange(this.buildingThreats); } } } } //Log.Message("ending threat share"); }
public void LearnAndShareBuildingThreats() { List <Pawn> allPawns = this.Pawn.Map.mapPawns.AllPawnsSpawned; for (int i = 0; i < allPawns.Count; i++) { Pawn p = allPawns[i]; if (p.Faction == this.Pawn.Faction) { if (p.def == TorannMagicDefOf.TM_SkeletonLichR) { CompSkeletonLichController comp = p.GetComp <CompSkeletonLichController>(); if (comp != null && comp.buildingThreats != null && comp.buildingThreats.Count > 0) { for (int j = 0; j < comp.buildingThreats.Count; j++) { this.buildingThreats.AddDistinct(comp.buildingThreats[j]); } for (int j = 0; j < this.buildingThreats.Count; j++) { comp.buildingThreats.AddDistinct(this.buildingThreats[j]); } } } else if (p.def == TorannMagicDefOf.TM_GiantSkeletonR) { CompSkeletonController comp = p.GetComp <CompSkeletonController>(); if (comp != null && comp.buildingThreats != null && comp.buildingThreats.Count > 0) { for (int j = 0; j < comp.buildingThreats.Count; j++) { this.buildingThreats.AddDistinct(comp.buildingThreats[j]); } for (int j = 0; j < this.buildingThreats.Count; j++) { comp.buildingThreats.AddDistinct(this.buildingThreats[j]); } } } } } }