Put the formation-selection feature behind a config.
Since it needs a better UX. (Introduced in a70a20fd42.) Users can choose to still use it. Differential revision: https://code.wildfiregames.com/D4360 Comment by: @wowgetoffyourcellphone This was SVN commit r26076.
This commit is contained in:
parent
afc77e20a4
commit
dfd9560748
@ -433,6 +433,7 @@ disjointcontrolgroups = "true" ; Whether control groups are disjoint sets or
|
||||
defaultformation = "special/formations/box" ; For walking orders, automatically put units into this formation if they don't have one already.
|
||||
formationwalkonly = "true" ; Formations are disabled when giving gather/attack/... orders.
|
||||
howtoshownames = 0 ; Whether the specific names are show as default, as opposed to the generic names. And whether the secondary names are shown. (0 - show both; specific names primary, 1 - show both; generic names primary, 2 - show only specific names, 3 - show only generic names)
|
||||
selectformationasone = "true" ; Whether to select formations as a whole by default.
|
||||
|
||||
[gui.session.minimap]
|
||||
blinkduration = 1.7 ; The blink duration while pinging
|
||||
|
@ -737,6 +737,12 @@
|
||||
"tooltip": "Units in formations stay in formations."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"label": "Battalion-style formations",
|
||||
"tooltip": "Whether formations are selected as a whole.",
|
||||
"config": "gui.session.selectformationasone"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1170,7 +1170,7 @@ function popOneFromSelection(action)
|
||||
));
|
||||
if (unit)
|
||||
{
|
||||
g_Selection.removeList([unit], true);
|
||||
g_Selection.removeList([unit], false);
|
||||
return [unit];
|
||||
}
|
||||
return null;
|
||||
|
@ -175,6 +175,17 @@ function EntitySelection()
|
||||
// Public properties:
|
||||
this.dirty = false; // set whenever the selection has changed
|
||||
this.groups = new EntityGroups();
|
||||
|
||||
this.UpdateFormationSelectionBehaviour();
|
||||
registerConfigChangeHandler(changes => {
|
||||
if (changes.has("gui.session.selectformationasone"))
|
||||
this.UpdateFormationSelectionBehaviour();
|
||||
});
|
||||
}
|
||||
|
||||
EntitySelection.prototype.UpdateFormationSelectionBehaviour = function()
|
||||
{
|
||||
this.SelectFormationAsOne = Engine.ConfigDB_GetValue("user", "gui.session.selectformationasone") == "true";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -331,13 +342,13 @@ EntitySelection.prototype.addList = function(ents, quiet, force = false, addForm
|
||||
|
||||
/**
|
||||
* @param {number[]} ents - The entities to remove.
|
||||
* @param {boolean} dontAddFormationMembers - If true we need to exclude adding formation members.
|
||||
* @param {boolean} addFormationMembers - If true we need to add formation members.
|
||||
*/
|
||||
EntitySelection.prototype.removeList = function(ents, dontAddFormationMembers = false)
|
||||
EntitySelection.prototype.removeList = function(ents, addFormationMembers = true)
|
||||
{
|
||||
const removed = [];
|
||||
|
||||
for (const ent of dontAddFormationMembers ? ents : this.addFormationMembers(ents))
|
||||
for (const ent of addFormationMembers ? this.addFormationMembers(ents) : ents)
|
||||
if (this.selected.has(ent))
|
||||
{
|
||||
this.groups.removeEnt(ent);
|
||||
@ -478,7 +489,7 @@ EntitySelection.prototype.selectAndMoveTo = function(entityID)
|
||||
*/
|
||||
EntitySelection.prototype.addFormationMembers = function(entities)
|
||||
{
|
||||
if (!entities.length || Engine.HotkeyIsPressed("selection.singleselection"))
|
||||
if (!entities.length || !this.SelectFormationAsOne || Engine.HotkeyIsPressed("selection.singleselection"))
|
||||
return entities;
|
||||
|
||||
const result = new Set(entities);
|
||||
|
@ -1,3 +1,3 @@
|
||||
FORMATIONS
|
||||
Arrange your soldiers in formations to keep them organized during battles.
|
||||
Formations are selected as a whole by default.
|
||||
Formations are selected as a whole by default, but that can be changed in the game settings.
|
||||
|
Loading…
Reference in New Issue
Block a user