forked from 0ad/0ad
Add button to promote selected units, for testing
This was SVN commit r9527.
This commit is contained in:
parent
b9f04a3d27
commit
fd65a492d9
@ -98,7 +98,7 @@
|
||||
/>
|
||||
|
||||
<!-- Dev/cheat commands -->
|
||||
<object name="devCommands" size="100%-156 72 100%-16 216" type="image" sprite="devCommandsBackground"
|
||||
<object name="devCommands" size="100%-156 72 100%-16 232" type="image" sprite="devCommandsBackground"
|
||||
hidden="true" hotkey="session.devcommands.toggle">
|
||||
<action on="Press">
|
||||
toggleDeveloperOverlay();
|
||||
@ -144,6 +144,11 @@
|
||||
<object size="100%-16 128 100% 144" type="checkbox" name="devTimeWarp" style="wheatCrossBox">
|
||||
<action on="Press">Engine.EnableTimeWarpRecording(this.checked ? 10 : 0);</action>
|
||||
</object>
|
||||
|
||||
<object size="0 144 100%-18 160" type="text" style="devCommandsText">Promote selected units</object>
|
||||
<object size="100%-16 144 100% 160" type="button" style="wheatCrossBox">
|
||||
<action on="Press">Engine.PostNetworkCommand({"type": "promote", "entities": g_Selection.toList()});</action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
|
@ -248,7 +248,19 @@ function ProcessCommand(player, cmd)
|
||||
cmpFormation.LoadFormation(cmd.name);
|
||||
cmpFormation.MoveMembersIntoFormation(true);
|
||||
break;
|
||||
|
||||
|
||||
case "promote":
|
||||
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||
cmpGuiInterface.PushNotification({"type": "chat", "player": player, "message": "(Cheat - promoted units)"});
|
||||
|
||||
for each (var ent in cmd.entities)
|
||||
{
|
||||
var cmpPromotion = Engine.QueryInterface(ent, IID_Promotion);
|
||||
if (cmpPromotion)
|
||||
cmpPromotion.IncreaseXp(cmpPromotion.GetRequiredXp() - cmpPromotion.GetCurrentXp());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Ignoring unrecognised command type '" + cmd.type + "'");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user