public static void DrawLinesToPotentialThingsToLinkTo(ThingDef myDef, IntVec3 myPos, Rot4 myRot, Map map) { nearDrowingList.Clear(); Vector3 pointingPos = GenThing.TrueCenter(myPos, myRot, myDef.size, myDef.Altitude); foreach (Thing thing in GenRadial.RadialDistinctThingsAround(myPos, map, range, true)) { CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>(); if (comp != null) { nearDrowingList.Add(comp); } } foreach (Thing thing in GenRadial.RadialDistinctThingsAround(myPos + myRot.FacingCell, map, range, true)) { CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>(); if (comp != null) { nearDrowingList.Add(comp); } } foreach (CompResonancePowerPlant comp in nearDrowingList) { if (comp.CanBeActive) { GenDraw.DrawLineBetween(pointingPos, comp.parent.TrueCenter()); } else { GenDraw.DrawLineBetween(pointingPos, comp.parent.TrueCenter(), CompAffectedByFacilities.InactiveFacilityLineMat); } } }
public void LinkToNearbyBuildings() { foreach (Thing thing in GenRadial.RadialDistinctThingsAround(parent.Position, parent.Map, range, true)) { CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>(); if (comp != null) { if (comp.AddLink(parent)) { linkedBuildings.Add(comp.parent); currentPowerEfficiency += additionalEfficiency; } } } foreach (Thing thing in GenRadial.RadialDistinctThingsAround(parent.Position + parent.Rotation.FacingCell, parent.Map, range, true)) { CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>(); if (comp != null) { if (comp.AddLink(parent)) { linkedBuildings.Add(comp.parent); currentPowerEfficiency += additionalEfficiency; } } } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol) { Map currentMap = Find.CurrentMap; if (def.HasComp(typeof(CompResonancePowerPlant))) { CompResonancePowerPlant.DrawLinesToPotentialThingsToLinkTo(def, center, rot, currentMap); } }