修追踪弹没目标
This commit is contained in:
Binary file not shown.
@@ -42,6 +42,11 @@
|
||||
<soundCast>RocketswarmLauncher_Fire</soundCast>
|
||||
<soundCastTail>GunTail_Heavy</soundCastTail>
|
||||
<muzzleFlashScale>12</muzzleFlashScale>
|
||||
<targetParams>
|
||||
<canTargetPawns>true</canTargetPawns>
|
||||
<canTargetLocations>true</canTargetLocations>
|
||||
<canTargetBuildings>true</canTargetBuildings>
|
||||
</targetParams>
|
||||
</li>
|
||||
</verbs>
|
||||
<costList Inherit="False">
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace WulaFallenEmpire
|
||||
|
||||
protected override void Impact(Thing hitThing, bool blockedByShield = false)
|
||||
{
|
||||
bool flag = blockedByShield || ExplosiveDef.explosionDelay == 0; // Use ExplosiveDef for explosionDelay
|
||||
bool flag = hitThing == null || blockedByShield || ExplosiveDef.explosionDelay == 0; // Use ExplosiveDef for explosionDelay
|
||||
if (flag)
|
||||
{
|
||||
this.Explode();
|
||||
|
||||
@@ -84,8 +84,13 @@ namespace WulaFallenEmpire
|
||||
|
||||
if (homing)
|
||||
{
|
||||
// 首先检查目标是否是一个有效的 Thing
|
||||
if (!intendedTarget.HasThing)
|
||||
{
|
||||
homing = false; // 如果目标是地面,则禁用追踪
|
||||
}
|
||||
// 如果目标消失或距离太远,停止追踪
|
||||
if (!intendedTarget.IsValid || !intendedTarget.Thing.Spawned || (intendedTarget.Cell.ToVector3() - ExactPosition).magnitude > def.projectile.speed * 2f) // 假设2倍速度为最大追踪距离
|
||||
else if (!intendedTarget.IsValid || !intendedTarget.Thing.Spawned || (intendedTarget.Cell.ToVector3() - ExactPosition).magnitude > def.projectile.speed * 2f) // 假设2倍速度为最大追踪距离
|
||||
{
|
||||
homing = false;
|
||||
destroyTicksAfterLosingTrack = TrackingDef.destroyTicksAfterLosingTrack.RandomInRange; // 失去追踪后根据XML配置的范围自毁
|
||||
|
||||
Reference in New Issue
Block a user