mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 02:46:49 +00:00
Add stronghold placement to Cantabrian Highlands
With stronghold each team is placed on a hill. With stronghold placement the hills are bigger. On tiny maps the ramps might overlap and enemies might not be reachable. To prevent that the ramps are shortened and the angle is changed to point more towards the center of the map. Refs: #7717
This commit is contained in:
@@ -78,25 +78,27 @@ export function* generateMap(mapSettings)
|
||||
|
||||
const playerHillRadius = defaultPlayerBaseRadius() / (mapSettings.Nomad ? 1.5 : 1);
|
||||
|
||||
const { playerIDs, playerPosition, playerAngle } = playerPlacementCircle(fractionToTiles(0.35));
|
||||
const startingPlacement = playerPlacementByPattern(mapSettings.PlayerPlacement,
|
||||
fractionToTiles(0.35), fractionToTiles(0.02) + 7, 0);
|
||||
|
||||
g_Map.log("Creating player hills and ramps");
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
const hillPositions = startingPlacement.teamPosition ?? startingPlacement.playerPosition;
|
||||
const hillAngles = startingPlacement.teamAngle ?? startingPlacement.playerAngle;
|
||||
for (let i = 0; i < hillPositions.length; ++i)
|
||||
{
|
||||
createArea(
|
||||
new ClumpPlacer(diskArea(playerHillRadius), 0.95, 0.6, Infinity, playerPosition[i]),
|
||||
const hillRadius = (startingPlacement.strongholdRadius?.[i] ?? 0) + playerHillRadius;
|
||||
createArea(new ClumpPlacer(diskArea(hillRadius), 0.95, 0.6, Infinity, hillPositions[i]),
|
||||
[
|
||||
new LayeredPainter([tCliff, tHill], [2]),
|
||||
new SmoothElevationPainter(ELEVATION_SET, heightHill, 2),
|
||||
new TileClassPainter(clPlayer)
|
||||
]);
|
||||
|
||||
const angle = playerAngle[i] + Math.PI * (1 + randFloat(-1, 1) / 8);
|
||||
const angle = hillAngles[i] + Math.PI * (1 + randFloat(-1, 1) * fractionToTiles(0.005) / 8);
|
||||
createPassage({
|
||||
"start": Vector2D.add(playerPosition[i], new Vector2D(playerHillRadius + 15, 0)
|
||||
.rotate(-angle)),
|
||||
"end": Vector2D.add(playerPosition[i], new Vector2D(playerHillRadius - 3, 0)
|
||||
.rotate(-angle)),
|
||||
"start": Vector2D.add(hillPositions[i],
|
||||
new Vector2D(hillRadius + 5 + fractionToTiles(0.02), 0).rotate(-angle)),
|
||||
"end": Vector2D.add(hillPositions[i], new Vector2D(hillRadius - 3, 0).rotate(-angle)),
|
||||
"startWidth": 10,
|
||||
"endWidth": 10,
|
||||
"smoothWidth": 2,
|
||||
@@ -107,7 +109,7 @@ export function* generateMap(mapSettings)
|
||||
}
|
||||
|
||||
placePlayerBases({
|
||||
"PlayerPlacement": [playerIDs, playerPosition],
|
||||
"PlayerPlacement": startingPlacement,
|
||||
"PlayerTileClass": clPlayer,
|
||||
"BaseResourceClass": clBaseResource,
|
||||
"Walls": false,
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
"SupportedBiomes": "generic/",
|
||||
"Keywords": ["multiplayer"],
|
||||
"Preview" : "cantabrian_highlands.png",
|
||||
"CircularMap" : true
|
||||
"CircularMap" : true,
|
||||
"PlayerPlacements": [
|
||||
"circle",
|
||||
"stronghold"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -804,6 +804,9 @@ function placeStronghold(teamsArray, distance, groupedDistance, startAngle)
|
||||
|
||||
const playerIDs = [];
|
||||
const playerPosition = [];
|
||||
const teamPositions = [];
|
||||
const teamAngles = [];
|
||||
const strongholdRadius = [];
|
||||
|
||||
for (let i = 0; i < teamsArray.length; ++i)
|
||||
{
|
||||
@@ -828,11 +831,17 @@ function placeStronghold(teamsArray, distance, groupedDistance, startAngle)
|
||||
playerIDs.push(teamsArray[i][p]);
|
||||
playerPosition.push(Vector2D.add(teamPosition, new Vector2D(teamGroupDistance, 0).rotate(-angle)).round());
|
||||
}
|
||||
teamPositions.push(teamPosition);
|
||||
teamAngles.push(teamAngle);
|
||||
strongholdRadius.push(teamGroupDistance);
|
||||
}
|
||||
|
||||
return {
|
||||
"playerIDs": playerIDs,
|
||||
"playerPosition": playerPosition
|
||||
"playerPosition": playerPosition,
|
||||
"teamPosition": teamPositions,
|
||||
"teamAngle": teamAngles,
|
||||
"strongholdRadius": strongholdRadius
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user