Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/danubius.js
Engine.LoadLibrary("rmgen"); | Engine.LoadLibrary("rmgen"); | ||||
Engine.LoadLibrary("rmgen-common"); | Engine.LoadLibrary("rmgen-common"); | ||||
const day = g_MapSettings.dayTime !== undefined ? g_MapSettings.dayTime == "day" : randBool(2/3); | |||||
// Spawn ships away from the shoreline, but patrol close to the shoreline | // Spawn ships away from the shoreline, but patrol close to the shoreline | ||||
const triggerPointShipSpawn = "trigger/trigger_point_A"; | const triggerPointShipSpawn = "trigger/trigger_point_A"; | ||||
const triggerPointShipPatrol = "trigger/trigger_point_B"; | const triggerPointShipPatrol = "trigger/trigger_point_B"; | ||||
const triggerPointShipUnloadLeft = "trigger/trigger_point_C"; | const triggerPointShipUnloadLeft = "trigger/trigger_point_C"; | ||||
const triggerPointShipUnloadRight = "trigger/trigger_point_D"; | const triggerPointShipUnloadRight = "trigger/trigger_point_D"; | ||||
const triggerPointLandPatrolLeft = "trigger/trigger_point_E"; | const triggerPointLandPatrolLeft = "trigger/trigger_point_E"; | ||||
const triggerPointLandPatrolRight = "trigger/trigger_point_F"; | const triggerPointLandPatrolRight = "trigger/trigger_point_F"; | ||||
const triggerPointCCAttackerPatrolLeft = "trigger/trigger_point_G"; | const triggerPointCCAttackerPatrolLeft = "trigger/trigger_point_G"; | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | g_WallStyles.danubius_spikes = { | ||||
"spike_single": readyWallElement(oPalisadeAngleSpikes, "gaia"), | "spike_single": readyWallElement(oPalisadeAngleSpikes, "gaia"), | ||||
"overlap": 0 | "overlap": 0 | ||||
}; | }; | ||||
var fortressDanubiusVillage = new Fortress( | var fortressDanubiusVillage = new Fortress( | ||||
"Geto-Dacian Tribal Confederation", | "Geto-Dacian Tribal Confederation", | ||||
new Array(2).fill([ | new Array(2).fill([ | ||||
"gate", "pillar", "hut", "long", "long", | "gate", "pillar", "hut", "long", "long", | ||||
"cornerIn", "defense_tower", "long", "temple", "long", | "cornerIn", "defense_tower", "long", "temple", "long", | ||||
"pillar", "house", "long", "short", "pillar", "gate", "pillar", "longhouse", "long", "long", | "pillar", "house", "long", "short", "pillar", "gate", "pillar", "longhouse", "long", "long", | ||||
"cornerIn", "defense_tower", "long", "tavern", "long", "pillar" | "cornerIn", "defense_tower", "long", "tavern", "long", "pillar" | ||||
]).reduce((result, items) => result.concat(items), [])); | ]).reduce((result, items) => result.concat(items), [])); | ||||
var palisadeCorner = ["turn_0.25", "spike_single", "turn_0.25"]; | var palisadeCorner = ["turn_0.25", "spike_single", "turn_0.25"]; | ||||
var palisadeGate = ["spike_single", "gap_3.6", "spike_single"]; | var palisadeGate = ["spike_single", "gap_3.6", "spike_single"]; | ||||
var palisadeWallShort = new Array(3).fill("spikes_tall"); | var palisadeWallShort = new Array(3).fill("spikes_tall"); | ||||
var palisadeWallLong = new Array(5).fill("spikes_tall"); | var palisadeWallLong = new Array(5).fill("spikes_tall"); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if (addCelticRitual) | ||||
new TileClassPainter(clRitualPlace) | new TileClassPainter(clRitualPlace) | ||||
]); | ]); | ||||
g_Map.placeEntityAnywhere(aCampfire, 0, meetingPlacePosition, randomAngle()); | g_Map.placeEntityAnywhere(aCampfire, 0, meetingPlacePosition, randomAngle()); | ||||
for (let participants of ritualParticipants) | for (let participants of ritualParticipants) | ||||
{ | { | ||||
let [positions, angles] = distributePointsOnCircle(participants.count, startAngle, participants.radius * mRadius, meetingPlacePosition); | let [positions, angles] = distributePointsOnCircle(participants.count, startAngle, participants.radius * mRadius, meetingPlacePosition); | ||||
for (let i = 0; i < positions.length; ++i) | for (let j = 0; j < positions.length; ++j) | ||||
g_Map.placeEntityPassable(pickRandom(participants.templates), 0, positions[i], angles[i] + participants.angle); | g_Map.placeEntityPassable(pickRandom(participants.templates), 0, positions[j], angles[j] + participants.angle); | ||||
} | } | ||||
} | } | ||||
g_Map.placeEntityPassable(oCivicCenter, 0, civicCenterPosition, startAngle + BUILDING_ORIENTATION + Math.PI * 3/2 * i); | g_Map.placeEntityPassable(oCivicCenter, 0, civicCenterPosition, startAngle + BUILDING_ORIENTATION + Math.PI * 3/2 * i); | ||||
// Create the city patch | // Create the city patch | ||||
createArea( | createArea( | ||||
new ClumpPlacer(diskArea(gaulCityRadius), 0.6, 0.3, Infinity, civicCenterPosition), | new ClumpPlacer(diskArea(gaulCityRadius), 0.6, 0.3, Infinity, civicCenterPosition), | ||||
[ | [ | ||||
new TerrainPainter(tShore), | new TerrainPainter(tShore), | ||||
new TileClassPainter(clGauls) | new TileClassPainter(clGauls) | ||||
]); | ]); | ||||
// Place walls and buildings | // Place walls and buildings | ||||
placeCustomFortress(civicCenterPosition, fortressDanubiusVillage, "danubius_village", 0, startAngle + Math.PI); | placeCustomFortress(civicCenterPosition, fortressDanubiusVillage, "danubius_village", 0, startAngle + Math.PI); | ||||
placeCustomFortress(civicCenterPosition, fortressDanubiusSpikes, "danubius_spikes", 0, startAngle + Math.PI); | placeCustomFortress(civicCenterPosition, fortressDanubiusSpikes, "danubius_spikes", 0, startAngle + Math.PI); | ||||
// Place treasure, potentially inside buildings | // Place treasure, potentially inside buildings | ||||
for (let i = 0; i < gallicCCTreasureCount; ++i) | for (let j = 0; j < gallicCCTreasureCount; ++j) | ||||
g_Map.placeEntityPassable( | g_Map.placeEntityPassable( | ||||
pickRandom(oTreasures), | pickRandom(oTreasures), | ||||
0, | 0, | ||||
Vector2D.add(civicCenterPosition, new Vector2D(randFloat(-0.8, 0.8) * gaulCityRadius, 0).rotate(randomAngle())), | Vector2D.add(civicCenterPosition, new Vector2D(randFloat(-0.8, 0.8) * gaulCityRadius, 0).rotate(randomAngle())), | ||||
randomAngle()); | randomAngle()); | ||||
} | } | ||||
} | } | ||||
Engine.SetProgress(10); | Engine.SetProgress(10); | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | createForests( | ||||
clForest, | clForest, | ||||
forestTrees); | forestTrees); | ||||
Engine.SetProgress(50); | Engine.SetProgress(50); | ||||
g_Map.log("Creating grass patches"); | g_Map.log("Creating grass patches"); | ||||
createLayeredPatches( | createLayeredPatches( | ||||
[scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)], | [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)], | ||||
[[tGrass, tGrass2],[tGrass2, tGrass3], [tGrass3, tGrass]], | [[tGrass, tGrass2], [tGrass2, tGrass3], [tGrass3, tGrass]], | ||||
[1, 1], | [1, 1], | ||||
avoidClasses(clForest, 0, clPlayer, 10, clWater, 2, clDirt, 2, clHill, 1, clGauls, 5, clPath, 1), | avoidClasses(clForest, 0, clPlayer, 10, clWater, 2, clDirt, 2, clHill, 1, clGauls, 5, clPath, 1), | ||||
scaleByMapSize(15, 45), | scaleByMapSize(15, 45), | ||||
clDirt); | clDirt); | ||||
Engine.SetProgress(55); | Engine.SetProgress(55); | ||||
g_Map.log("Creating islands"); | g_Map.log("Creating islands"); | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | [ | ||||
scaleByMapSize(5, 80), | scaleByMapSize(5, 80), | ||||
scaleByMapSize(5, 80), | scaleByMapSize(5, 80), | ||||
scaleByMapSize(5, 80), | scaleByMapSize(5, 80), | ||||
scaleByMapSize(20, 80) | scaleByMapSize(20, 80) | ||||
], | ], | ||||
i == 0 ? | i == 0 ? | ||||
avoidClasses(clWater, 4, clForest, 1, clPlayer, 16, clRock, 4, clMetal, 4, clHill, 4, clGauls, 5, clPath, 1) : | avoidClasses(clWater, 4, clForest, 1, clPlayer, 16, clRock, 4, clMetal, 4, clHill, 4, clGauls, 5, clPath, 1) : | ||||
[stayClasses(clIsland, 4) , avoidClasses(clForest, 1, clRock, 4, clMetal, 4)]); | [stayClasses(clIsland, 4), avoidClasses(clForest, 1, clRock, 4, clMetal, 4)]); | ||||
Engine.SetProgress(75); | Engine.SetProgress(75); | ||||
g_Map.log("Creating fish"); | g_Map.log("Creating fish"); | ||||
createFood( | createFood( | ||||
[ | [ | ||||
[new SimpleObject(oFish, 2, 3, 0, 2)] | [new SimpleObject(oFish, 2, 3, 0, 2)] | ||||
], | ], | ||||
[ | [ | ||||
▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | createObjectGroupsByAreas( | ||||
0, | 0, | ||||
[avoidClasses(clShip, 3, clIsland, 4), stayClasses(clWater, 4)], | [avoidClasses(clShip, 3, clIsland, 4), stayClasses(clWater, 4)], | ||||
scaleByMapSize(1, 4), | scaleByMapSize(1, 4), | ||||
10, | 10, | ||||
areasWater); | areasWater); | ||||
placePlayersNomad(clPlayer, avoidClasses(clWater, 4, clMetal, 4, clRock, 4, clIsland, 4, clGauls, 20, clRitualPlace, 20, clForest, 1, clBaseResource, 4, clHill, 4, clFood, 2)); | placePlayersNomad(clPlayer, avoidClasses(clWater, 4, clMetal, 4, clRock, 4, clIsland, 4, clGauls, 20, clRitualPlace, 20, clForest, 1, clBaseResource, 4, clHill, 4, clFood, 2)); | ||||
if (randBool(2/3)) | if (day) | ||||
{ | { | ||||
g_Map.log("Setting day theme"); | g_Map.log("Setting day theme"); | ||||
setSkySet("cumulus"); | setSkySet("cumulus"); | ||||
setSunColor(0.9, 0.8, 0.5); | setSunColor(0.9, 0.8, 0.5); | ||||
setFogFactor(0.05); | setFogFactor(0.05); | ||||
setFogThickness(0.25); | setFogThickness(0.25); | ||||
Show All 35 Lines |
Wildfire Games · Phabricator