TrophyRace: Hide mission panel when player shoots rope
authorWuzzy <Wuzzy2@mail.ru>
Thu, 15 Feb 2018 19:03:04 +0100
changeset 13016 c819675d4f4f
parent 13015 d92c364f004d
child 13017 d82fec121f31
TrophyRace: Hide mission panel when player shoots rope
share/hedgewars/Data/Maps/TrophyRace/map.lua
--- a/share/hedgewars/Data/Maps/TrophyRace/map.lua	Thu Feb 15 18:56:00 2018 +0100
+++ b/share/hedgewars/Data/Maps/TrophyRace/map.lua	Thu Feb 15 19:03:04 2018 +0100
@@ -97,9 +97,11 @@
         lasthog = nil
 end
 
-function onHogAttack()
+function onHogAttack(ammoType)
     if TurnTimeLeft == 0 then
         killHog()
+    elseif ammoType == amRope then
+        HideMission()
     end
 end
 
@@ -131,10 +133,10 @@
         if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
             reached = true
             local ttime = GameTime-startTime
-            --give it a sound;)
+            -- give it a sound ;)
             if ttime < besttime then
                 PlaySound (sndHomerun)
-            else
+            elseif ttime > worsttime then
                 PlaySound (sndHellish)
             end
             for i = 0, numhhs - 1 do
@@ -205,17 +207,8 @@
         times[numhhs] = 0
         numhhs = numhhs + 1
     end
---    elseif GetGearType(gear) == gtRope then -- rope is shot
 end
 
---function onGearDelete(gear)
---    if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
---        --TurnTimeLeft = 0 -- end turn or not? hm...
---        lasthog = CurrentHedgehog
---        
---    end
---end
-
 function onAchievementsDeclaration()
     for team,time in pairs(bestTimes) do
         DeclareAchievement("rope race", team, "TrophyRace", time)