Racer: Fix weird water splashes after waypoint placement
authorWuzzy <Wuzzy2@mail.ru>
Mon, 16 Sep 2019 17:33:49 +0200
changeset 15431 8504fee3b601
parent 15430 330a2d7d520d
child 15432 2cde69c1c680
Racer: Fix weird water splashes after waypoint placement Does not affect official racer, as only waypoint placement is touched. The reason was that the air attack gear sometimes was not deleted fast enough so it might occassionally drop some air bombs (these are deleted now). Also, the airplane position was set to water level, which caused another water splash.
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Mon Sep 16 00:31:53 2019 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Mon Sep 16 17:33:49 2019 +0200
@@ -874,9 +874,9 @@
 
         -- airstrike detected, convert this into a potential waypoint spot
         if cGear ~= nil then
-                x,y = GetGearPosition(cGear)
+                local x,y = GetGearPosition(cGear)
                 if x > -9000 then
-                        x,y = GetGearTarget(cGear)
+                        local x,y = GetGearTarget(cGear)
 
 
                         if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
@@ -895,7 +895,7 @@
                 else
                         DeleteGear(cGear)
                 end
-        SetGearPosition(cGear, -10000, 0)
+        	SetGearPosition(cGear, -10000, y)
         end
 
 
@@ -1021,6 +1021,10 @@
                 SetEffect(gear, heResurrectable, 1)
         elseif GetGearType(gear) == gtAirAttack then
                 cGear = gear
+		local x,y = GetGearPosition(cGear)
+        	SetGearPosition(cGear, 10000, y)
+        elseif (not gameBegun) and GetGearType(gear) == gtAirBomb then
+		DeleteGear(gear)
         elseif GetGearType(gear) == gtRope and TeamRope then
             SetTag(gear,1)
             SetGearValues(gear,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,GetClanColor(GetHogClan(CurrentHedgehog)))