--- a/LuaAPI.wiki Mon Dec 03 23:09:07 2018 +0000
+++ b/LuaAPI.wiki Mon Dec 03 23:52:35 2018 +0000
@@ -1339,7 +1339,7 @@
Arguments:
* `teamname`: The name of the team.
- * `color`: The RGB color of the team as defined in [LuaAPI#Color]
+ * `color`: Team color, usually a number from -9 to -1 (see below)
* `grave`: The name of the team’s grave (equals file name without the suffix)
* `fort`: The name of the team’s fort (equals file name without the suffix and without the letter “L” or “R” before that suffix)
* `voicepack`: The name of the team’s voice pack (equals the directory name)
@@ -1347,10 +1347,27 @@
*Note*: This works only for singleplayer training missions for now and will desync multiplayer games.
-Example:
+===== Clan color =====
+Each team must have a color. The color also determines clan membership: Teams with equal color are in the same clan.
+
+The team color is specified as a number from -9 to -1. This will select one of the 9 possible team colors as specified in the player's settings. As the actual colors are set by the player, you can't predict them, but you can usually trust these defaults:
-<code language="lua">AddTeam("team 1", 0xDD0000, "Simple", "Tank", "Default", "hedgewars")
---[[ Adds a new team with name “team 1”, red color (hexadecimal notation), the grave “Simple”,
+ * `-1`: red
+ * `-2`: blue
+ * `-3`: cyan
+ * `-4`: purple
+ * `-5`: magenta
+ * `-6`: green
+ * `-7`: orange
+ * `-8`: brown
+ * `-9`: yellow
+
+An older (and now discouraged) method of specifying the color is by hardcoding it as an RGB color (i.e. `0xDD0000`). This practice is now strongly discouraged because it will ignore the player-chosen color (which is *bad* for players with color blindness) and in 99% of cases you don't need it anyway. It should be only used for testing and debugging.
+
+===== Example =====
+
+<code language="lua">AddTeam("team 1", -1, "Simple", "Tank", "Default", "hedgewars")
+--[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”,
the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]]</code>
==== <tt>!GetTeamName(teamIdx)</tt> (0.9.24) ====