just merging if statements
authornemo
Wed, 08 Nov 2017 14:12:46 -0500
changeset 12830 b986a8b8cd56
parent 12829 c75781937859
child 12831 42003e235a46
just merging if statements
share/hedgewars/Data/Maps/ClimbHome/map.lua
--- a/share/hedgewars/Data/Maps/ClimbHome/map.lua	Mon Nov 06 22:26:54 2017 +0100
+++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua	Wed Nov 08 14:12:46 2017 -0500
@@ -308,20 +308,22 @@
         end
     end
 
-    if CurrentHedgehog ~= nil then x,y = GetGearPosition(CurrentHedgehog) end
-    if Cake ~= nil and CurrentHedgehog ~= nil then
-        local cx,cy = GetGearPosition(Cake)
-        if y < cy-1500 then
-            DeleteGear(Cake)
-            Cake = nil
+    if CurrentHedgehog ~= nil then
+        x,y = GetGearPosition(CurrentHedgehog)
+        if Cake ~= nil then
+            local cx,cy = GetGearPosition(Cake)
+            if y < cy-1500 then
+                DeleteGear(Cake)
+                Cake = nil
+            end
+
+            if GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then
+                FireBoom(cx,cy,200) -- todo animate
+                DeleteGear(Cake)
+                Cake = nil
+            end
         end
-
-        if Cake ~= nil and GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then
-            FireBoom(cx,cy,200) -- todo animate
-            DeleteGear(Cake)
-            Cake = nil
-        end
-    end
+     end
     
     if CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog),gstHHDriven) == 0 then
         for f,i in pairs(Fire) do -- takes too long to fall otherwise