暂存
This commit is contained in:
Binary file not shown.
@@ -39,6 +39,9 @@
|
|||||||
<inertiaDistance>6</inertiaDistance>
|
<inertiaDistance>6</inertiaDistance>
|
||||||
<collisionDamageDef>Blunt</collisionDamageDef>
|
<collisionDamageDef>Blunt</collisionDamageDef>
|
||||||
<flyerDef>ARA_Flyer_TrackingCharge</flyerDef>
|
<flyerDef>ARA_Flyer_TrackingCharge</flyerDef>
|
||||||
|
<maxFlightTicks>600</maxFlightTicks> <!-- 7.5 seconds timeout -->
|
||||||
|
<collisionRadius>2.5</collisionRadius> <!-- Larger collision radius -->
|
||||||
|
<impactSound>Pawn_Melee_BigBash_HitPawn</impactSound>
|
||||||
</li>
|
</li>
|
||||||
</comps>
|
</comps>
|
||||||
</AbilityDef>
|
</AbilityDef>
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ namespace ArachnaeSwarm
|
|||||||
public float inertiaDistance = 3f;
|
public float inertiaDistance = 3f;
|
||||||
public DamageDef collisionDamageDef;
|
public DamageDef collisionDamageDef;
|
||||||
public ThingDef flyerDef;
|
public ThingDef flyerDef;
|
||||||
|
public int maxFlightTicks = 300; // Default 5 seconds timeout
|
||||||
|
public float collisionRadius = 1.5f;
|
||||||
|
public SoundDef impactSound;
|
||||||
|
|
||||||
public CompProperties_TrackingCharge()
|
public CompProperties_TrackingCharge()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Reflection;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Verse.AI;
|
using Verse.AI;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Verse.Sound;
|
||||||
|
|
||||||
namespace ArachnaeSwarm
|
namespace ArachnaeSwarm
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,8 @@ namespace ArachnaeSwarm
|
|||||||
public DamageDef collisionDamageDef;
|
public DamageDef collisionDamageDef;
|
||||||
public LocalTargetInfo primaryTarget;
|
public LocalTargetInfo primaryTarget;
|
||||||
public int maxFlightTicks;
|
public int maxFlightTicks;
|
||||||
|
public float collisionRadius;
|
||||||
|
public SoundDef impactSound;
|
||||||
|
|
||||||
// --- Internal state ---
|
// --- Internal state ---
|
||||||
private Vector3 currentSpeed;
|
private Vector3 currentSpeed;
|
||||||
@@ -114,8 +117,12 @@ namespace ArachnaeSwarm
|
|||||||
float calculatedDamage = this.initialDamage + (this.distanceTraveled * this.damagePerTile);
|
float calculatedDamage = this.initialDamage + (this.distanceTraveled * this.damagePerTile);
|
||||||
var dinfo = new DamageInfo(this.collisionDamageDef, calculatedDamage, 1f, -1, this.FlyingPawn);
|
var dinfo = new DamageInfo(this.collisionDamageDef, calculatedDamage, 1f, -1, this.FlyingPawn);
|
||||||
|
|
||||||
if (!hasHitPrimaryTarget && homing && primaryTarget.HasThing && primaryTarget.Thing.Spawned && (this.exactPosition - primaryTarget.Thing.DrawPos).sqrMagnitude < 1.5f * 1.5f)
|
if (!hasHitPrimaryTarget && homing && primaryTarget.HasThing && primaryTarget.Thing.Spawned && (this.exactPosition - primaryTarget.Thing.DrawPos).sqrMagnitude < this.collisionRadius * this.collisionRadius)
|
||||||
{
|
{
|
||||||
|
if (this.impactSound != null)
|
||||||
|
{
|
||||||
|
SoundStarter.PlayOneShot(this.impactSound, new TargetInfo(this.exactPosition.ToIntVec3(), this.Map));
|
||||||
|
}
|
||||||
hasHitPrimaryTarget = true; // Mark as hit to prevent re-triggering
|
hasHitPrimaryTarget = true; // Mark as hit to prevent re-triggering
|
||||||
primaryTarget.Thing.TakeDamage(dinfo);
|
primaryTarget.Thing.TakeDamage(dinfo);
|
||||||
homing = false;
|
homing = false;
|
||||||
|
|||||||
@@ -46,17 +46,9 @@ namespace ArachnaeSwarm
|
|||||||
trackingCharge.inertiaDistance = props.inertiaDistance;
|
trackingCharge.inertiaDistance = props.inertiaDistance;
|
||||||
trackingCharge.collisionDamageDef = props.collisionDamageDef;
|
trackingCharge.collisionDamageDef = props.collisionDamageDef;
|
||||||
trackingCharge.primaryTarget = this.currentTarget;
|
trackingCharge.primaryTarget = this.currentTarget;
|
||||||
|
trackingCharge.maxFlightTicks = props.maxFlightTicks;
|
||||||
// --- Dynamic Timeout Calculation ---
|
trackingCharge.collisionRadius = props.collisionRadius;
|
||||||
float flightSpeed = props.flyerDef.pawnFlyer.flightSpeed;
|
trackingCharge.impactSound = props.impactSound;
|
||||||
if (flightSpeed <= 0)
|
|
||||||
{
|
|
||||||
Log.Error("flyerDef has no flightSpeed, cannot calculate timeout.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Timeout is twice the time it would take to fly the max range in a straight line
|
|
||||||
int maxTicks = (int)((this.verbProps.range / flightSpeed) * 2.0f);
|
|
||||||
trackingCharge.maxFlightTicks = maxTicks;
|
|
||||||
|
|
||||||
// Setup and spawn
|
// Setup and spawn
|
||||||
trackingCharge.StartFlight(this.CasterPawn, this.currentTarget.Cell);
|
trackingCharge.StartFlight(this.CasterPawn, this.currentTarget.Cell);
|
||||||
|
|||||||
Reference in New Issue
Block a user