HedgeEditor: Don't change mode in background when pressing left/right w/o amAirAttack selected
authorWuzzy <Wuzzy2@mail.ru>
Sat, 28 Oct 2017 07:23:53 +0200
changeset 12796 a19ae0db7ab5
parent 12795 abc9a99418cc
child 12797 8fa21750470f
HedgeEditor: Don't change mode in background when pressing left/right w/o amAirAttack selected
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Oct 28 05:49:49 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Oct 28 07:23:53 2017 +0200
@@ -2973,7 +2973,6 @@
 
 		x,y = GetGearTarget(cGear)
 
-		AddCaption(GetGearPos(cGear))
 		if GetGearType(cGear) == gtAirAttack and GetCurAmmoType() == amAirAttack then
 			DeleteGear(cGear)
 			PlaceObject(x, y)
@@ -3225,27 +3224,29 @@
 ---------------------------------------------------------------
 function onLeft()
 
-	leftHeld = true
-	rightHeld = false
-
-	if preciseOn then
-		if cat[cIndex] == loc("Sprite Placement Mode") then
-			sFrame = sFrame - 1
-			if sFrame < 0 then
-				sFrame = reducedSpriteIDArrayFrames[pIndex] - 1
+	if (curWep == amAirAttack) then
+		leftHeld = true
+		rightHeld = false
+
+		if preciseOn then
+			if cat[cIndex] == loc("Sprite Placement Mode") then
+				sFrame = sFrame - 1
+				if sFrame < 0 then
+					sFrame = reducedSpriteIDArrayFrames[pIndex] - 1
+				end
 			end
-		end
-	else
-		pIndex = pIndex - 1
-		if pIndex == 0 then
-			pIndex = #pMode
-		end
-		if cat[cIndex] == loc("Sprite Placement Mode") then
-			sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
-		end
-
-		if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
-			showSecondaryMessage()
+		else
+			pIndex = pIndex - 1
+			if pIndex == 0 then
+				pIndex = #pMode
+			end
+			if cat[cIndex] == loc("Sprite Placement Mode") then
+				sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
+			end
+
+			if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
+				showSecondaryMessage()
+			end
 		end
 	end
 
@@ -3253,27 +3254,29 @@
 
 function onRight()
 
-	leftHeld = false
-	rightHeld = true
-
-	if preciseOn then
-		if cat[cIndex] == loc("Sprite Placement Mode") then
-			sFrame = sFrame + 1
-			if sFrame >= reducedSpriteIDArrayFrames[pIndex] then
-				sFrame = 0
+	if (curWep == amAirAttack) then
+		leftHeld = false
+		rightHeld = true
+
+		if preciseOn then
+			if cat[cIndex] == loc("Sprite Placement Mode") then
+				sFrame = sFrame + 1
+				if sFrame >= reducedSpriteIDArrayFrames[pIndex] then
+					sFrame = 0
+				end
 			end
-		end
-	else
-		pIndex = pIndex + 1
-		if pIndex > #pMode then
-			pIndex = 1
-		end
-		if cat[cIndex] == loc("Sprite Placement Mode") then
-			sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
-		end
-	
-		if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
-			showSecondaryMessage()
+		else
+			pIndex = pIndex + 1
+			if pIndex > #pMode then
+				pIndex = 1
+			end
+			if cat[cIndex] == loc("Sprite Placement Mode") then
+				sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
+			end
+
+			if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
+				showSecondaryMessage()
+			end
 		end
 	end