HedgeEditor: Reliably change mission text on weapon switch
authorWuzzy <almikes@aol.com>
Sat, 09 Apr 2016 11:15:14 +0200
changeset 12012 ad7205e66578
parent 12011 86cd92f64979
child 12013 9b4abde68e3b
HedgeEditor: Reliably change mission text on weapon switch
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 10:33:08 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Sat Apr 09 11:15:14 2016 +0200
@@ -2496,9 +2496,12 @@
 
 end
 
-function updateHelp()
-
-	if (GetCurAmmoType() ~= amGirder) and (GetCurAmmoType() ~= amRubber) and (GetCurAmmoType() ~= amAirAttack) then
+function updateHelp(curAmmoType)
+	if curAmmoType == nil then
+		curAmmoType = GetCurAmmoType()
+	end
+
+	if (curAmmoType ~= amGirder) and (curAmmoType ~= amRubber) and (curAmmoType ~= amAirAttack) then
 
 		if not hedgeEditorMissionPanelShown then
 			showHedgeEditorMissionPanel()
@@ -2808,6 +2811,16 @@
 
 end
 
+function onSetWeapon(ammoType)
+	curWep = ammoType
+	updateHelp(ammoType)
+end
+
+function onSlot()
+	curWep = GetCurAmmoType()
+	updateHelp(ammoType)
+end
+
 -- called in onGameTick()
 function HandleHedgeEditor()
 
@@ -2947,6 +2960,8 @@
 				SetVisualGearValues(sSprite, nil, nil, 0, 0, nil, nil, 10000, nil, 10000 )
 			end
 
+			updateHelp()
+
 		end
 
 	end