improve placement behavior for stronghold and groupedLines placement options
Some checks are pending
checkrefs / checkrefs (push) Waiting to run
pre-commit / build (push) Waiting to run

This commit is contained in:
real_tabasco_sauce 2024-09-14 11:01:10 -07:00
parent 398314be4c
commit 26a68b56c2

View File

@ -757,7 +757,9 @@ function placeLine(teamsArray, distance, groupedDistance, startAngle)
const playerPosition = []; const playerPosition = [];
const mapCenter = g_Map.getCenter(); const mapCenter = g_Map.getCenter();
const dist = fractionToTiles(0.45); const numAcross = 2 * getNumPlayers() / teamsArray.length; // if its two teams, numAcross is the same as numPlayers.
const dist = fractionToTiles(numAcross == 2 ? 0.30 : 0.66 + (-0.01 * numAcross));
groupedDistance = groupedDistance * (3.00 + (-0.225 * numAcross));
for (let i = 0; i < teamsArray.length; ++i) for (let i = 0; i < teamsArray.length; ++i)
{ {
@ -795,8 +797,8 @@ function placeStronghold(teamsArray, distance, groupedDistance, startAngle)
for (let i = 0; i < teamsArray.length; ++i) for (let i = 0; i < teamsArray.length; ++i)
{ {
let teamAngle = startAngle + (i + 1) * 2 * Math.PI / teamsArray.length; let teamAngle = startAngle + (i + 1) * 2 * Math.PI / teamsArray.length;
let teamPosition = Vector2D.add(mapCenter, new Vector2D(distance, 0).rotate(-teamAngle)); let teamPosition = Vector2D.add(mapCenter, new Vector2D(distance * 0.8, 0).rotate(-teamAngle));
let teamGroupDistance = groupedDistance; let teamGroupDistance = groupedDistance * 1.2;
// If we have a team of above average size, make sure they're spread out // If we have a team of above average size, make sure they're spread out
if (teamsArray[i].length > 4) if (teamsArray[i].length > 4)