merge more construction mode patches by Wuzzy
authorsheepluva
Thu, 28 Apr 2016 20:07:10 +0200
changeset 11767 660599c04bd8
parent 11762 6874644a2d00 (current diff)
parent 11766 25c6188084c2 (diff)
child 11769 54a1ac4123cd
merge more construction mode patches by Wuzzy
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Thu Apr 28 18:32:50 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Thu Apr 28 20:07:10 2016 +0200
@@ -951,18 +951,17 @@
 
 				{amGrenade,		"amGrenade",		0, loc("Grenade"), 			2*placeholder},
 				{amClusterBomb,	"amClusterBomb",	0, loc("Cluster Bomb"), 	3*placeholder},
-				{amMolotov, 	"amMolotov",		0, loc("Molotov Cocktail"), 3*placeholder},
 				{amWatermelon, 	"amWatermelon",		0, loc("Watermelon Bomb"), 25*placeholder},
 				{amHellishBomb,	"amHellishBomb",	0, loc("Hellish hand-grenade"), 25*placeholder},
+				{amMolotov, 	"amMolotov",		0, loc("Molotov Cocktail"), 3*placeholder},
 				{amGasBomb, 	"amGasBomb",		0, loc("Old Limburger"), 		3*placeholder},
 
 				{amShotgun,		"amShotgun",		0, loc("Shotgun"), 			2*placeholder},
 				{amDEagle,		"amDEagle",			0, loc("Desert Eagle"), 	2*placeholder},
-				{amFlamethrower,"amFlamethrower",	0, loc("Flamethrower"), 	4*placeholder},
 				{amSniperRifle,	"amSniperRifle",	0, loc("Sniper Rifle"), 	3*placeholder},
 				--{amSineGun, 	"amSineGun",		0, loc("Sine Gun"), 			6*placeholder},
+				{amFlamethrower,"amFlamethrower",	0, loc("Flamethrower"), 	4*placeholder},
 				{amIceGun, 		"amIceGun",			0, loc("Freezer"), 			15*placeholder},
-				{amLandGun,		"amLandGun",		0, loc("Land Spray"), 	5*placeholder},
 
 				{amFirePunch, 	"amFirePunch",		0, loc("Shoryuken"), 		3*placeholder},
 				{amWhip,		"amWhip",			0, loc("Whip"), 			1*placeholder},
@@ -980,9 +979,9 @@
 
 				--{amAirAttack,	"amAirAttack",		0, loc("Air Attack"), 		10*placeholder},
 				--{amMineStrike,	"amMineStrike",		0, loc("Mine Strike"), 		15*placeholder},
-				--{amDrillStrike,	"amDrillStrike",	0, loc("Drill Strike"), 15*placeholder},
 				--{amNapalm, 		"amNapalm",			0, loc("Napalm"), 		15*placeholder},
 				--{amPiano,		"amPiano",			0, loc("Piano Strike"), 	40*placeholder},
+				--{amDrillStrike,	"amDrillStrike",	0, loc("Drill Strike"), 15*placeholder},
 
 				{amKnife,		"amKnife",			0, loc("Cleaver"), 			2*placeholder},
 
@@ -992,29 +991,29 @@
 
  utilArray =
 				{
+				{amPickHammer,		"amPickHammer",		0, loc("Pick Hammer"), 		2*placeholder},
 				{amBlowTorch, 		"amBlowTorch",		0, loc("Blow Torch"), 		4*placeholder},
-				{amPickHammer,		"amPickHammer",		0, loc("Pick Hammer"), 		2*placeholder},
 				--{amGirder, 			"amGirder",			0, loc("Girder"), 		4*placeholder},
+				{amLandGun,		"amLandGun",		0, loc("Land Spray"), 	5*placeholder},
 				--{amRubber, 			"amRubber",			0, loc("Rubber"), 	5*placeholder},
-				{amPortalGun,		"amPortalGun",		0, loc("Portable Portal Device"), 15*placeholder},
 
 				{amRope, 			"amRope",			0, loc("Rope"), 			7*placeholder},
 				{amParachute, 		"amParachute",		0, loc("Parachute"), 		2*placeholder},
 				--{amTeleport,		"amTeleport",		0, loc("Teleport"), 		6*placeholder},
 				{amJetpack,			"amJetpack",		0, loc("Flying Saucer"), 	8*placeholder},
+				{amPortalGun,		"amPortalGun",		0, loc("Portable Portal Device"), 15*placeholder},
 
 				{amInvulnerable,	"amInvulnerable",	0, loc("Invulnerable"), 	5*placeholder},
 				{amLaserSight,		"amLaserSight",		0, loc("Laser Sight"), 		2*placeholder},
 				{amVampiric,		"amVampiric",		0, loc("Vampirism"), 		6*placeholder},
+				--{amResurrector, 	"amResurrector",	0, loc("Resurrector"), 		8*placeholder},
+				--{amTardis, 			"amTardis",			0, loc("Time Box"), 			2*placeholder},
 
+				--{amSwitch,			"amSwitch",			0, loc("Switch Hog"), 		4*placeholder}
 				{amLowGravity, 		"amLowGravity",		0, loc("Low Gravity"), 		4*placeholder},
 				{amExtraDamage, 	"amExtraDamage",	0, loc("Extra Damage"), 	6*placeholder},
 				{amExtraTime,		"amExtraTime",		0, loc("Extra Time"), 		8*placeholder}
 
-				--{amResurrector, 	"amResurrector",	0, loc("Resurrector"), 		8*placeholder},
-				--{amTardis, 			"amTardis",			0, loc("Time Box"), 			2*placeholder},
-
-				--{amSwitch,			"amSwitch",			0, loc("Switch Hog"), 		4*placeholder}
 				}
 
 ----------------------------
@@ -1032,9 +1031,9 @@
 				"Mine Placement Mode",
 				"Sticky Mine Placement Mode",
 				"Barrel Placement Mode",
-				"Health Crate Placement Mode",
 				"Weapon Crate Placement Mode",
 				"Utility Crate Placement Mode",
+				"Health Crate Placement Mode",
 				"Structure Placement Mode"
 				}
 
@@ -1045,9 +1044,9 @@
 				{loc("Mine Placement Mode"),false},
 				{loc("Sticky Mine Placement Mode"),false},
 				{loc("Barrel Placement Mode"),false},
-				{loc("Health Crate Placement Mode"),false},
 				{loc("Weapon Crate Placement Mode"),false},
 				{loc("Utility Crate Placement Mode"),false},
+				{loc("Health Crate Placement Mode"),false},
 				{loc("Structure Placement Mode"),false},
 				{loc("Teleportation Mode"),false}
 				}
@@ -1273,7 +1272,8 @@
 			end
 
 			-- update display selection criteria
-			if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber) then
+			if ((curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber))
+				and (CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then
 
 				---------------hooolllllyyyy fucking shit this
 				-- code is a broken mess now
@@ -1357,6 +1357,8 @@
 
 function updateCost()
 
+	if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end
+
 	if pMode[pIndex] == loc("Healing Station") then
 		placedExpense = 50
 	elseif pMode[pIndex] == loc("Weapon Filter") then
@@ -1421,7 +1423,7 @@
 end
 
 function showModeMessage()
-	if CurrentHedgehog == nil then return end
+	if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end
 	local val = pMode[pIndex]
 	local str
 	if cat[cIndex] == "Mine Placement Mode" then
@@ -1489,7 +1491,9 @@
 function onUp()
 
 	if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then
-		updatePlacementDisplay(-1)
+		if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
+			updatePlacementDisplay(-1)
+		end
 	end
 
 end
@@ -1497,7 +1501,9 @@
 function onDown()
 
 	if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then
-		updatePlacementDisplay(1)
+		if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
+			updatePlacementDisplay(1)
+		end
 	end
 
 end