share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua
changeset 14876 543729d313f5
parent 14776 1aea457856e2
child 14898 4596357d002d
equal deleted inserted replaced
14875:12ffbbf81ee1 14876:543729d313f5
    48 
    48 
    49 ]]
    49 ]]
    50 
    50 
    51 HedgewarsScriptLoad("/Scripts/Locale.lua")
    51 HedgewarsScriptLoad("/Scripts/Locale.lua")
    52 HedgewarsScriptLoad("/Scripts/Animate.lua")
    52 HedgewarsScriptLoad("/Scripts/Animate.lua")
       
    53 HedgewarsScriptLoad("/Scripts/Utils.lua")
    53 
    54 
    54 -----------------------------Constants---------------------------------
    55 -----------------------------Constants---------------------------------
    55 choiceAccepted = 1
    56 choiceAccepted = 1
    56 choiceRefused = 2
    57 choiceRefused = 2
    57 choiceAttacked = 3
    58 choiceAttacked = 3
   154 wave2Anim = {}
   155 wave2Anim = {}
   155 wave2DeadAnim = {}
   156 wave2DeadAnim = {}
   156 wave3DeadAnim = {}
   157 wave3DeadAnim = {}
   157 
   158 
   158 vCircs = {}
   159 vCircs = {}
       
   160 
       
   161 trackedMines = {}
   159 -----------------------------Animations--------------------------------
   162 -----------------------------Animations--------------------------------
   160 function Wave2Reaction()
   163 function Wave2Reaction()
   161   local i = 1
   164   local i = 1
   162   local gearr = nil
   165   local gearr = nil
   163   while nativeDead[i] == true do
   166   while nativeDead[i] == true do
   935 
   938 
   936 function RestoreCyborg()
   939 function RestoreCyborg()
   937   if cyborgHidden == true then
   940   if cyborgHidden == true then
   938     RestoreHog(cyborg)
   941     RestoreHog(cyborg)
   939     cyborgHidden = false
   942     cyborgHidden = false
       
   943     -- Clear mines around cyborg
       
   944     local vaporized = 0
       
   945     for mine, _ in pairs(trackedMines) do
       
   946        if GetHealth(mine) and GetHealth(cyborg) and gearIsInBox(mine, GetX(cyborg) - 50, GetY(cyborg) - 50, 100, 100) == true then
       
   947           AddVisualGear(GetX(mine), GetY(mine), vgtSmoke, 0, false)
       
   948           DeleteGear(mine)
       
   949           vaporized = vaporized + 1
       
   950        end
       
   951     end
       
   952     if vaporized > 0 then
       
   953        PlaySound(sndVaporize)
       
   954     end
   940   end
   955   end
   941 end
   956 end
   942 
   957 
   943 function SetupPlace()
   958 function SetupPlace()
   944   startNativesNum = nativesNum
   959   startNativesNum = nativesNum
  1081   end
  1096   end
  1082   ExecuteAfterAnimations()
  1097   ExecuteAfterAnimations()
  1083   CheckEvents()
  1098   CheckEvents()
  1084 end
  1099 end
  1085 
  1100 
       
  1101 function onGearAdd(gear)
       
  1102   local gt = GetGearType(gear)
       
  1103   if gt == gtMine or gt == gtSMine or gt == gtAirMine then
       
  1104     trackedMines[gear] = true
       
  1105   end
       
  1106 end
       
  1107 
  1086 function onGearDelete(gear)
  1108 function onGearDelete(gear)
       
  1109   local gt = GetGearType(gear)
       
  1110   if gt == gtMine or gt == gtSMine or gt == gtAirMine then
       
  1111     trackedMines[gear] = nil
       
  1112   end
       
  1113 
  1087   for i = 1, 7 do
  1114   for i = 1, 7 do
  1088     if gear == natives[i] then
  1115     if gear == natives[i] then
  1089       if nativeDead[i] ~= true then
  1116       if nativeDead[i] ~= true then
  1090         freshDead = nativeNames[i]
  1117         freshDead = nativeNames[i]
  1091       end
  1118       end