share/hedgewars/Data/Maps/ClimbHome/map.lua
changeset 13155 25de976a7b9a
parent 13023 acba432d34b1
child 13170 98a0edb4bb5a
--- a/share/hedgewars/Data/Maps/ClimbHome/map.lua	Sat Mar 10 01:46:51 2018 +0100
+++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua	Sat Mar 10 03:27:18 2018 +0100
@@ -26,8 +26,11 @@
 local HogsAreInvulnerable = false
 local WaterRise = nil
 local Cake = nil
+local CakeWarning = false
+local CakeFireWarning = false
 local CakeTries = 0
 local addCake = true
+local takeASeat = false
 local Stars = {}
 local tauntNoo = false
 local jokeAwardNavy = nil
@@ -110,10 +113,11 @@
 
 function onGearDelete(gear)
     if gear == MrMine then
-        AddCaption(loc("Once you set off the proximity trigger, Mr. Mine is not your friend"), 0xFFFFFFFF, capgrpMessage)
+        AddCaption(loc("Once you set off the proximity trigger, Mr. Mine is not your friend"), 0xFFFFFFFF, capgrpMessage2)
         MrMine = nil
     elseif GetGearType(gear) == gtCake then
         Cake = nil
+        CakeWarning = false
     elseif GetGearType(gear) == gtHedgehog then
 	onGameTick20()
 	onGearDamage(gear, 0)
@@ -181,6 +185,7 @@
     YouWon = false
     YouLost = false
     tauntNoo = false
+    takeASeat = false
     recordBroken = false
     currTeam = GetHogTeamName(CurrentHedgehog)
     if CurrentHedgehog ~= nil then
@@ -224,6 +229,7 @@
 --end
 
 function FireBoom(x,y,d) -- going to add for rockets too
+    PlaySound(sndExplosion)
     AddVisualGear(x,y,vgtExplosion,0,false)
     -- should approximate circle by removing corners
     --if BoomFire == nil then BoomFire = {} end
@@ -317,9 +323,19 @@
             local cx,cy = GetGearPosition(Cake)
             if y < cy-1500 then DeleteGear(Cake) end
 
-            if Cake ~= nil and GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then
-                FireBoom(cx,cy,200) -- todo animate
-                DeleteGear(Cake)
+            if Cake ~= nil and GetHealth(Cake) < 999980 then
+                if not CakeWarning and gearIsInCircle(CurrentHedgehog,cx,cy,1350) then
+                    AddCaption(loc("Warning: Fire cake detected"))
+                    CakeWarning = true
+                end
+                if gearIsInCircle(CurrentHedgehog,cx,cy,450) then
+                    if not CakeFireWarning then
+                        AddCaption(loc("Don't touch the flames!"))
+                        CakeFireWarning = true
+                    end
+                    FireBoom(cx,cy,200) -- todo animate
+                    DeleteGear(Cake)
+                end
             end
         end
         if band(GetState(CurrentHedgehog),gstHHDriven) == 0 then
@@ -413,7 +429,7 @@
             end
             -- FIXME: Hog is also in winning box if it just walks into the chair from the left, touching it. Intentional?
             if not YouWon and not YouLost and gearIsInBox(CurrentHedgehog, 1920, 252, 50, 50) then
-                AddCaption(loc("Victory!"))
+                AddCaption(loc("Victory!"), 0xFFFFFFFF, capgrpGameState)
                 ShowMission(loc("Climb Home"),
                             loc("Made it!"),
                             string.format(loc("Ahhh, home, sweet home. Made it in %d seconds."), roundedFinishTime),
@@ -448,7 +464,7 @@
                     (not MrMine or (MrMine and band(GetState(MrMine), gstAttacking) == 0)) then
                 -- Player managed to reach home in multiplayer.
                 -- Stop hog, disable controls, celebrate victory and continue the game after 4 seconds.
-                AddCaption(string.format(loc("%s climbed home in %d seconds!"), GetHogName(CurrentHedgehog), roundedFinishTime))
+                AddCaption(string.format(loc("%s climbed home in %d seconds!"), GetHogName(CurrentHedgehog), roundedFinishTime), 0xFFFFFFFF, capgrpGameState)
                 SendStat(siCustomAchievement, string.format(loc("%s (%s) reached home in %.3f seconds."), GetHogName(CurrentHedgehog), GetHogTeamName(CurrentHedgehog), finishTime))
                 makeMultiPlayerWinnerStat(CurrentHedgehog)
                 PlaySound(sndVictory, CurrentHedgehog)
@@ -473,6 +489,11 @@
             else
                 SendStat(siClanHealth, tostring(getActualHeight(y)), GetHogTeamName(CurrentHedgehog))
             end
+            -- If player is inside home, tell player to take a seat.
+            if not takeASeat and gearIsInBox(CurrentHedgehog, 1765, 131, 244, 189) then
+                AddCaption(loc("Welcome home! Please take a seat"))
+                takeASeat = true
+            end
     
             -- play taunts
             if not YouWon and not YouLost then