Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 527 Lines • ▼ Show 20 Lines | if (cmpVisual) | ||||
actorName = cmpVisual.GetProjectileActor(); | actorName = cmpVisual.GetProjectileActor(); | ||||
let visualActorLaunchPoint = cmpVisual.GetProjectileLaunchPoint(); | let visualActorLaunchPoint = cmpVisual.GetProjectileLaunchPoint(); | ||||
if (visualActorLaunchPoint.length() > 0) | if (visualActorLaunchPoint.length() > 0) | ||||
launchPoint = visualActorLaunchPoint; | launchPoint = visualActorLaunchPoint; | ||||
} | } | ||||
let id = cmpProjectileManager.LaunchProjectileAtPoint(launchPoint, realTargetPosition, horizSpeed, gravity, actorName, impactActorName, impactAnimationLifetime); | let id = cmpProjectileManager.LaunchProjectileAtPoint(launchPoint, realTargetPosition, horizSpeed, gravity, actorName, impactActorName, impactAnimationLifetime); | ||||
let attackImpactSound = ""; | |||||
let cmpSound = Engine.QueryInterface(this.entity, IID_Sound); | |||||
if (cmpSound) | |||||
attackImpactSound = cmpSound.GetSoundGroup("attack_impact_" + type.toLowerCase()); | |||||
let data = { | let data = { | ||||
"type": type, | "type": type, | ||||
"attackData": this.GetAttackEffectsData(type), | "attackData": this.GetAttackEffectsData(type), | ||||
"target": target, | "target": target, | ||||
"source": this.entity, | |||||
Freagarach: Why add this? | |||||
"attacker": this.entity, | "attacker": this.entity, | ||||
"attackerOwner": attackerOwner, | "attackerOwner": attackerOwner, | ||||
"position": realTargetPosition, | "position": realTargetPosition, | ||||
"direction": missileDirection, | "direction": missileDirection, | ||||
"projectileId": id, | "projectileId": id, | ||||
"attackImpactSound": attackImpactSound, | |||||
"splash": this.GetSplashData(type), | "splash": this.GetSplashData(type), | ||||
"friendlyFire": this.template[type].Projectile.FriendlyFire == "true", | "friendlyFire": this.template[type].Projectile.FriendlyFire == "true", | ||||
}; | }; | ||||
cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_DelayedDamage, "MissileHit", +this.template[type].Delay + timeToTarget * 1000, data); | cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_DelayedDamage, "MissileHit", +this.template[type].Delay + timeToTarget * 1000, data); | ||||
} | } | ||||
else | else | ||||
{ | |||||
Attacking.HandleAttackEffects(target, type, this.GetAttackEffectsData(type), this.entity, attackerOwner); | Attacking.HandleAttackEffects(target, type, this.GetAttackEffectsData(type), this.entity, attackerOwner); | ||||
var impactSoundGroup = GetImpactSoundGroup(type, target, this.entity, false); | |||||
if (impactSoundGroup) | |||||
PlaySound(impactSoundGroup, this.entity); | |||||
} | |||||
}; | }; | ||||
Attack.prototype.OnValueModification = function(msg) | Attack.prototype.OnValueModification = function(msg) | ||||
{ | { | ||||
if (msg.component != "Attack") | if (msg.component != "Attack") | ||||
return; | return; | ||||
let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | ||||
Show All 27 Lines |
Wildfire Games · Phabricator
Why add this?