ACF5: Also clear crates around cyborg
authorWuzzy <Wuzzy2@mail.ru>
Sun, 16 Jun 2019 13:27:14 +0200
changeset 15167 7416f6319de9
parent 15166 d20e52a646e7
child 15168 bcb98009ad39
ACF5: Also clear crates around cyborg
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Sun Jun 16 12:19:43 2019 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua	Sun Jun 16 13:27:14 2019 +0200
@@ -158,7 +158,7 @@
 
 vCircs = {}
 
-trackedMines = {}
+trackedNonCyborgGears = {}
 -----------------------------Animations--------------------------------
 function Wave2Reaction()
   local i = 1
@@ -938,12 +938,12 @@
   if cyborgHidden == true then
     RestoreHog(cyborg)
     cyborgHidden = false
-    -- Clear mines around cyborg
+    -- Clear mines and crates around cyborg
     local vaporized = 0
-    for mine, _ in pairs(trackedMines) do
-       if GetHealth(mine) and GetHealth(cyborg) and gearIsInBox(mine, GetX(cyborg) - 50, GetY(cyborg) - 50, 100, 100) == true then
-          AddVisualGear(GetX(mine), GetY(mine), vgtSmoke, 0, false)
-          DeleteGear(mine)
+    for gear, _ in pairs(trackedNonCyborgGears) do
+       if GetHealth(gear) and GetHealth(cyborg) and gearIsInBox(gear, GetX(cyborg) - 50, GetY(cyborg) - 50, 100, 100) == true then
+          AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
+          DeleteGear(gear)
           vaporized = vaporized + 1
        end
     end
@@ -1098,15 +1098,15 @@
 
 function onGearAdd(gear)
   local gt = GetGearType(gear)
-  if gt == gtMine or gt == gtSMine or gt == gtAirMine then
-    trackedMines[gear] = true
+  if gt == gtMine or gt == gtSMine or gt == gtAirMine or gt == gtCase then
+    trackedNonCyborgGears[gear] = true
   end
 end
 
 function onGearDelete(gear)
   local gt = GetGearType(gear)
-  if gt == gtMine or gt == gtSMine or gt == gtAirMine then
-    trackedMines[gear] = nil
+  if gt == gtMine or gt == gtSMine or gt == gtAirMine or gt == gtCase then
+    trackedNonCyborgGears[gear] = nil
   end
 
   for i = 1, 7 do