Madboy James
Member
Hi, I have a delayed damage action for a grenade explosion, but the damage is only applied to one target.
It seems that the last object processed in the hit objects loop in the Explode() method caches, and is pulled as the context for all the impact actions for the explosion.
To clarify,
Lets say an explosion hits three characters, with a damage action with a delay of 1 second.
The following code runs for characters A, B, and C.
(lines 221 to 233 Explosion.cs)
A second later, three impact actions trigger, but the context for all of them only have the data from Object C, causing Object C to take damage 3 times.
This does not happen with 0 delay, and works as expected.
I'm not sure if this is user error or a bug.
Can someone confirm if I am misusing the item action delay, or if this is unexpected functionality?
It seems that the last object processed in the hit objects loop in the Explode() method caches, and is pulled as the context for all the impact actions for the explosion.
To clarify,
Lets say an explosion hits three characters, with a damage action with a delay of 1 second.
The following code runs for characters A, B, and C.
(lines 221 to 233 Explosion.cs)
C#:
var impactData = GetImpactData();
{
impactData.SetImpactSource(this);
impactData.SetImpactTarget(hitCollider);
impactData.ImpactPosition = closestPoint;
impactData.ImpactDirection = hitDirection;
impactData.ImpactStrength = damageModifier;
}
var impactCallback = m_CachedImpactCallbackContext;
impactCallback.ImpactCollisionData = impactData;
impactCallback.ImpactDamageData = m_ImpactDamageData;
m_ImpactActionGroup.OnImpact(impactCallback, true);
A second later, three impact actions trigger, but the context for all of them only have the data from Object C, causing Object C to take damage 3 times.
This does not happen with 0 delay, and works as expected.
I'm not sure if this is user error or a bug.
Can someone confirm if I am misusing the item action delay, or if this is unexpected functionality?