diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 7cdd6ef..e6c7719 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Defs/AbilityDefs/Abilities_TrackingCharge.xml b/1.6/1.6/Defs/AbilityDefs/Abilities_TrackingCharge.xml index bd9904e..fb0e415 100644 --- a/1.6/1.6/Defs/AbilityDefs/Abilities_TrackingCharge.xml +++ b/1.6/1.6/Defs/AbilityDefs/Abilities_TrackingCharge.xml @@ -39,6 +39,9 @@ 6 Blunt ARA_Flyer_TrackingCharge + 600 + 2.5 + Pawn_Melee_BigBash_HitPawn diff --git a/Source/ArachnaeSwarm/Abilities/CompProperties_TrackingCharge.cs b/Source/ArachnaeSwarm/Abilities/CompProperties_TrackingCharge.cs index db76cb4..f770f25 100644 --- a/Source/ArachnaeSwarm/Abilities/CompProperties_TrackingCharge.cs +++ b/Source/ArachnaeSwarm/Abilities/CompProperties_TrackingCharge.cs @@ -11,6 +11,9 @@ namespace ArachnaeSwarm public float inertiaDistance = 3f; public DamageDef collisionDamageDef; public ThingDef flyerDef; + public int maxFlightTicks = 300; // Default 5 seconds timeout + public float collisionRadius = 1.5f; + public SoundDef impactSound; public CompProperties_TrackingCharge() { diff --git a/Source/ArachnaeSwarm/Abilities/PawnFlyer_TrackingCharge.cs b/Source/ArachnaeSwarm/Abilities/PawnFlyer_TrackingCharge.cs index de8bea8..2edbe83 100644 --- a/Source/ArachnaeSwarm/Abilities/PawnFlyer_TrackingCharge.cs +++ b/Source/ArachnaeSwarm/Abilities/PawnFlyer_TrackingCharge.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Linq; using Verse.AI; using System.Collections.Generic; +using Verse.Sound; namespace ArachnaeSwarm { @@ -18,6 +19,8 @@ namespace ArachnaeSwarm public DamageDef collisionDamageDef; public LocalTargetInfo primaryTarget; public int maxFlightTicks; + public float collisionRadius; + public SoundDef impactSound; // --- Internal state --- private Vector3 currentSpeed; @@ -114,8 +117,12 @@ namespace ArachnaeSwarm float calculatedDamage = this.initialDamage + (this.distanceTraveled * this.damagePerTile); 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 primaryTarget.Thing.TakeDamage(dinfo); homing = false; diff --git a/Source/ArachnaeSwarm/Abilities/Verb_CastAbilityTrackingCharge.cs b/Source/ArachnaeSwarm/Abilities/Verb_CastAbilityTrackingCharge.cs index 71f2a6f..2c07dce 100644 --- a/Source/ArachnaeSwarm/Abilities/Verb_CastAbilityTrackingCharge.cs +++ b/Source/ArachnaeSwarm/Abilities/Verb_CastAbilityTrackingCharge.cs @@ -46,17 +46,9 @@ namespace ArachnaeSwarm trackingCharge.inertiaDistance = props.inertiaDistance; trackingCharge.collisionDamageDef = props.collisionDamageDef; trackingCharge.primaryTarget = this.currentTarget; - - // --- Dynamic Timeout Calculation --- - float flightSpeed = props.flyerDef.pawnFlyer.flightSpeed; - 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; + trackingCharge.maxFlightTicks = props.maxFlightTicks; + trackingCharge.collisionRadius = props.collisionRadius; + trackingCharge.impactSound = props.impactSound; // Setup and spawn trackingCharge.StartFlight(this.CasterPawn, this.currentTarget.Cell);