存天巢种

This commit is contained in:
2025-09-09 14:56:06 +08:00
parent b1a0a35b94
commit 6694ff2d62
10 changed files with 129 additions and 26 deletions

View File

@@ -155,6 +155,10 @@
<Compile Include="CompProperties_PawnFlight.cs" />
<Compile Include="HarmonyPatches.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="CompAbilityEffect_LaunchMultiProjectile.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Abilities\CompAbilityEffect_TrackingCharge.cs" />
<Compile Include="Abilities\CompProperties_TrackingCharge.cs" />
@@ -164,6 +168,19 @@
<ItemGroup>
<Compile Include="HediffComp_SpawnPawnOnRemoved.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Projectiles\BulletWithTrail.cs" />
<Compile Include="Projectiles\ExplosiveTrackingBulletDef.cs" />
<Compile Include="Projectiles\Projectile_ConfigurableHellsphereCannon.cs" />
<Compile Include="Projectiles\Projectile_CruiseMissile.cs" />
<Compile Include="Projectiles\Projectile_ExplosiveTrackingBullet.cs" />
<Compile Include="Projectiles\Projectile_ExplosiveWithTrail.cs" />
<Compile Include="Projectiles\Projectile_TrackingBullet.cs" />
<Compile Include="Projectiles\Projectile_WulaPenetratingBeam.cs" />
<Compile Include="Projectiles\Projectile_WulaPenetratingBullet.cs" />
<Compile Include="Projectiles\TrackingBulletDef.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 自定义清理任务删除obj文件夹中的临时文件 -->
<Target Name="CleanDebugFiles" AfterTargets="Build">

View File

@@ -0,0 +1,44 @@
using Verse;
using RimWorld;
namespace ArachnaeSwarm
{
public class CompProperties_AbilityLaunchMultiProjectile : CompProperties_AbilityLaunchProjectile
{
public int numProjectiles = 1;
public CompProperties_AbilityLaunchMultiProjectile()
{
compClass = typeof(CompAbilityEffect_LaunchMultiProjectile);
}
}
public class CompAbilityEffect_LaunchMultiProjectile : CompAbilityEffect
{
public new CompProperties_AbilityLaunchMultiProjectile Props => (CompProperties_AbilityLaunchMultiProjectile)props;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
for (int i = 0; i < Props.numProjectiles; i++)
{
LaunchProjectile(target);
}
}
private void LaunchProjectile(LocalTargetInfo target)
{
if (Props.projectileDef != null)
{
Pawn pawn = parent.pawn;
Projectile projectile = (Projectile)GenSpawn.Spawn(Props.projectileDef, pawn.Position, pawn.Map);
projectile.Launch(pawn, pawn.DrawPos, target, target, ProjectileHitFlags.IntendedTarget, parent.verb.preventFriendlyFire);
}
}
public override bool AICanTargetNow(LocalTargetInfo target)
{
return target.Pawn != null;
}
}
}

View File

@@ -10,6 +10,8 @@ namespace ArachnaeSwarm
public class HediffCompProperties_SpawnPawnOnRemoved : HediffCompProperties
{
public PawnKindDef pawnKindDef;
public float? fixedBiologicalAge; // 新增用于XML配置的固定生物年龄
public FloatRange? biologicalAgeRange; // 新增用于XML配置的生物年龄范围
public HediffCompProperties_SpawnPawnOnRemoved()
{
@@ -61,7 +63,9 @@ namespace ArachnaeSwarm
faction: this.casterFaction, // Use the stored faction
context: PawnGenerationContext.NonPlayer,
tile: -1,
forceGenerateNewPawn: true
forceGenerateNewPawn: true,
fixedBiologicalAge: Props.fixedBiologicalAge, // 使用XML配置的固定生物年龄
biologicalAgeRange: Props.biologicalAgeRange // 使用XML配置的生物年龄范围
));
if (newPawn != null)