Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/input.js
Show First 20 Lines • Show All 1,007 Lines • ▼ Show 20 Lines | case "mousebuttonup": | ||||
// Reset the timer so the user has an extra period 'doubleClickTimer' to do a triple-click | // Reset the timer so the user has an extra period 'doubleClickTimer' to do a triple-click | ||||
doubleClickTimer = now.getTime(); | doubleClickTimer = now.getTime(); | ||||
} | } | ||||
else | else | ||||
// Double click has already occurred, so this is a triple click. | // Double click has already occurred, so this is a triple click. | ||||
// Select units matching exact template name (same rank) | // Select units matching exact template name (same rank) | ||||
templateToMatch = GetEntityState(selectedEntity).template; | templateToMatch = GetEntityState(selectedEntity).template; | ||||
// Remove the player prefix (e.g. "p3&") | |||||
let index = templateToMatch.indexOf("&"); | |||||
if (index != -1) | |||||
templateToMatch = templateToMatch.slice(index+1); | |||||
// TODO: Should we handle "control all units" here as well? | // TODO: Should we handle "control all units" here as well? | ||||
ents = Engine.PickSimilarPlayerEntities(templateToMatch, showOffscreen, matchRank, false); | ents = Engine.PickSimilarPlayerEntities(templateToMatch, showOffscreen, matchRank, false); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
// It's single click right now but it may become double or triple click | // It's single click right now but it may become double or triple click | ||||
doubleClicked = false; | doubleClicked = false; | ||||
doubleClickTimer = now.getTime(); | doubleClickTimer = now.getTime(); | ||||
▲ Show 20 Lines • Show All 684 Lines • ▼ Show 20 Lines | |||||
function unload(garrisonHolder, entities) | function unload(garrisonHolder, entities) | ||||
{ | { | ||||
if (Engine.HotkeyIsPressed("session.unloadtype")) | if (Engine.HotkeyIsPressed("session.unloadtype")) | ||||
Engine.PostNetworkCommand({ "type": "unload", "entities": entities, "garrisonHolder": garrisonHolder }); | Engine.PostNetworkCommand({ "type": "unload", "entities": entities, "garrisonHolder": garrisonHolder }); | ||||
else | else | ||||
Engine.PostNetworkCommand({ "type": "unload", "entities": [entities[0]], "garrisonHolder": garrisonHolder }); | Engine.PostNetworkCommand({ "type": "unload", "entities": [entities[0]], "garrisonHolder": garrisonHolder }); | ||||
} | } | ||||
function unloadTemplate(template) | function unloadTemplate(template, owner) | ||||
{ | { | ||||
// Filter out all entities that aren't garrisonable. | // Filter out all entities that aren't garrisonable. | ||||
var garrisonHolders = g_Selection.toList().filter(e => { | var garrisonHolders = g_Selection.toList().filter(e => { | ||||
var state = GetEntityState(e); | var state = GetEntityState(e); | ||||
if (state && state.garrisonHolder) | if (state && state.garrisonHolder) | ||||
return true; | return true; | ||||
return false; | return false; | ||||
}); | }); | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "unload-template", | "type": "unload-template", | ||||
"all": Engine.HotkeyIsPressed("session.unloadtype"), | "all": Engine.HotkeyIsPressed("session.unloadtype"), | ||||
"template": template, | "template": template, | ||||
"owner": owner, | |||||
"garrisonHolders": garrisonHolders | "garrisonHolders": garrisonHolders | ||||
}); | }); | ||||
} | } | ||||
function unloadSelection() | function unloadSelection() | ||||
{ | { | ||||
let parent = 0; | let parent = 0; | ||||
let ents = []; | let ents = []; | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator