Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 490 Lines • ▼ Show 20 Lines | if (type == "Ranged") | ||||
timeToTarget = realHorizDistance / horizSpeed; | timeToTarget = realHorizDistance / horizSpeed; | ||||
let missileDirection = Vector3D.sub(realTargetPosition, selfPosition).div(realHorizDistance); | let missileDirection = Vector3D.sub(realTargetPosition, selfPosition).div(realHorizDistance); | ||||
// Launch the graphical projectile. | // Launch the graphical projectile. | ||||
let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager); | let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager); | ||||
let id = cmpProjectileManager.LaunchProjectileAtPoint(this.entity, realTargetPosition, horizSpeed, gravity); | let id = cmpProjectileManager.LaunchProjectileAtPoint(this.entity, realTargetPosition, horizSpeed, gravity); | ||||
let attackImpactSound = ""; | |||||
let cmpSound = Engine.QueryInterface(this.entity, IID_Sound); | |||||
if (cmpSound) | |||||
attackImpactSound = cmpSound.GetSoundGroup("attack_impact"); | |||||
let data = { | let data = { | ||||
"type": type, | "type": type, | ||||
"attacker": this.entity, | "attacker": this.entity, | ||||
"target": target, | "target": target, | ||||
"strengths": this.GetAttackStrengths(type), | "strengths": this.GetAttackStrengths(type), | ||||
"position": realTargetPosition, | "position": realTargetPosition, | ||||
"direction": missileDirection, | "direction": missileDirection, | ||||
"projectileId": id, | "projectileId": id, | ||||
"bonus": this.GetBonusTemplate(type), | "bonus": this.GetBonusTemplate(type), | ||||
"isSplash": false, | "isSplash": false, | ||||
"attackerOwner": attackerOwner | "attackerOwner": attackerOwner, | ||||
"attackImpactSound": attackImpactSound | |||||
}; | }; | ||||
if (this.template.Ranged.Splash) | if (this.template.Ranged.Splash) | ||||
{ | { | ||||
data.friendlyFire = this.template.Ranged.Splash.FriendlyFire != "false"; | data.friendlyFire = this.template.Ranged.Splash.FriendlyFire != "false"; | ||||
data.radius = +this.template.Ranged.Splash.Range; | data.radius = +this.template.Ranged.Splash.Range; | ||||
data.shape = this.template.Ranged.Splash.Shape; | data.shape = this.template.Ranged.Splash.Shape; | ||||
data.isSplash = true; | data.isSplash = true; | ||||
data.splashStrengths = this.GetAttackStrengths(type + ".Splash"); | data.splashStrengths = this.GetAttackStrengths(type + ".Splash"); | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator