diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 425adde..084ef5c 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml index 27bc247..dfce06f 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml @@ -54,23 +54,6 @@ 80 10 0.9 - - - -
  • - -
  • ARA_BioforgeIncubator
  • -
  • ARA_BioforgeIncubator_Thing
  • -
  • ARA_JellyVat
  • -
  • ARA_GrowthVat
  • -
  • ARA_MorphableResearchBench
  • -
  • ARANutrientDispenser
  • -
  • ARA_WormholePortal_A
  • -
  • ARA_Acidling_AutoMortar
  • -
  • CatastropheMissileSilo
  • -
  • ARA_AutoSniperCannon
  • - - 80 ArachnaeSwarm/Building/Nutrition_Pie diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 1409dca..85f6577 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -128,7 +128,6 @@ - diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompLineDrawer.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompLineDrawer.cs deleted file mode 100644 index 5ac2183..0000000 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompLineDrawer.cs +++ /dev/null @@ -1,89 +0,0 @@ -using RimWorld; -using Verse; -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - -namespace ArachnaeSwarm -{ - public class CompProperties_LineDrawer : CompProperties - { - public List linkableBuildings; - public float maxDistance = 999f; - public string lineTexturePath = "Things/Special/Power/Wire"; - - public CompProperties_LineDrawer() - { - compClass = typeof(CompLineDrawer); - } - } - - public class CompLineDrawer : ThingComp - { - private CompProperties_LineDrawer Props => (CompProperties_LineDrawer)props; - private List linkedBuildings = new List(); - private Material lineMat; - - private Material LineMat - { - get - { - if (lineMat == null) - { - lineMat = MaterialPool.MatFrom(Props.lineTexturePath, ShaderDatabase.Transparent, Color.white); - } - return lineMat; - } - } - - public override void PostSpawnSetup(bool respawningAfterLoad) - { - base.PostSpawnSetup(respawningAfterLoad); - FindAndLinkBuildings(); - } - - public override void CompTick() - { - base.CompTick(); - if (parent.IsHashIntervalTick(120)) - { - FindAndLinkBuildings(); - } - } - - private void FindAndLinkBuildings() - { - int previousCount = linkedBuildings.Count; - - linkedBuildings.Clear(); - if (Props.linkableBuildings.NullOrEmpty()) return; - - var potentialTargets = parent.Map.listerBuildings.allBuildingsColonist.Where(b => - b != parent && - Props.linkableBuildings.Contains(b.def) && - parent.Position.DistanceTo(b.Position) <= Props.maxDistance - ); - - linkedBuildings.AddRange(potentialTargets); - - if (linkedBuildings.Count != previousCount) - { - parent.Map.mapDrawer.MapMeshDirty(parent.Position, MapMeshFlagDefOf.Things, true, false); - } - } - - public override void PostPrintOnto(SectionLayer layer) - { - base.PostPrintOnto(layer); - foreach (var building in linkedBuildings) - { - Vector3 center = (this.parent.TrueCenter() + this.parent.Graphic.DrawOffset(this.parent.Rotation) + building.TrueCenter() + building.Graphic.DrawOffset(building.Rotation)) / 2f; - center.y = AltitudeLayer.SmallWire.AltitudeFor(); - Vector3 v = building.TrueCenter() - this.parent.TrueCenter(); - Vector2 size = new Vector2(1f, v.MagnitudeHorizontal()); - float rot = v.AngleFlat(); - Printer_Plane.PrintPlane(layer, center, size, this.LineMat, rot); - } - } - } -} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompNutrientProvider.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompNutrientProvider.cs index ea11cb1..3043bd1 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompNutrientProvider.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompNutrientProvider.cs @@ -11,6 +11,19 @@ namespace ArachnaeSwarm { private CompRefuelableNutrition selfRefuelable; private new CompProperties_NutrientProvider Props => (CompProperties_NutrientProvider)props; + private Material lineMat; + + private Material LineMat + { + get + { + if (lineMat == null) + { + lineMat = MaterialPool.MatFrom(Props.lineTexturePath, ShaderDatabase.Transparent, Color.white); + } + return lineMat; + } + } public override void PostSpawnSetup(bool respawningAfterLoad) { @@ -102,5 +115,20 @@ namespace ArachnaeSwarm } return comp.TargetFuelLevel; } + + public override void PostPrintOnto(SectionLayer layer) + { + base.PostPrintOnto(layer); + foreach (var building in LinkedBuildings) + { + if (building == null) continue; + Vector3 center = (this.parent.TrueCenter() + this.parent.Graphic.DrawOffset(this.parent.Rotation) + building.TrueCenter() + building.Graphic.DrawOffset(building.Rotation)) / 2f; + center.y = AltitudeLayer.SmallWire.AltitudeFor(); + Vector3 v = building.TrueCenter() - this.parent.TrueCenter(); + Vector2 size = new Vector2(1f, v.MagnitudeHorizontal()); + float rot = v.AngleFlat(); + Printer_Plane.PrintPlane(layer, center, size, this.LineMat, rot); + } + } } } \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompProperties_NutrientProvider.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompProperties_NutrientProvider.cs index 3d04413..b854003 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompProperties_NutrientProvider.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientNetwork/CompProperties_NutrientProvider.cs @@ -6,6 +6,7 @@ namespace ArachnaeSwarm public class CompProperties_NutrientProvider : CompProperties_Facility { public float maxEfficiency = 0.9f; + public string lineTexturePath = "Things/Special/Power/Wire"; public CompProperties_NutrientProvider() {