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:
parent
e765f6865f
commit
fee0ec6648
@ -27,6 +27,11 @@ function handleNotifications()
|
|||||||
"text": notification.message
|
"text": notification.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (notification.type == "quit")
|
||||||
|
{
|
||||||
|
// Used for AI testing
|
||||||
|
exit();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Only display notifications directed to this player
|
// Only display notifications directed to this player
|
||||||
|
@ -33,6 +33,12 @@ function ProcessCommand(player, cmd)
|
|||||||
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||||
cmpGuiInterface.PushNotification({"type": "chat", "player": player, "message": cmd.message});
|
cmpGuiInterface.PushNotification({"type": "chat", "player": player, "message": cmd.message});
|
||||||
break;
|
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":
|
case "control-all":
|
||||||
cmpPlayer.SetControlAllUnits(cmd.flag);
|
cmpPlayer.SetControlAllUnits(cmd.flag);
|
||||||
@ -501,6 +507,16 @@ function ProcessCommand(player, cmd)
|
|||||||
var cmpBarter = Engine.QueryInterface(SYSTEM_ENTITY, IID_Barter);
|
var cmpBarter = Engine.QueryInterface(SYSTEM_ENTITY, IID_Barter);
|
||||||
cmpBarter.ExchangeResources(playerEnt, cmd.sell, cmd.buy, cmd.amount);
|
cmpBarter.ExchangeResources(playerEnt, cmd.sell, cmd.buy, cmd.amount);
|
||||||
break;
|
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:
|
default:
|
||||||
error("Invalid command: unknown command type: "+uneval(cmd));
|
error("Invalid command: unknown command type: "+uneval(cmd));
|
||||||
|
Loading…
Reference in New Issue
Block a user