Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -433,6 +433,7 @@ 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 Index: ps/trunk/binaries/data/mods/public/gui/options/options.json =================================================================== --- ps/trunk/binaries/data/mods/public/gui/options/options.json +++ ps/trunk/binaries/data/mods/public/gui/options/options.json @@ -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" } ] } Index: ps/trunk/binaries/data/mods/public/gui/session/input.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/input.js +++ ps/trunk/binaries/data/mods/public/gui/session/input.js @@ -1170,7 +1170,7 @@ )); if (unit) { - g_Selection.removeList([unit], true); + g_Selection.removeList([unit], false); return [unit]; } return null; Index: ps/trunk/binaries/data/mods/public/gui/session/selection.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/selection.js +++ ps/trunk/binaries/data/mods/public/gui/session/selection.js @@ -175,6 +175,17 @@ // 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 @@ /** * @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.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); Index: ps/trunk/binaries/data/mods/public/gui/text/tips/formations.txt =================================================================== --- ps/trunk/binaries/data/mods/public/gui/text/tips/formations.txt +++ ps/trunk/binaries/data/mods/public/gui/text/tips/formations.txt @@ -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.