share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
changeset 10670 638af9cb922b
parent 10036 3be36d2fdca6
child 11301 fa18940f290d
--- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Sun Dec 14 03:32:11 2014 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua	Sun Dec 14 12:26:16 2014 +0900
@@ -77,8 +77,6 @@
 --local margin
 local wallsLeft = 0
 
-local highestY = 0
-local surferTimer = 0
 local hasSurfed = false
 local allWallsHit = false
 
@@ -356,25 +354,14 @@
 
 end
 
-function CheckSurfer()
-
-	if GetY(CurrentHedgehog) > highestY then
-		highestY = GetY(CurrentHedgehog)
+function onGearWaterSkip(gear)
+	if gear == CurrentHedgehog then
+		hasSurfed = true
+		AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2)
 	end
-
-	if (highestY == (WaterLine-8)) and (hasSurfed == false)  then
-
-		surferTimer = surferTimer +1
-		if (surferTimer == 40) then
-			hasSurfed = true
-			AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2)
-		end
-	end
-
 end
 
 
-
 function WallHit(id, zXMin,zYMin, zWidth, zHeight)
 
 	if wTouched[id] == false then
@@ -588,10 +575,8 @@
 
 	allowCrate = true
 
-	surferTimer = 0
 	hasSurfed = false
 	allWallsHit = false
-	highestY = 0
 
 	crateG = nil
 
@@ -650,8 +635,6 @@
 		--AddCaption(Map)
 		--AddCaption(RightX ..";" .. GetX(CurrentHedgehog))
 
-		CheckSurfer()
-
 		gTimer = gTimer + 1
 		if gTimer == 25 then
 			gTimer = 1