share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 13129 9a328734e469
parent 13124 991db8fc45eb
child 13630 fe7d2bbf5f3f
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu Mar 08 21:05:10 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu Mar 08 21:28:02 2018 +0100
@@ -116,6 +116,9 @@
 
 local TeamRope = false
 
+local waypointCursor = false
+local waypointPreview = nil
+
 --------------------------
 -- hog and team tracking variales
 --------------------------
@@ -760,6 +763,7 @@
         wpCirc[wpCount] = nil
         SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, waypointColour)
         AddCaption(string.format(loc("Waypoint removed. Available points: %d"), wpLimit-wpCount))
+        PlaySound(sndBump)
     else
         PlaySound(sndDenied)
         AddCaption(loc("No waypoint to be removed!"))
@@ -916,9 +920,15 @@
                                 -- still in placement mode
                         end
 
-                end
-        end
-
+        	end
+		if not racerActive and not gameBegun and GetCurAmmoType() == amAirAttack then
+			waypointCursor = true
+		else
+			waypointCursor = false
+		end
+	else
+		waypointCursor = false
+	end
 
         -- has the player started his tumbling spree?
         if (CurrentHedgehog ~= nil) then
@@ -957,6 +967,20 @@
 
 end
 
+function onGameTick()
+	if waypointCursor then
+		if not waypointPreview then
+			waypointPreview = AddVisualGear(CursorX, CursorY, vgtCircle, 0, true)
+		end
+		SetVisualGearValues(waypointPreview, CursorX, CursorY, 200, 200, 0, 0, 0, div(wpRad, 5), 5, waypointColourAtPlacement)
+	else
+		if waypointPreview then
+			DeleteVisualGear(waypointPreview)
+			waypointPreview = nil
+		end
+	end
+end
+
 function onGearResurrect(gear)
 
         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)