酸爆种和土豆雷
This commit is contained in:
Binary file not shown.
@@ -68,7 +68,7 @@
|
|||||||
<defName>ARA_Proj_Trap</defName>
|
<defName>ARA_Proj_Trap</defName>
|
||||||
<label>阿拉克涅酸爆茧</label>
|
<label>阿拉克涅酸爆茧</label>
|
||||||
<projectile>
|
<projectile>
|
||||||
<spawnsThingDef>Arachnae_Trap_ReleaseRandom</spawnsThingDef>
|
<spawnsThingDef>Arachnae_AcidlingTrap</spawnsThingDef>
|
||||||
</projectile>
|
</projectile>
|
||||||
</ThingDef>
|
</ThingDef>
|
||||||
<AbilityDef>
|
<AbilityDef>
|
||||||
|
|||||||
@@ -360,6 +360,28 @@
|
|||||||
</li>
|
</li>
|
||||||
</lifeStages>
|
</lifeStages>
|
||||||
</PawnKindDef>
|
</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">
|
<PawnKindDef ParentName="ARA_InsectKindBase">
|
||||||
<defName>ArachnaeBase_Race_Maid</defName>
|
<defName>ArachnaeBase_Race_Maid</defName>
|
||||||
<label>阿拉克涅家政种</label>
|
<label>阿拉克涅家政种</label>
|
||||||
|
|||||||
@@ -162,11 +162,11 @@
|
|||||||
<showGizmoOnNonPlayerControlled>true</showGizmoOnNonPlayerControlled>
|
<showGizmoOnNonPlayerControlled>true</showGizmoOnNonPlayerControlled>
|
||||||
</li>
|
</li>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_HunterExplosion">
|
<li Class="ArachnaeSwarm.CompProperties_HunterExplosion">
|
||||||
<explosionRadius>6</explosionRadius> <!-- Mapped from smokeRadius -->
|
<explosionRadius>3.9</explosionRadius> <!-- Mapped from smokeRadius -->
|
||||||
<explosionDamageType>ARA_AcidBurn</explosionDamageType>
|
<explosionDamageType>ARA_AcidBurn</explosionDamageType>
|
||||||
<explosionDamageAmount>40</explosionDamageAmount>
|
<explosionDamageAmount>40</explosionDamageAmount>
|
||||||
<armorPenetration>0.5</armorPenetration>
|
<armorPenetration>0.5</armorPenetration>
|
||||||
<soundExplosion>Explosion_Smoke</soundExplosion>
|
<explosionSound>Explosion_Smoke</explosionSound>
|
||||||
<postExplosionSpawnThingDef>ARA_AcidGasCloud</postExplosionSpawnThingDef>
|
<postExplosionSpawnThingDef>ARA_AcidGasCloud</postExplosionSpawnThingDef>
|
||||||
<postExplosionSpawnChance>1</postExplosionSpawnChance>
|
<postExplosionSpawnChance>1</postExplosionSpawnChance>
|
||||||
<postExplosionSpawnThingCount>1</postExplosionSpawnThingCount>
|
<postExplosionSpawnThingCount>1</postExplosionSpawnThingCount>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</ThingDef>
|
</ThingDef>
|
||||||
|
|
||||||
<!-- Gas : Thing -->
|
<!-- Gas : Thing -->
|
||||||
<ThingDef ParentName="DRM_BaseGas">
|
<ThingDef ParentName="ARA_BaseGas">
|
||||||
<defName>ARA_AcidGasCloud</defName>
|
<defName>ARA_AcidGasCloud</defName>
|
||||||
<label>阿拉克涅酸雾</label>
|
<label>阿拉克涅酸雾</label>
|
||||||
<graphicData>
|
<graphicData>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Defs>
|
<Defs>
|
||||||
<ThingDef ParentName="TrapReleaseBase">
|
<ThingDef>
|
||||||
<defName>Arachnae_Trap_ReleaseRandom</defName>
|
<defName>Arachnae_AcidlingTrap</defName>
|
||||||
<label>阿拉克涅酸爆茧</label>
|
<label>阿拉克涅酸爆茧</label>
|
||||||
<description>一种阿拉克涅休眠茧,内藏有休眠中的阿拉克涅虫族。如果靠太近则会唤醒其中的虫族。</description>
|
<description>一种阿拉克涅休眠茧,内藏有休眠中的阿拉克涅虫族。如果靠太近则会唤醒其中的虫族。</description>
|
||||||
<thingClass>ArachnaeSwarm.Building_TrapReleaseRandom</thingClass>
|
<thingClass>ArachnaeSwarm.Building_TrapReleaseRandom</thingClass>
|
||||||
|
<category>Building</category>
|
||||||
<!-- 基础外观和物理属性 -->
|
<!-- 基础外观和物理属性 -->
|
||||||
<size>(1,1)</size>
|
<size>(1,1)</size>
|
||||||
<altitudeLayer>Building</altitudeLayer>
|
<altitudeLayer>Building</altitudeLayer>
|
||||||
@@ -14,9 +15,15 @@
|
|||||||
<leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
|
<leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
|
||||||
<rotatable>false</rotatable>
|
<rotatable>false</rotatable>
|
||||||
<tickerType>Normal</tickerType>
|
<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>
|
<repairEffect>EatVegetarian</repairEffect>
|
||||||
<filthLeaving>Filth_Slime</filthLeaving>
|
<filthLeaving>Filth_Slime</filthLeaving>
|
||||||
<category>Buildings</category>
|
|
||||||
<costList>
|
<costList>
|
||||||
<Steel>20</Steel>
|
<Steel>20</Steel>
|
||||||
</costList>
|
</costList>
|
||||||
@@ -35,12 +42,17 @@
|
|||||||
<offset>(0,0,-0.1)</offset>
|
<offset>(0,0,-0.1)</offset>
|
||||||
</shadowData>
|
</shadowData>
|
||||||
</graphicData>
|
</graphicData>
|
||||||
<!-- XML-assignable fields from Building_TrapReleaseRandom -->
|
<!-- 正确的配置方式 -->
|
||||||
|
<modExtensions>
|
||||||
|
<li Class="ArachnaeSwarm.TrapReleaseRandomExtension">
|
||||||
|
<detectionRadius>25</detectionRadius>
|
||||||
<countToSpawn>3</countToSpawn>
|
<countToSpawn>3</countToSpawn>
|
||||||
<pawnKinds>
|
<pawnKinds>
|
||||||
<li>ArachnaeBase_Race_Acidling</li>
|
<li>ArachnaeBase_Race_Acidling</li>
|
||||||
<li>ArachnaeBase_Race_Acid</li>
|
<li>ArachnaeBase_Race_Acid</li>
|
||||||
</pawnKinds>
|
</pawnKinds>
|
||||||
|
</li>
|
||||||
|
</modExtensions>
|
||||||
<!-- 组件:发光、生命周期、延迟地面生成(与风格示例对应) -->
|
<!-- 组件:发光、生命周期、延迟地面生成(与风格示例对应) -->
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="CompProperties_Glower">
|
<li Class="CompProperties_Glower">
|
||||||
@@ -196,6 +196,7 @@
|
|||||||
<Compile Include="HediffGiver_RandomWithSeverity.cs" />
|
<Compile Include="HediffGiver_RandomWithSeverity.cs" />
|
||||||
<Compile Include="CompHunterExplosion.cs" />
|
<Compile Include="CompHunterExplosion.cs" />
|
||||||
<Compile Include="CompProperties_HunterExplosion.cs" />
|
<Compile Include="CompProperties_HunterExplosion.cs" />
|
||||||
|
<Compile Include="TrapReleaseRandomExtension.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Morphable\CompProperties_Morphable.cs" />
|
<Compile Include="Morphable\CompProperties_Morphable.cs" />
|
||||||
|
|||||||
@@ -2,22 +2,72 @@ using System.Collections.Generic;
|
|||||||
using Verse;
|
using Verse;
|
||||||
using Verse.Sound;
|
using Verse.Sound;
|
||||||
using RimWorld;
|
using RimWorld;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace ArachnaeSwarm;
|
namespace ArachnaeSwarm;
|
||||||
|
|
||||||
public class Building_TrapReleaseRandom : Building_TrapReleaseEntity
|
public class Building_TrapReleaseRandom : Building_TrapReleaseEntity
|
||||||
{
|
{
|
||||||
// XML-assignable: number of pawns to spawn
|
private TrapReleaseRandomExtension extension;
|
||||||
public int countToSpawn = 1;
|
|
||||||
|
|
||||||
// XML-assignable: list of PawnKindDefs to choose from randomly when spawning
|
private TrapReleaseRandomExtension Extension
|
||||||
public List<PawnKindDef> pawnKinds = new List<PawnKindDef>();
|
{
|
||||||
|
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)
|
// 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)
|
protected override void SpringSub(Pawn p)
|
||||||
{
|
{
|
||||||
if (base.Spawned)
|
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