Make bots first-class players.
- Bots have their own Clients, with unique ClientIDs - Hosts can set bot team/color in the lobby - Bots are kicked when switching to a smaller map without enough slots - Order validator assumes that only client 0 has permission to issue bot orders
This commit is contained in:
@@ -18,10 +18,18 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order)
|
||||
{
|
||||
// Drop exploiting orders
|
||||
if (order.Subject != null && order.Subject.Owner.ClientIndex != clientId)
|
||||
if (order.Subject == null || order.Subject.Owner == null)
|
||||
return true;
|
||||
|
||||
var subjectClient = order.Subject.Owner.ClientIndex;
|
||||
|
||||
// Hack: Assumes bots always run on clientId 0.
|
||||
var isBotOrder = orderManager.LobbyInfo.Clients[subjectClient].Bot != null && clientId == 0;
|
||||
|
||||
// Drop exploiting orders
|
||||
if (subjectClient != clientId && !isBotOrder)
|
||||
{
|
||||
Game.Debug("Detected exploit order from {0}: {1}".F(clientId, order.OrderString));
|
||||
Game.Debug("Detected exploit order from client {0}: {1}".F(clientId, order.OrderString));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user