diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index f70778e..8456ad8 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_Building.xml b/1.6/1.6/Defs/Thing_building/ARA_Building.xml index d0114d4..f856ded 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_Building.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_Building.xml @@ -499,80 +499,7 @@ - - ARA_MorphableResearchBench - - - 以阿拉克涅织域种为核心形成的活体结构,是推进虫群高级研究的必须建筑。该建筑无法建造,只能通过阿拉克涅织域种变形得到。 - ArachnaeSwarm.Building_Morphable - Normal - (2,2) - - ArachnaeSwarm/Building/ARA_MorphableResearchBench - Graphic_Single - CutoutComplex - (2.5,2.5) - - Building - Impassable - false - 0.8 - 0 - ARA_Creep - - 1000 - 2800 - 1.0 - 1.0 - - 2600 - Item - - Laboratory - 0.8 - false - - - -
  • - ARA_InsectCreep - 3 -
  • -
  • - ResearchSpeedFactor -
  • -
  • - - 1.0 - - - 离开织座 - - - 使织域种离开织座,恢复移动状态。 - - ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph -
  • -
  • - - -
  • ARA_InsectJelly
  • - - - 2.0 - false - 虫蜜 - 没有营养 - -
  • - -
  • ARA_NutrientNetworkTower
  • - - -
    -
    - + ARA_SmartThermostat @@ -643,93 +570,4 @@ - - ARA_JellyVat - - 一个阿拉克涅虫族活体组织,可以充分利用活体钜菌的溶解能力,通过消化生物质,来分泌出营养丰富的阿拉克涅虫蜜。 - Building - - ArachnaeSwarm/Building/ARA_JellyVat - Graphic_Single - CutoutComplex - (2.2,2.2) - - (1.6, 0.5, 1.6) - (0,0,-0.1) - - - -
  • ARA_Technology_6GUT
  • -
    - (2,2) - Normal - - 0 - - 150 - 25 - - false - 0 - Building - PassThroughOnly - ARA_Creep - 50 - - 250 - 2800 - 1.0 - - -
  • PlaceWorker_PreventInteractionSpotOverlap
  • -
    - 0.8 - (0,0,-1) - true - ARA_Buildings - 2600 - Item - - Laboratory - 0.8 - - ARA_Creep - -
  • -
  • - - 120000 - 120000 - - -
  • - ARA_InsectJelly - 60 -
  • - - true - -
  • - Biomass - 生物质 - - -
  • MeatRaw
  • -
  • PlantFoodRaw
  • - - -
  • Milk
  • -
  • InsectJelly
  • -
    - - 50 - 30 - true - -
  • - ARA_InsectCreep - 6 -
  • -
    -
    \ No newline at end of file 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 242a19c..d58e1a8 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml @@ -176,7 +176,7 @@
  • ARA_NutrientNetworkTower
  • - +
  • ARA_InsectCreep 6 @@ -495,4 +495,206 @@
  • + + + ARA_MorphableResearchBench + + + 以阿拉克涅织域种为核心形成的活体结构,是推进虫群高级研究的必须建筑。该建筑无法建造,只能通过阿拉克涅织域种变形得到。 + ArachnaeSwarm.Building_Morphable + Normal + (2,2) + + ArachnaeSwarm/Building/ARA_MorphableResearchBench + Graphic_Single + CutoutComplex + (2.5,2.5) + + Building + Impassable + false + 0.8 + 0 + ARA_Creep + + 1000 + 2800 + 1.0 + 1.0 + + 2600 + Item + + Laboratory + 0.8 + false + + + +
  • + ARA_InsectCreep + 3 +
  • +
  • + ResearchSpeedFactor +
  • +
  • + + 1.0 + + + 离开织座 + + + 使织域种离开织座,恢复移动状态。 + + ArachnaeSwarm/UI/Abilities/ARA_Ability_Morph +
  • +
  • + + +
  • ARA_InsectJelly
  • + + + 2.0 + false + 虫蜜 + 没有营养 + +
  • + +
  • ARA_NutrientNetworkTower
  • + + +
    +
    + + + ARA_JellyVat + + 一个阿拉克涅虫族活体组织,可以充分利用活体钜菌的溶解能力,通过消化生物质,来分泌出营养丰富的阿拉克涅虫蜜。 + Building + + ArachnaeSwarm/Building/ARA_JellyVat + Graphic_Single + CutoutComplex + (2.2,2.2) + + (1.6, 0.5, 1.6) + (0,0,-0.1) + + + +
  • ARA_Technology_6GUT
  • +
    + (2,2) + Normal + + 0 + + 150 + 25 + + false + 0 + Building + PassThroughOnly + ARA_Creep + 50 + + 250 + 2800 + 1.0 + + +
  • PlaceWorker_PreventInteractionSpotOverlap
  • +
    + 0.8 + (0,0,-1) + true + ARA_Buildings + 2600 + Item + + Laboratory + 0.8 + + ARA_Creep + +
  • + + +
  • + Biomass + 生物质 + 生物质 + + +
  • MeatRaw
  • +
  • PlantFoodRaw
  • + + +
  • Milk
  • +
  • InsectJelly
  • +
    + + 50 + 0 + true + + true + true + +
  • + 虫蜜 + 虫蜜 + + 100.0 + 0 + true + + + +
  • ARA_InsectJelly
  • + + + + true + true + true + +
  • + 200 + 1 + 2000 + 1 +
  • + + +
  • + + CompRefuelable + + 0.99 +
  • + +
  • + ARA_InsectCreep + 6 +
  • +
    +
    \ No newline at end of file diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 85f6577..6b46fbc 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -145,6 +145,7 @@ + diff --git a/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs b/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs new file mode 100644 index 0000000..411fa1a --- /dev/null +++ b/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs @@ -0,0 +1,58 @@ +using System; +using System.Linq; +using RimWorld; +using Verse; + +namespace ArachnaeSwarm +{ + // Properties for the new component + public class CompProperties_AutoEjector : CompProperties + { + public int checkInterval = 250; // Check roughly every 4 seconds + public float ejectAtPercent = 1.0f; // Eject when fuel reaches this percentage of max capacity (1.0 = 100%) + public Type targetComp = typeof(CompRefuelable); // The specific CompRefuelable class to target, can be overridden in XML + + public CompProperties_AutoEjector() + { + this.compClass = typeof(CompAutoEjector); + } + } + + // The component logic + public class CompAutoEjector : ThingComp + { + private CompProperties_AutoEjector Props => (CompProperties_AutoEjector)this.props; + private CompRefuelable refuelableComp; + + public override void PostSpawnSetup(bool respawningAfterLoad) + { + base.PostSpawnSetup(respawningAfterLoad); + + // Find the specific refuelable component specified in XML + this.refuelableComp = this.parent.GetComps() + .FirstOrDefault(comp => comp.GetType() == this.Props.targetComp); + + if (this.refuelableComp == null) + { + Log.Warning($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} could not find a CompRefuelable of type '{this.Props.targetComp.FullName}' to monitor."); + } + } + + public override void CompTick() + { + base.CompTick(); + + // Check if we have a valid refuelable comp and it's time to check + if (this.refuelableComp != null && + this.parent.IsHashIntervalTick(this.Props.checkInterval)) + { + // Check if fuel has reached or exceeded the configured percentage of the MAX capacity + if (this.refuelableComp.FuelPercentOfMax >= this.Props.ejectAtPercent) + { + // Call the public EjectFuel() method. + this.refuelableComp.EjectFuel(); + } + } + } + } +} \ No newline at end of file