Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/DelayedDamage.js
Show All 14 Lines | |||||
* @param {number} data.target - The entity id of the target. | * @param {number} data.target - The entity id of the target. | ||||
* @param {number} data.attacker - The entity id of the attacker. | * @param {number} data.attacker - The entity id of the attacker. | ||||
* @param {number} data.attackerOwner - The player id of the owner of the attacker. | * @param {number} data.attackerOwner - The player id of the owner of the attacker. | ||||
* @param {Vector2D} data.origin - The origin of the projectile hit. | * @param {Vector2D} data.origin - The origin of the projectile hit. | ||||
* @param {Vector3D} data.position - The expected position of the target. | * @param {Vector3D} data.position - The expected position of the target. | ||||
* @param {number} data.projectileId - The id of the projectile. | * @param {number} data.projectileId - The id of the projectile. | ||||
* @param {Vector3D} data.direction - The unit vector defining the direction. | * @param {Vector3D} data.direction - The unit vector defining the direction. | ||||
* @param {string} data.attackImpactSound - The name of the sound emited on impact. | * @param {string} data.attackImpactSound - The name of the sound emited on impact. | ||||
* @param {boolean} data.friendlyFire - A flag indicating whether allied entities can also be damaged. | |||||
* ***When splash damage*** | * ***When splash damage*** | ||||
* @param {boolean} data.splash.friendlyFire - A flag indicating if allied entities are also damaged. | * @param {boolean} data.splash.friendlyFire - A flag indicating if allied entities are also damaged. | ||||
* @param {number} data.splash.radius - The radius of the splash damage. | * @param {number} data.splash.radius - The radius of the splash damage. | ||||
* @param {string} data.splash.shape - The shape of the splash range. | * @param {string} data.splash.shape - The shape of the splash range. | ||||
* @param {Object} data.splash.attackData - same as attackData, for splash. | * @param {Object} data.splash.attackData - same as attackData, for splash. | ||||
*/ | */ | ||||
DelayedDamage.prototype.MissileHit = function(data, lateness) | DelayedDamage.prototype.MissileHit = function(data, lateness) | ||||
{ | { | ||||
Show All 31 Lines | if (Attacking.TestCollision(data.target, data.position, lateness)) | ||||
Attacking.HandleAttackEffects(data.type, data.attackData, data.target, data.attacker, data.attackerOwner); | Attacking.HandleAttackEffects(data.type, data.attackData, data.target, data.attacker, data.attackerOwner); | ||||
return; | return; | ||||
} | } | ||||
let targetPosition = Attacking.InterpolatedLocation(data.target, lateness); | let targetPosition = Attacking.InterpolatedLocation(data.target, lateness); | ||||
if (!targetPosition) | if (!targetPosition) | ||||
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 cmpPlayer = QueryPlayerIDInterface(data.attackerOwner); | let ents = Attacking.EntitiesNearPoint(Vector2D.from3D(data.position), targetPosition.horizDistanceTo(data.position) * 2, | ||||
Silier: could you please to break this to multiple lines ? | |||||
let ents = Attacking.EntitiesNearPoint(Vector2D.from3D(data.position), targetPosition.horizDistanceTo(data.position) * 2, cmpPlayer.GetEnemies()); | Attacking.GetPlayersToDamage(data.attackerOwner, data.friendlyFire)); | ||||
for (let ent of ents) | for (let ent of ents) | ||||
{ | { | ||||
if (!Attacking.TestCollision(ent, data.position, lateness)) | if (!Attacking.TestCollision(ent, data.position, lateness)) | ||||
continue; | continue; | ||||
Attacking.HandleAttackEffects(data.type, data.attackData, ent, data.attacker, data.attackerOwner); | Attacking.HandleAttackEffects(data.type, data.attackData, ent, data.attacker, data.attackerOwner); | ||||
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
could you please to break this to multiple lines ?