Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/DelayedDamage.js
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (Attacking.TestCollision(target, data.position, lateness) && | ||||
Attacking.HandleAttackEffects(target, data.type, data.attackData, data.attacker, data.attackerOwner)) | Attacking.HandleAttackEffects(target, data.type, data.attackData, data.attacker, data.attackerOwner)) | ||||
{ | { | ||||
cmpProjectileManager.RemoveProjectile(data.projectileId); | cmpProjectileManager.RemoveProjectile(data.projectileId); | ||||
return; | return; | ||||
} | } | ||||
// If we didn't hit the main target look for nearby units. | // If we didn't hit the main target look for nearby units. | ||||
let ents = Attacking.EntitiesNearPoint(Vector2D.from3D(data.position), this.MISSILE_HIT_RADIUS, | let ents = Attacking.EntitiesNearPoint(Vector2D.from3D(data.position), this.MISSILE_HIT_RADIUS, | ||||
Attacking.GetPlayersToDamage(data.attackerOwner, data.friendlyFire)); | Attacking.GetPlayersToDamage(data.attackerOwner, data.friendlyFire), IID_Attackable); | ||||
for (let ent of ents) | for (let ent of ents) | ||||
{ | { | ||||
if (!Attacking.TestCollision(ent, data.position, lateness) || | if (!Attacking.TestCollision(ent, data.position, lateness) || | ||||
!Attacking.HandleAttackEffects(ent, data.type, data.attackData, data.attacker, data.attackerOwner)) | !Attacking.HandleAttackEffects(ent, data.type, data.attackData, data.attacker, data.attackerOwner)) | ||||
continue; | continue; | ||||
cmpProjectileManager.RemoveProjectile(data.projectileId); | cmpProjectileManager.RemoveProjectile(data.projectileId); | ||||
break; | break; | ||||
} | } | ||||
}; | }; | ||||
Engine.RegisterSystemComponentType(IID_DelayedDamage, "DelayedDamage", DelayedDamage); | Engine.RegisterSystemComponentType(IID_DelayedDamage, "DelayedDamage", DelayedDamage); |
Wildfire Games · Phabricator