diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index d9a6d41..1571d3f 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/AbilityDefs/ARA_Abilities.xml b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml index 2def29c..119db37 100644 --- a/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml +++ b/1.6/1.6/Defs/AbilityDefs/ARA_Abilities.xml @@ -68,7 +68,7 @@ ARA_Proj_Trap - Arachnae_Trap_ReleaseRandom + Arachnae_AcidlingTrap diff --git a/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_Mutants_Configurable.xml b/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_Mutants.xml similarity index 100% rename from 1.6/1.6/Defs/HediffDefs/ARA_Hediffs_Mutants_Configurable.xml rename to 1.6/1.6/Defs/HediffDefs/ARA_Hediffs_Mutants.xml diff --git a/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml b/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml index d26725e..32fc667 100644 --- a/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml +++ b/1.6/1.6/Defs/PawnKindDef/ARA_PawnKinds.xml @@ -360,6 +360,28 @@ + + ArachnaeBase_Race_Acidling + + ArachnaeBase_Race_Acidling + +
  • + + Things/Pawn/Animal/Spelopede/Spelopede + 1 + (156,148,125) + + (0.4, 0.5, 0.37) + (0,0,-0.15) + + + + Things/Pawn/Animal/Spelopede/Dessicated_Spelopede + 1 + +
  • +
    +
    ArachnaeBase_Race_Maid diff --git a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceDroneSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceDroneSwarm.xml index 03a781d..8b6602e 100644 --- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceDroneSwarm.xml +++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceDroneSwarm.xml @@ -162,11 +162,11 @@ true
  • - 6 + 3.9 ARA_AcidBurn 40 0.5 - Explosion_Smoke + Explosion_Smoke ARA_AcidGasCloud 1 1 diff --git a/1.6/1.6/Defs/Thing_Misc/ARA_Things_Gas.xml b/1.6/1.6/Defs/Thing_Misc/ARA_Things_Gas.xml index c624340..6cb81c8 100644 --- a/1.6/1.6/Defs/Thing_Misc/ARA_Things_Gas.xml +++ b/1.6/1.6/Defs/Thing_Misc/ARA_Things_Gas.xml @@ -41,7 +41,7 @@ - + ARA_AcidGasCloud diff --git a/1.6/1.6/Defs/Thing_building/ARA_ThingDefs_TrapReleaseRandom.xml b/1.6/1.6/Defs/Thing_building/ARA_AcidlingTrap.xml similarity index 68% rename from 1.6/1.6/Defs/Thing_building/ARA_ThingDefs_TrapReleaseRandom.xml rename to 1.6/1.6/Defs/Thing_building/ARA_AcidlingTrap.xml index 5f22f6f..02f0aca 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_ThingDefs_TrapReleaseRandom.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_AcidlingTrap.xml @@ -1,10 +1,11 @@ - - Arachnae_Trap_ReleaseRandom + + Arachnae_AcidlingTrap 一种阿拉克涅休眠茧,内藏有休眠中的阿拉克涅虫族。如果靠太近则会唤醒其中的虫族。 ArachnaeSwarm.Building_TrapReleaseRandom + Building (1,1) Building @@ -14,9 +15,15 @@ false false Normal + + true + true + false + false + false + EatVegetarian Filth_Slime - Buildings 20 @@ -35,12 +42,17 @@ (0,0,-0.1) - - 3 - -
  • ArachnaeBase_Race_Acidling
  • -
  • ArachnaeBase_Race_Acid
  • - + + +
  • + 25 + 3 + +
  • ArachnaeBase_Race_Acidling
  • +
  • ArachnaeBase_Race_Acid
  • + + +
  • diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index a443725..8932bae 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -196,6 +196,7 @@ + diff --git a/Source/ArachnaeSwarm/Building_TrapReleaseRandom.cs b/Source/ArachnaeSwarm/Building_TrapReleaseRandom.cs index 89ae517..714aca6 100644 --- a/Source/ArachnaeSwarm/Building_TrapReleaseRandom.cs +++ b/Source/ArachnaeSwarm/Building_TrapReleaseRandom.cs @@ -2,22 +2,72 @@ using System.Collections.Generic; using Verse; using Verse.Sound; using RimWorld; +using System.Linq; namespace ArachnaeSwarm; public class Building_TrapReleaseRandom : Building_TrapReleaseEntity { - // XML-assignable: number of pawns to spawn - public int countToSpawn = 1; + private TrapReleaseRandomExtension extension; - // XML-assignable: list of PawnKindDefs to choose from randomly when spawning - public List pawnKinds = new List(); + private TrapReleaseRandomExtension Extension + { + get + { + if (extension == null) + { + extension = def.GetModExtension(); + } + return extension; + } + } - protected override int CountToSpawn => countToSpawn; + protected override int CountToSpawn => Extension?.countToSpawn ?? 1; - protected override PawnKindDef PawnToSpawn => (pawnKinds == null || pawnKinds.Count == 0) ? PawnKindDefOf.Drone_Hunter : pawnKinds.RandomElement(); + protected override PawnKindDef PawnToSpawn + { + get + { + if (Extension == null || Extension.pawnKinds.NullOrEmpty()) + { + return PawnKindDefOf.Drone_Hunter; + } + return Extension.pawnKinds.RandomElement(); + } + } + + public override void SpawnSetup(Map map, bool respawningAfterLoad) + { + if (this.Faction == null) + { + this.SetFaction(Faction.OfPlayer); + } + base.SpawnSetup(map, respawningAfterLoad); + } // Ensure spawned pawns use the building's faction when possible; otherwise spawn as wild (null faction) + protected override void Tick() + { + if (!base.Spawned || base.IsStunned || !this.IsHashIntervalTick(60)) + { + return; + } + + float radius = (Extension != null) ? Extension.detectionRadius : 20f; + + Map map = base.Map; + IEnumerable enumerable = map.mapPawns.AllPawnsSpawned.Where((Pawn x) => !x.IsPsychologicallyInvisible() && x.HostileTo(this) && x.Position.DistanceTo(base.Position) <= radius); + IntVec3 position = base.Position; + foreach (Pawn item in enumerable) + { + if ((base.Faction != Faction.OfPlayer || (!item.IsPrisoner && !item.Downed)) && GenSight.LineOfSight(position, item.Position, map)) + { + Spring(item); + break; + } + } + } + protected override void SpringSub(Pawn p) { if (base.Spawned) diff --git a/Source/ArachnaeSwarm/TrapReleaseRandomExtension.cs b/Source/ArachnaeSwarm/TrapReleaseRandomExtension.cs new file mode 100644 index 0000000..5071319 --- /dev/null +++ b/Source/ArachnaeSwarm/TrapReleaseRandomExtension.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using Verse; + +namespace ArachnaeSwarm +{ + public class TrapReleaseRandomExtension : DefModExtension + { + public int countToSpawn = 1; + public List pawnKinds = new List(); + public float detectionRadius = 20f; + } +} \ No newline at end of file