酸爆种和土豆雷
This commit is contained in:
Binary file not shown.
@@ -68,7 +68,7 @@
|
||||
<defName>ARA_Proj_Trap</defName>
|
||||
<label>阿拉克涅酸爆茧</label>
|
||||
<projectile>
|
||||
<spawnsThingDef>Arachnae_Trap_ReleaseRandom</spawnsThingDef>
|
||||
<spawnsThingDef>Arachnae_AcidlingTrap</spawnsThingDef>
|
||||
</projectile>
|
||||
</ThingDef>
|
||||
<AbilityDef>
|
||||
|
||||
@@ -360,6 +360,28 @@
|
||||
</li>
|
||||
</lifeStages>
|
||||
</PawnKindDef>
|
||||
<PawnKindDef ParentName="ARA_InsectKindBase">
|
||||
<defName>ArachnaeBase_Race_Acidling</defName>
|
||||
<label>阿拉克涅酸爆种</label>
|
||||
<race>ArachnaeBase_Race_Acidling</race>
|
||||
<lifeStages>
|
||||
<li>
|
||||
<bodyGraphicData>
|
||||
<texPath>Things/Pawn/Animal/Spelopede/Spelopede</texPath>
|
||||
<drawSize>1</drawSize>
|
||||
<color>(156,148,125)</color>
|
||||
<shadowData>
|
||||
<volume>(0.4, 0.5, 0.37)</volume>
|
||||
<offset>(0,0,-0.15)</offset>
|
||||
</shadowData>
|
||||
</bodyGraphicData>
|
||||
<dessicatedBodyGraphicData>
|
||||
<texPath>Things/Pawn/Animal/Spelopede/Dessicated_Spelopede</texPath>
|
||||
<drawSize>1</drawSize>
|
||||
</dessicatedBodyGraphicData>
|
||||
</li>
|
||||
</lifeStages>
|
||||
</PawnKindDef>
|
||||
<PawnKindDef ParentName="ARA_InsectKindBase">
|
||||
<defName>ArachnaeBase_Race_Maid</defName>
|
||||
<label>阿拉克涅家政种</label>
|
||||
|
||||
@@ -162,11 +162,11 @@
|
||||
<showGizmoOnNonPlayerControlled>true</showGizmoOnNonPlayerControlled>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_HunterExplosion">
|
||||
<explosionRadius>6</explosionRadius> <!-- Mapped from smokeRadius -->
|
||||
<explosionRadius>3.9</explosionRadius> <!-- Mapped from smokeRadius -->
|
||||
<explosionDamageType>ARA_AcidBurn</explosionDamageType>
|
||||
<explosionDamageAmount>40</explosionDamageAmount>
|
||||
<armorPenetration>0.5</armorPenetration>
|
||||
<soundExplosion>Explosion_Smoke</soundExplosion>
|
||||
<explosionSound>Explosion_Smoke</explosionSound>
|
||||
<postExplosionSpawnThingDef>ARA_AcidGasCloud</postExplosionSpawnThingDef>
|
||||
<postExplosionSpawnChance>1</postExplosionSpawnChance>
|
||||
<postExplosionSpawnThingCount>1</postExplosionSpawnThingCount>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</ThingDef>
|
||||
|
||||
<!-- Gas : Thing -->
|
||||
<ThingDef ParentName="DRM_BaseGas">
|
||||
<ThingDef ParentName="ARA_BaseGas">
|
||||
<defName>ARA_AcidGasCloud</defName>
|
||||
<label>阿拉克涅酸雾</label>
|
||||
<graphicData>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Defs>
|
||||
<ThingDef ParentName="TrapReleaseBase">
|
||||
<defName>Arachnae_Trap_ReleaseRandom</defName>
|
||||
<ThingDef>
|
||||
<defName>Arachnae_AcidlingTrap</defName>
|
||||
<label>阿拉克涅酸爆茧</label>
|
||||
<description>一种阿拉克涅休眠茧,内藏有休眠中的阿拉克涅虫族。如果靠太近则会唤醒其中的虫族。</description>
|
||||
<thingClass>ArachnaeSwarm.Building_TrapReleaseRandom</thingClass>
|
||||
<category>Building</category>
|
||||
<!-- 基础外观和物理属性 -->
|
||||
<size>(1,1)</size>
|
||||
<altitudeLayer>Building</altitudeLayer>
|
||||
@@ -14,9 +15,15 @@
|
||||
<leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
|
||||
<rotatable>false</rotatable>
|
||||
<tickerType>Normal</tickerType>
|
||||
<building>
|
||||
<isTrap>true</isTrap>
|
||||
<trapDestroyOnSpring>true</trapDestroyOnSpring>
|
||||
<expandHomeArea>false</expandHomeArea>
|
||||
<ai_chillDestination>false</ai_chillDestination>
|
||||
<claimable>false</claimable>
|
||||
</building>
|
||||
<repairEffect>EatVegetarian</repairEffect>
|
||||
<filthLeaving>Filth_Slime</filthLeaving>
|
||||
<category>Buildings</category>
|
||||
<costList>
|
||||
<Steel>20</Steel>
|
||||
</costList>
|
||||
@@ -35,12 +42,17 @@
|
||||
<offset>(0,0,-0.1)</offset>
|
||||
</shadowData>
|
||||
</graphicData>
|
||||
<!-- XML-assignable fields from Building_TrapReleaseRandom -->
|
||||
<!-- 正确的配置方式 -->
|
||||
<modExtensions>
|
||||
<li Class="ArachnaeSwarm.TrapReleaseRandomExtension">
|
||||
<detectionRadius>25</detectionRadius>
|
||||
<countToSpawn>3</countToSpawn>
|
||||
<pawnKinds>
|
||||
<li>ArachnaeBase_Race_Acidling</li>
|
||||
<li>ArachnaeBase_Race_Acid</li>
|
||||
</pawnKinds>
|
||||
</li>
|
||||
</modExtensions>
|
||||
<!-- 组件:发光、生命周期、延迟地面生成(与风格示例对应) -->
|
||||
<comps>
|
||||
<li Class="CompProperties_Glower">
|
||||
@@ -196,6 +196,7 @@
|
||||
<Compile Include="HediffGiver_RandomWithSeverity.cs" />
|
||||
<Compile Include="CompHunterExplosion.cs" />
|
||||
<Compile Include="CompProperties_HunterExplosion.cs" />
|
||||
<Compile Include="TrapReleaseRandomExtension.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Morphable\CompProperties_Morphable.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<PawnKindDef> pawnKinds = new List<PawnKindDef>();
|
||||
private TrapReleaseRandomExtension Extension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (extension == null)
|
||||
{
|
||||
extension = def.GetModExtension<TrapReleaseRandomExtension>();
|
||||
}
|
||||
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<Pawn> 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)
|
||||
|
||||
12
Source/ArachnaeSwarm/TrapReleaseRandomExtension.cs
Normal file
12
Source/ArachnaeSwarm/TrapReleaseRandomExtension.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class TrapReleaseRandomExtension : DefModExtension
|
||||
{
|
||||
public int countToSpawn = 1;
|
||||
public List<PawnKindDef> pawnKinds = new List<PawnKindDef>();
|
||||
public float detectionRadius = 20f;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user