TS: Add script param to set specialists for all teams at once
authorWuzzy <Wuzzy2@mail.ru>
Sat, 05 Jan 2019 20:58:12 +0100
changeset 14524 213a636f57fe
parent 14523 a97216ff1c51
child 14525 c96079ee4687
TS: Add script param to set specialists for all teams at once
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
--- a/ChangeLog.txt	Sat Jan 05 20:45:46 2019 +0100
+++ b/ChangeLog.txt	Sat Jan 05 20:58:12 2019 +0100
@@ -11,6 +11,7 @@
  + Restructure credits
  + Credits screen in main menu is now translatable
  + Don't show crate spawn message for initial crates in missions
+ + The Specialists: Add script parameter support to set custom specialists order
  * Use player-chosen team identity in campaigns and singleplayer missions
  * Fix last 2 characters in demo chat being missing
  * Fix homing bee flying weird if passing wrap world edge or target was placed beyond it
--- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Sat Jan 05 20:45:46 2019 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua	Sat Jan 05 20:58:12 2019 +0100
@@ -7,13 +7,20 @@
 --[[
 With the script parameter, you can change the order of specialists per team.
 
-Valid keys: t1, t2, ... t8
-  One per team (team 1, team 2, ... team 8)
+== Changing the specialists for all teams ==
+In the script parameter, put:
+
+    t=XXXXXXXX
 
-The value is a sequence of “specialist letters”.
-Each letter stands for a hedgehog.
+Where 'X' is a “specialist letter” (see below). Each letter stands for
+the role of a hedgehog in the team (in that order).
+If you leave out a letter, that hedgehog will be the default.
 
-Specialist letters:
+== Changing the specialists for on a per-team basis ==
+Same as above, but instead of “t”, you use “t1”, “t2”, ... “t8” for
+each of the teams (team 1 to team 8).
+
+== Specialist letters ==
 
   S = Soldier
   E = Engineer
@@ -24,18 +31,20 @@
   P = Pyro
   L = Loon
 
+== Examples ==
 Example 1:
 
-    t1=SENDIAPL,t2=SENDIAPL
+    t=SSSSPPPP
 
-Team 1 and team 2 have the standard specialists.
+4 soldiers and 4 pyros for all teams.
 
 Example 2:
 
-    t1=SSSSPPPP
+    t1=LPAIDNES,t2=NNNNNNNN
 
-4 soldiers and 4 pyros for team 1.
-
+Team 1: Loon, Pyro, Saint, Sniper, Demo, Ninja, Engineer, Soldier.
+Team 2: All-ninja team.
+All other teams use the default settings.
 
 ]]
 
@@ -69,6 +78,17 @@
 
 function onParameters()
 	parseParams()
+	-- All teams
+	if params['t'] ~= nil then
+		for i = 1, 8 do
+			for j = 1, 8 do
+				if string.len(params['t']) >= j  then
+					teamRoles[i][j] = string.upper(string.sub(params['t'],j,j));
+				end
+			end
+		end
+	end
+	-- Specific team
 	for i = 1, 8 do
 		if params['t'..i] ~= nil then
 			for j = 1, 8 do