Clean up indents and comments in The_Specialists.lua
authorWuzzy <Wuzzy2@mail.ru>
Sat, 05 Jan 2019 20:32:48 +0100
changeset 14517 2fd8f4cd3aa4
parent 14516 f5487302d53b
child 14518 a97216ff1c51
Clean up indents and comments in The_Specialists.lua
share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Sat Jan 05 13:23:43 2019 -0500
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Sat Jan 05 20:32:48 2019 +0100
@@ -1,75 +1,42 @@
 ----------------------------------
--- THE SPECIALISTS MODE 0.7
--- by mikade
+-- THE SPECIALISTS
+-- original style by mikade
 ----------------------------------
 
--- version history
------------------
--- version 0.1
------------------
--- concept test
-
-----------------
--- version 0.2
-----------------
--- added gfRandomOrder to gameflags
--- removed some deprecated variables/methods
--- fixed lack of portal reset
-
-----------------
--- version 0.3
-----------------
--- added switching on start
--- removed switch from engineer weaponset
+--------------------
+-- TODO
+--------------------
+-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
 
-----------------
--- version 0.4
-----------------
--- Attempted to:
--- fix potential switch explit
--- improve user feedback on start
-
-----------------
--- version 0.5
-----------------
--- provision for variable minetimer / demo mines set to 5000ms
--- don't autoswitch if player only has 1 hog on his team
-
-----------------
--- version 0.6
-----------------
--- for the meanwhile, don't drop any crates except health crates
-
-----------------
--- version 0.7
-----------------
--- perhogadmsdf :D :D :D :D
-
---------------------
---TO DO
---------------------
-
--- balance hog health, maybe
--- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 HedgewarsScriptLoad("/Scripts/Tracker.lua")
 HedgewarsScriptLoad("/Scripts/Params.lua")
 
--- S=(S)oldier D=(D)emo E=(E)ngineer N=(N)inja P=(P)yro C=(C)lown H=(H)olyman[saint] X=Sniper [running out of letters, but X-out or X-hair or something]
+--[[
+Specialist letters:
+
+  S=[S]oldier
+  E=[E]ngineer
+  N=[N]inja
+  D=[D]emo
+  X=Sniper
+  H=Saint ([H]oly)
+  P=[P]yro
+  C=Loon ([C]lown)
+]]
 -- default team values
 local currTeamIdx = 0;
-local teamRoles = 
-        {
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'},
-            {'S','E','N','D','X','H','P','C'}
-        };
+local teamRoles = {
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'},
+	{'S','E','N','D','X','H','P','C'}
+};
 
 local numhhs = 0
 local hhs = {}
@@ -79,52 +46,52 @@
 function onParameters()
 	parseParams()
 	for i = 1, 8 do
-        if params['t'..i] ~= nil then
-            for j = 1, 8 do
-                if string.len(params['t'..i]) >= j  then
-                    teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j));
-                end
-            end
-        end
-    end
+		if params['t'..i] ~= nil then
+			for j = 1, 8 do
+				if string.len(params['t'..i]) >= j  then
+					teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j));
+				end
+			end
+		end
+	end
 end
 
 function onNewAmmoStore(groupIndex, hogIndex)
 
 	SetAmmo(amSkip, 9, 0, 0, 0)
-    groupIndex = groupIndex + 1
-    hogIndex = hogIndex + 1
+	groupIndex = groupIndex + 1
+	hogIndex = hogIndex + 1
 
-    if teamRoles[groupIndex][hogIndex] == 'S' then
+	if teamRoles[groupIndex][hogIndex] == 'S' then
 		SetAmmo(amBazooka, 1, 0, 0, 0)
 		SetAmmo(amGrenade, 1, 0, 0, 0)
 		SetAmmo(amShotgun, 1, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'E' then
+	elseif teamRoles[groupIndex][hogIndex] == 'E' then
 		SetAmmo(amGirder, 2, 0, 0, 0)
 		SetAmmo(amBlowTorch, 1, 0, 0, 0)
 		SetAmmo(amPickHammer, 1, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'N' then
+	elseif teamRoles[groupIndex][hogIndex] == 'N' then
 		SetAmmo(amRope, 9, 0, 0, 0)
 		SetAmmo(amParachute, 9, 0, 0, 0)
 		SetAmmo(amFirePunch, 1, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'D' then
+	elseif teamRoles[groupIndex][hogIndex] == 'D' then
 		SetAmmo(amDynamite, 1, 0, 0, 0)
 		SetAmmo(amMine, 1, 0, 0, 0)
 		SetAmmo(amDrill, 1, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'X' then
+	elseif teamRoles[groupIndex][hogIndex] == 'X' then
 		SetAmmo(amSniperRifle, 1, 0, 0, 0)
 		SetAmmo(amDEagle, 1, 0, 0, 0)
 		SetAmmo(amPortalGun, 2, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'H' then
+	elseif teamRoles[groupIndex][hogIndex] == 'H' then
 		SetAmmo(amSeduction, 9, 0, 0, 0)
 		SetAmmo(amResurrector, 1, 0, 0, 0)
 		SetAmmo(amInvulnerable, 1, 0, 0, 0)
-        SetAmmo(amLowGravity, 1, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'P' then
+		SetAmmo(amLowGravity, 1, 0, 0, 0)
+	elseif teamRoles[groupIndex][hogIndex] == 'P' then
 		SetAmmo(amFlamethrower, 1, 0, 0, 0)
 		SetAmmo(amMolotov, 1, 0, 0, 0)
 		SetAmmo(amNapalm, 1, 0, 0, 0)
-    elseif teamRoles[groupIndex][hogIndex] == 'C' then
+	elseif teamRoles[groupIndex][hogIndex] == 'C' then
 		SetAmmo(amBaseballBat, 1, 0, 0, 0)
 		SetAmmo(amGasBomb, 1, 0, 0, 0)
 		SetAmmo(amKamikaze, 1, 0, 0, 0)
@@ -140,65 +107,65 @@
 
 	for i = 0, (numhhs-1) do
 
-			currTeam = GetHogTeamName(hhs[i])
+		currTeam = GetHogTeamName(hhs[i])
 
-			if currTeam == lastTeam then
-					z = z + 1
-			else
-					z = 1
-                    currTeamIdx = currTeamIdx + 1;
-			end
+		if currTeam == lastTeam then
+			z = z + 1
+		else
+			z = 1
+			currTeamIdx = currTeamIdx + 1;
+		end
 
-			if teamRoles[currTeamIdx][z] == 'S' then
+		if teamRoles[currTeamIdx][z] == 'S' then
 
-					SetHogName(hhs[i],loc("Soldier"))
-					SetHogHat(hhs[i], "sf_vega")
-					SetHealth(hhs[i],200)
+			SetHogName(hhs[i],loc("Soldier"))
+			SetHogHat(hhs[i], "sf_vega")
+			SetHealth(hhs[i],200)
 
-			elseif teamRoles[currTeamIdx][z] == 'E' then
+		elseif teamRoles[currTeamIdx][z] == 'E' then
 
-					SetHogHat(hhs[i], "Glasses")
-					SetHogName(hhs[i],loc("Engineer"))
+			SetHogHat(hhs[i], "Glasses")
+			SetHogName(hhs[i],loc("Engineer"))
 
-			elseif teamRoles[currTeamIdx][z] == 'N' then
+		elseif teamRoles[currTeamIdx][z] == 'N' then
 
-					SetHogName(hhs[i],loc("Ninja"))
-					SetHogHat(hhs[i], "NinjaFull")
-					SetHealth(hhs[i],80)
+			SetHogName(hhs[i],loc("Ninja"))
+			SetHogHat(hhs[i], "NinjaFull")
+			SetHealth(hhs[i],80)
 
-			elseif teamRoles[currTeamIdx][z] == 'D' then
+		elseif teamRoles[currTeamIdx][z] == 'D' then
 
-					SetHogName(hhs[i],loc("Demo"))
-					SetHogHat(hhs[i], "Skull")
-					SetHealth(hhs[i],200)
+			SetHogName(hhs[i],loc("Demo"))
+			SetHogHat(hhs[i], "Skull")
+			SetHealth(hhs[i],200)
 
-			elseif teamRoles[currTeamIdx][z] == 'X' then
+		elseif teamRoles[currTeamIdx][z] == 'X' then
 
-					SetHogName(hhs[i],loc("Sniper"))
-					SetHogHat(hhs[i], "Sniper")
-					SetHealth(hhs[i],120)
+			SetHogName(hhs[i],loc("Sniper"))
+			SetHogHat(hhs[i], "Sniper")
+			SetHealth(hhs[i],120)
 
-			elseif teamRoles[currTeamIdx][z] == 'H' then
+		elseif teamRoles[currTeamIdx][z] == 'H' then
 
-					SetHogName(hhs[i],loc("Saint"))
-					SetHogHat(hhs[i], "angel")
-					SetHealth(hhs[i],300)
+			SetHogName(hhs[i],loc("Saint"))
+			SetHogHat(hhs[i], "angel")
+			SetHealth(hhs[i],300)
 
-			elseif teamRoles[currTeamIdx][z] == 'P' then
+		elseif teamRoles[currTeamIdx][z] == 'P' then
 
-					SetHogName(hhs[i],loc("Pyro"))
-					SetHogHat(hhs[i], "Gasmask")
-					SetHealth(hhs[i],150)
+			SetHogName(hhs[i],loc("Pyro"))
+			SetHogHat(hhs[i], "Gasmask")
+			SetHealth(hhs[i],150)
 
-			elseif teamRoles[currTeamIdx][z] == 'C' then
+		elseif teamRoles[currTeamIdx][z] == 'C' then
 
-					SetHogName(hhs[i],loc("Loon"))
-					SetHogHat(hhs[i], "clown")
-					SetHealth(hhs[i],100)
+			SetHogName(hhs[i],loc("Loon"))
+			SetHogHat(hhs[i], "clown")
+			SetHealth(hhs[i],100)
 
-			end
+		end
 
-			lastTeam = GetHogTeamName(hhs[i])
+		lastTeam = GetHogTeamName(hhs[i])
 
 	end
 
@@ -214,20 +181,17 @@
 
 	CreateTeam()
 
-	ShowMission     (
-                                loc("THE SPECIALISTS"),
-                                loc("a Hedgewars mini-game"),
-
-                                loc("Eliminate the enemy specialists.") .. "|" ..
-                                " " .. "|" ..
-
-                                loc("Game Modifiers: ") .. "|" ..
-                                loc("Per-Hog Ammo") .. "|" ..
-                                loc("Weapons Reset") .. "|" ..
-                                loc("Unlimited Attacks") .. "|" ..
-
-                                "", 4, 4000
-                                )
+	ShowMission(
+		loc("THE SPECIALISTS"),
+		loc("a Hedgewars mini-game"),
+		loc("Eliminate the enemy specialists.") .. "|" ..
+		" " .. "|" ..
+		loc("Game Modifiers: ") .. "|" ..
+		loc("Per-Hog Ammo") .. "|" ..
+		loc("Weapons Reset") .. "|" ..
+		loc("Unlimited Attacks") .. "|" ..
+		"", 4, 4000
+	)
 
 	trackTeams()
 
@@ -243,7 +207,7 @@
 
 function onGearAdd(gear)
 
-    if GetGearType(gear) == gtHedgehog then
+	if GetGearType(gear) == gtHedgehog then
 		hhs[numhhs] = gear
 		numhhs = numhhs + 1
 	elseif (GetGearType(gear) == gtMine) and (started == true) then