diff --git a/binaries/data/mods/public/simulation/components/Attack.js b/binaries/data/mods/public/simulation/components/Attack.js index 2e6401b429..28184392dc 100644 --- a/binaries/data/mods/public/simulation/components/Attack.js +++ b/binaries/data/mods/public/simulation/components/Attack.js @@ -412,14 +412,15 @@ Attack.prototype.GetTimers = function(type) return { "prepare": prepare, "repeat": repeat }; }; -Attack.prototype.GetSplashDamage = function(type) +Attack.prototype.GetSplashData = function(type) { if (!this.template[type].Splash) - return false; + return; return { "attackData": this.GetAttackEffectsData(type, true), "friendlyFire": this.template[type].Splash.FriendlyFire != "false", + "radius": ApplyValueModificationsToEntity("Attack/" + type + "/Splash/Range", +this.template[type].Splash.Range, this.entity), "shape": this.template[type].Splash.Shape, }; }; @@ -535,15 +536,10 @@ Attack.prototype.PerformAttack = function(type, target) "position": realTargetPosition, "direction": missileDirection, "projectileId": id, - "attackImpactSound": attackImpactSound + "attackImpactSound": attackImpactSound, + "splash": this.GetSplashData(type), }; - if (this.template[type].Splash) - data.splash = { - "friendlyFire": this.template[type].Splash.FriendlyFire != "false", - "radius": +this.template[type].Splash.Range, - "shape": this.template[type].Splash.Shape, - "attackData": this.GetAttackEffectsData(type, true), - }; + cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_DelayedDamage, "MissileHit", +this.template[type].Delay + timeToTarget * 1000, data); } else diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js index 855fb3d2c2..fd3c51b9dc 100644 --- a/binaries/data/mods/public/simulation/components/GuiInterface.js +++ b/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -418,7 +418,7 @@ GuiInterface.prototype.GetEntityState = function(player, ent) Object.assign(ret.attack[type], cmpAttack.GetAttackEffectsData(type)); - ret.attack[type].splash = cmpAttack.GetSplashDamage(type); + ret.attack[type].splash = cmpAttack.GetSplashData(type); if (ret.attack[type].splash) Object.assign(ret.attack[type].splash, cmpAttack.GetAttackEffectsData(type, true)); diff --git a/binaries/data/mods/public/simulation/components/tests/test_Attack.js b/binaries/data/mods/public/simulation/components/tests/test_Attack.js index f361231105..b99b13574e 100644 --- a/binaries/data/mods/public/simulation/components/tests/test_Attack.js +++ b/binaries/data/mods/public/simulation/components/tests/test_Attack.js @@ -184,7 +184,7 @@ attackComponentTest(undefined, true, (attacker, cmpAttack, defender) => { "repeat": 1000 }); - TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetSplashDamage("Ranged"), { + TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetSplashData("Ranged"), { "attackData": { "Damage": { "Hack": 0, @@ -199,6 +199,7 @@ attackComponentTest(undefined, true, (attacker, cmpAttack, defender) => { } }, "friendlyFire": false, + "radius": 10, "shape": "Circular" }); });