Add military only drag select (Alt modifier) by gerbilOFdoom. Closes #277
This was SVN commit r10873.
This commit is contained in:
parent
c5d62aff98
commit
1730dd6d8d
@ -142,6 +142,7 @@ hotkey.cut = "Ctrl+X" ; Cut selected text and copy to the clipboar
|
|||||||
|
|
||||||
; > ENTITY SELECTION
|
; > ENTITY SELECTION
|
||||||
hotkey.selection.add = Shift ; Add units to selection
|
hotkey.selection.add = Shift ; Add units to selection
|
||||||
|
hotkey.selection.milonly = Alt ; Add only military units to selection
|
||||||
hotkey.selection.remove = Ctrl ; Remove units from selection
|
hotkey.selection.remove = Ctrl ; Remove units from selection
|
||||||
hotkey.selection.idleworker = Period ; Select next idle worker
|
hotkey.selection.idleworker = Period ; Select next idle worker
|
||||||
hotkey.selection.idlewarrior = Comma ; Select next idle warrior
|
hotkey.selection.idlewarrior = Comma ; Select next idle warrior
|
||||||
|
@ -444,6 +444,19 @@ function getPreferredEntities(ents)
|
|||||||
return preferredEnts;
|
return preferredEnts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Removes any support units from the passed list of entities
|
||||||
|
function getMilitaryEntities(ents)
|
||||||
|
{
|
||||||
|
var militaryEnts = [];
|
||||||
|
for each (var ent in ents)
|
||||||
|
{
|
||||||
|
var entState = GetEntityState(ent);
|
||||||
|
if (!isSupport(entState))
|
||||||
|
militaryEnts.push(ent);
|
||||||
|
}
|
||||||
|
return militaryEnts;
|
||||||
|
}
|
||||||
|
|
||||||
function handleInputBeforeGui(ev, hoveredObject)
|
function handleInputBeforeGui(ev, hoveredObject)
|
||||||
{
|
{
|
||||||
// Capture mouse position so we can use it for displaying cursors,
|
// Capture mouse position so we can use it for displaying cursors,
|
||||||
@ -512,7 +525,16 @@ function handleInputBeforeGui(ev, hoveredObject)
|
|||||||
var preferredEntities = getPreferredEntities(ents)
|
var preferredEntities = getPreferredEntities(ents)
|
||||||
|
|
||||||
if (preferredEntities.length)
|
if (preferredEntities.length)
|
||||||
ents = preferredEntities;
|
{
|
||||||
|
ents = preferredEntities;
|
||||||
|
|
||||||
|
if(Engine.HotkeyIsPressed("selection.milonly"))
|
||||||
|
{
|
||||||
|
var militaryEntities = getMilitaryEntities(ents);
|
||||||
|
if(militaryEntities.length)
|
||||||
|
ents = militaryEntities;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the bandbox hover highlighting
|
// Remove the bandbox hover highlighting
|
||||||
g_Selection.setHighlightList([]);
|
g_Selection.setHighlightList([]);
|
||||||
|
@ -127,6 +127,17 @@ function isDefensive(entState)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSupport(entState)
|
||||||
|
{
|
||||||
|
if(entState.identity)
|
||||||
|
{
|
||||||
|
var classes = entState.identity.classes;
|
||||||
|
if(classes && classes.length)
|
||||||
|
return (classes.indexOf("Support") != -1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function damageTypesToTextStacked(dmg)
|
function damageTypesToTextStacked(dmg)
|
||||||
{
|
{
|
||||||
if (!dmg)
|
if (!dmg)
|
||||||
|
Loading…
Reference in New Issue
Block a user