diff --git a/binaries/data/mods/public/simulation/components/Formation.js b/binaries/data/mods/public/simulation/components/Formation.js index 519259eef8..0323b44cf0 100644 --- a/binaries/data/mods/public/simulation/components/Formation.js +++ b/binaries/data/mods/public/simulation/components/Formation.js @@ -77,9 +77,6 @@ Formation.prototype.Schema = "" + ""; -// Distance at which we'll switch between column/box formations. -var g_ColumnDistanceThreshold = 128; - // Distance under which the formation will not try to turn towards the target position. var g_RotateDistanceThreshold = 1; @@ -90,9 +87,6 @@ Formation.prototype.variablesToSerialize = [ "maxRowsUsed", "maxColumnsUsed", "finishedEntities", - "idleEntities", - "columnar", - "rearrange", "formationMembersWithAura", "width", "depth", @@ -148,11 +142,6 @@ Formation.prototype.Init = function(deserialized = false) this.maxColumnsUsed = []; // Entities that have finished the original task. this.finishedEntities = new Set(); - this.idleEntities = new Set(); - // Whether we're travelling in column (vs box) formation. - this.columnar = false; - // Whether we should rearrange all formation members. - this.rearrange = true; // Members with a formation aura. this.formationMembersWithAura = []; this.width = 0; @@ -962,10 +951,15 @@ Formation.prototype.UpdateTwinFormationsForMerge = function() if (minDist < dist) continue; - // Merge the members from the other formation into this one const otherMembers = cmpOtherFormation.members; + // Merge the members from the other formation into this one + this.AddMembers(otherMembers, true); + // The other formation will get disbanded for having no members cmpOtherFormation.RemoveMembers(otherMembers); - this.AddMembers(otherMembers); + // Remove the merged formation from twin formations list + this.twinFormations.splice(i, 1); + + this.UpdateFormation(true, true); } };