From 7fdc049079a40f77a22ad0bd55c3bea46665a10f Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 12 Jul 2019 20:39:07 +0200 Subject: [PATCH] Update Fox.lua --- Moose Development/Moose/Functional/Fox.lua | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Moose Development/Moose/Functional/Fox.lua b/Moose Development/Moose/Functional/Fox.lua index 99c838a06..153c2c1b3 100644 --- a/Moose Development/Moose/Functional/Fox.lua +++ b/Moose Development/Moose/Functional/Fox.lua @@ -972,6 +972,12 @@ function FOX:onafterMissileLaunch(From, Event, To, missile) -- Distance from missile to target. local distance=missileCoord:Get3DDistance(targetCoord) + -- Distance missile to shooter. + local distShooter=nil + if missile.shooterUnit and missile.shooterUnit:IsAlive() then + distShooter=missileCoord:Get3DDistance(missile.shooterUnit:GetCoordinate()) + end + -- Debug output. if self.Debug then @@ -1011,16 +1017,18 @@ function FOX:onafterMissileLaunch(From, Event, To, missile) self:MissileDestroyed(missile) -- Little explosion for the visual effect. - if self.explosionpower>0 and distance>=50 then + if self.explosionpower>0 and distance>50 and (distShooter==nil or (distShooter and distShooter>50)) then missileCoord:Explosion(self.explosionpower) end - - -- Message to target. - local text=string.format("Destroying missile. %s", self:_DeadText()) - MESSAGE:New(text, 10):ToGroup(target:GetGroup()) - - -- Increase dead counter. + + -- Target was a player. if missile.targetPlayer then + + -- Message to target. + local text=string.format("Destroying missile. %s", self:_DeadText()) + MESSAGE:New(text, 10):ToGroup(target:GetGroup()) + + -- Increase dead counter. missile.targetPlayer.dead=missile.targetPlayer.dead+1 end