1
0
forked from 0ad/0ad

Added some debug commands (quit and set-shading-color) which shoudl be useful for AI development

This was SVN commit r11671.
This commit is contained in:
Jonathan Waller 2012-04-25 20:56:35 +00:00
parent e765f6865f
commit fee0ec6648
2 changed files with 21 additions and 0 deletions

View File

@ -27,6 +27,11 @@ function handleNotifications()
"text": notification.message
});
}
else if (notification.type == "quit")
{
// Used for AI testing
exit();
}
else
{
// Only display notifications directed to this player

View File

@ -34,6 +34,12 @@ function ProcessCommand(player, cmd)
cmpGuiInterface.PushNotification({"type": "chat", "player": player, "message": cmd.message});
break;
case "quit":
// Let the AI exit the game for testing purposes
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({"type": "quit"});
break;
case "control-all":
cmpPlayer.SetControlAllUnits(cmd.flag);
break;
@ -502,6 +508,16 @@ function ProcessCommand(player, cmd)
cmpBarter.ExchangeResources(playerEnt, cmd.sell, cmd.buy, cmd.amount);
break;
case "set-shading-color":
// Debug command to make an entity brightly colored
for each (var ent in cmd.entities)
{
var cmpVisual = Engine.QueryInterface(ent, IID_Visual)
if (cmpVisual)
cmpVisual.SetShadingColour(cmd.rgb[0], cmd.rgb[1], cmd.rgb[2], 0) // alpha isn't used so just send 0
}
break;
default:
error("Invalid command: unknown command type: "+uneval(cmd));
}