forked from 0ad/0ad
Add a switch to allow the user to control all player's units, for easier testing
This was SVN commit r7345.
This commit is contained in:
parent
1712b2cdb1
commit
a8d810b4b3
@ -59,7 +59,7 @@ function determineAction(x, y)
|
||||
|
||||
// If the selection isn't friendly units, no action
|
||||
var player = Engine.GetPlayerID();
|
||||
if (entState.player != player)
|
||||
if (entState.player != player && !g_DevSettings.controlAll)
|
||||
return;
|
||||
|
||||
var targets = Engine.PickEntitiesAtPoint(x, y);
|
||||
@ -74,7 +74,7 @@ function determineAction(x, y)
|
||||
var targetState = Engine.GuiInterfaceCall("GetEntityState", targets[0]);
|
||||
|
||||
// Different owner -> attack
|
||||
if (entState.attack && targetState.player != player)
|
||||
if (entState.attack && targetState.player != entState.player)
|
||||
return {"type": "attack", "cursor": "action-attack", "target": targets[0]};
|
||||
|
||||
var resource = findGatherType(entState.resourceGatherRates, targetState.resourceSupply);
|
||||
|
@ -1,3 +1,7 @@
|
||||
var g_DevSettings = {
|
||||
controlAll: false
|
||||
};
|
||||
|
||||
function init(initData, hotloadData)
|
||||
{
|
||||
if (hotloadData)
|
||||
@ -16,6 +20,10 @@ function getHotloadData()
|
||||
|
||||
function onTick()
|
||||
{
|
||||
g_DevSettings.controlAll = getGUIObjectByName("devControlAll").checked;
|
||||
// TODO: at some point this controlAll needs to disable the simulation code's
|
||||
// player checks (once it has some player checks)
|
||||
|
||||
updateCursor();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,12 @@
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- Dev/cheat commands -->
|
||||
<object size="100%-256 32 100%-16 128">
|
||||
<object size="0 0 100%-18 16" type="text" text_align="right">Control all units</object>
|
||||
<object size="100%-16 0 100% 16" type="checkbox" name="devControlAll" style="wheatCrossBox"/>
|
||||
</object>
|
||||
|
||||
<!-- Debug text -->
|
||||
<object name="debug"
|
||||
type="text"
|
||||
|
Loading…
Reference in New Issue
Block a user