Skip to content

Commit 534b09a

Browse files
abcdefg30Mailaender
authored andcommitted
Fix bots not working after adminship was transferred
1 parent 341a9f3 commit 534b09a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,13 @@ static bool MakeAdmin(S server, Connection conn, Session.Client client, string s
645645
var newAdminClient = server.GetClient(newAdminConn);
646646
client.IsAdmin = false;
647647
newAdminClient.IsAdmin = true;
648+
649+
var bots = server.LobbyInfo.Slots
650+
.Select(slot => server.LobbyInfo.ClientInSlot(slot.Key))
651+
.Where(c => c != null && c.Bot != null);
652+
foreach (var b in bots)
653+
b.BotControllerClientIndex = newAdminId;
654+
648655
server.SendMessage("{0} is now the admin.".F(newAdminClient.Name));
649656
Log.Write("server", "{0} is now the admin.".F(newAdminClient.Name));
650657
server.SyncLobbyClients();

0 commit comments

Comments
 (0)