Allow changing color of unused player slots #1885
Allow changing color of unused player slots #1885Flamefire wants to merge 3 commits intoReturn-To-The-Roots:masterfrom
Conversation
This can be used to `static_assert` the size of the `PLAYER_COLORS` array.
This is useful for use by LUA to set player colors before filling the slots avoiding temporary conflicts (same colors). See Return-To-The-Roots#1884
|
can we maybe change/extend the lua code so you have to specify all colors at once, e.g to set all colors at once? |
|
That would still require adapting the protocol as it is the server that sets the colors. This way you get exactly what you want when you do Or we remove that part checking colors on set: We have a readiness check that verifies unique colors: https://github.com/Flamefire/s25client/blob/fb01a4f33a076b7fd63b174d0ac7bde0bb176544/libs/s25main/network/GameServer.cpp#L1446-L1458 With that we could check the colors only before starting. Given the original documentation of the Lua function we might have even intended to allow 2 players with the same color, at least for scripted maps |
Well, this does sound great, since you then could place 2 HQs somewhere and make it seem as if they are the same player, or just make alle enemies red. On the other hand, this might lead to unexpected results when inexperienced users try to write LUA, but I think with proper documentation, this should be fine. |
I mean that is what is documented right now so making sure it works would be a bugfix. When using the color toggle manually it picks a free color. There is only a small chance when 2 people change their color at the "same" time to have duplicates. |
This is useful for use by LUA to set player colors before filling the
slots avoiding temporary conflicts (same colors).
See #1884
Mention this in the docs which were wrong in this regard
Edit: doesn't work as in single player games all slots are filled by AI