Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/danubius.js
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | const oTreasures = [ | ||||
"gaia/treasure/wood", | "gaia/treasure/wood", | ||||
"gaia/treasure/metal" | "gaia/treasure/metal" | ||||
]; | ]; | ||||
// Disable capturing on all parts of the village except the | // Disable capturing on all parts of the village except the | ||||
// civic center and buildings occurring outside of the village | // civic center and buildings occurring outside of the village | ||||
const oCivicCenter = "structures/gaul_civil_centre"; | const oCivicCenter = "structures/gaul_civil_centre"; | ||||
const oTower = "structures/gaul_defense_tower"; | const oTower = "structures/gaul_defense_tower"; | ||||
const oOutpost = "structures/gaul_outpost"; | const oLookout = "structures/gaul_lookout"; | ||||
const oTemple = "uncapturable|structures/gaul_temple"; | const oTemple = "uncapturable|structures/gaul_temple"; | ||||
const oTavern = "uncapturable|structures/gaul_tavern"; | const oTavern = "uncapturable|structures/gaul_tavern"; | ||||
const oHouse = "uncapturable|structures/gaul_house"; | const oHouse = "uncapturable|structures/gaul_house"; | ||||
const oLongHouse = "uncapturable|other/celt_longhouse"; | const oLongHouse = "uncapturable|other/celt_longhouse"; | ||||
const oHut = "uncapturable|other/celt_hut"; | const oHut = "uncapturable|other/celt_hut"; | ||||
const oSentryTower = "uncapturable|structures/gaul_sentry_tower"; | const oSentryTower = "uncapturable|structures/gaul_sentry_tower"; | ||||
const oWatchTower = "uncapturable|structures/palisades_watchtower"; | const oWatchTower = "uncapturable|structures/palisades_watchtower"; | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | |||||
var clFood = g_Map.createTileClass(); | var clFood = g_Map.createTileClass(); | ||||
var clBaseResource = g_Map.createTileClass(); | var clBaseResource = g_Map.createTileClass(); | ||||
var clHill = g_Map.createTileClass(); | var clHill = g_Map.createTileClass(); | ||||
var clIsland = g_Map.createTileClass(); | var clIsland = g_Map.createTileClass(); | ||||
var clTreasure = g_Map.createTileClass(); | var clTreasure = g_Map.createTileClass(); | ||||
var clWaterLog = g_Map.createTileClass(); | var clWaterLog = g_Map.createTileClass(); | ||||
var clGauls = g_Map.createTileClass(); | var clGauls = g_Map.createTileClass(); | ||||
var clTower = g_Map.createTileClass(); | var clTower = g_Map.createTileClass(); | ||||
var clOutpost = g_Map.createTileClass(); | var clLookout = g_Map.createTileClass(); | ||||
var clPath = g_Map.createTileClass(); | var clPath = g_Map.createTileClass(); | ||||
var clRitualPlace = g_Map.createTileClass(); | var clRitualPlace = g_Map.createTileClass(); | ||||
var startAngle = randomAngle(); | var startAngle = randomAngle(); | ||||
var waterWidth = fractionToTiles(0.3); | var waterWidth = fractionToTiles(0.3); | ||||
// How many treasures will be placed near the gallic civic centers | // How many treasures will be placed near the gallic civic centers | ||||
var gallicCCTreasureCount = randIntInclusive(8, 12); | var gallicCCTreasureCount = randIntInclusive(8, 12); | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | paintRiver({ | ||||
"deviation": 0, | "deviation": 0, | ||||
"heightRiverbed": heightSeaGround, | "heightRiverbed": heightSeaGround, | ||||
"heightLand": heightLand, | "heightLand": heightLand, | ||||
"meanderShort": 30, | "meanderShort": 30, | ||||
"meanderLong": 0, | "meanderLong": 0, | ||||
"waterFunc": (position, height, riverFraction) => { | "waterFunc": (position, height, riverFraction) => { | ||||
let origPos = position.clone().rotateAround(-startAngle, mapCenter); | let origPos = position.clone().rotateAround(-startAngle, mapCenter); | ||||
// Distinguish left and right shoreline | // Distinguish left and right shoreline | ||||
if (0 < height && height < 1 && | if (0 < height && height < 1 && | ||||
Lint: ESLintBear (yoda): `Expected literal to be on the right side of <.` | |||||
origPos.y > ShorelineDistance && origPos.y < mapSize - ShorelineDistance) | origPos.y > ShorelineDistance && origPos.y < mapSize - ShorelineDistance) | ||||
clShore[origPos.x < mapCenter.x ? 0 : 1].add(position); | clShore[origPos.x < mapCenter.x ? 0 : 1].add(position); | ||||
}, | }, | ||||
"landFunc": (position, shoreDist1, shoreDist2) => { | "landFunc": (position, shoreDist1, shoreDist2) => { | ||||
if (shoreDist1 > 0) | if (shoreDist1 > 0) | ||||
clLand[0].add(position); | clLand[0].add(position); | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
createObjectGroupsByAreas( | createObjectGroupsByAreas( | ||||
new SimpleGroup([new SimpleObject(oTower, 1, 1, 0, 4)], true, clTower), | new SimpleGroup([new SimpleObject(oTower, 1, 1, 0, 4)], true, clTower), | ||||
0, | 0, | ||||
[avoidClasses(clMetal, 4, clRock, 4, clTower, 20), stayClasses(clIsland, 7)], | [avoidClasses(clMetal, 4, clRock, 4, clTower, 20), stayClasses(clIsland, 7)], | ||||
scaleByMapSize(3, 10), | scaleByMapSize(3, 10), | ||||
20, | 20, | ||||
areaIslands); | areaIslands); | ||||
g_Map.log("Creating island outposts"); | g_Map.log("Creating island lookouts"); | ||||
createObjectGroupsByAreas( | createObjectGroupsByAreas( | ||||
new SimpleGroup([new SimpleObject(oOutpost, 1, 1, 0, 4)], true, clOutpost), | new SimpleGroup([new SimpleObject(oLookout, 1, 1, 0, 4)], true, clLookout), | ||||
0, | 0, | ||||
[avoidClasses(clMetal, 4, clRock, 4, clTower, 5, clOutpost, 20), stayClasses(clIsland, 7)], | [avoidClasses(clMetal, 4, clRock, 4, clTower, 5, clLookout, 20), stayClasses(clIsland, 7)], | ||||
scaleByMapSize(3, 10), | scaleByMapSize(3, 10), | ||||
20, | 20, | ||||
areaIslands); | areaIslands); | ||||
g_Map.log("Creating metal mines"); | g_Map.log("Creating metal mines"); | ||||
createObjectGroupsByAreas( | createObjectGroupsByAreas( | ||||
new SimpleGroup([new SimpleObject(oMetalLarge, 1, 1, 0, 4)], true, clMetal), | new SimpleGroup([new SimpleObject(oMetalLarge, 1, 1, 0, 4)], true, clMetal), | ||||
0, | 0, | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
createStragglerTrees( | createStragglerTrees( | ||||
treeTypes, | treeTypes, | ||||
avoidClasses(clForest, 2, clWater, 8, clPlayer, 16, clMetal, 4, clRock, 4, clFood, 1, clHill, 2, clGauls, 5, clPath, 5), | avoidClasses(clForest, 2, clWater, 8, clPlayer, 16, clMetal, 4, clRock, 4, clFood, 1, clHill, 2, clGauls, 5, clPath, 5), | ||||
clForest, | clForest, | ||||
stragglerTrees); | stragglerTrees); | ||||
createStragglerTrees( | createStragglerTrees( | ||||
treeTypes, | treeTypes, | ||||
[stayClasses(clIsland, 4), avoidClasses(clMetal, 4, clRock, 4, clTower, 4, clOutpost, 4)], | [stayClasses(clIsland, 4), avoidClasses(clMetal, 4, clRock, 4, clTower, 4, clLookout, 4)], | ||||
clForest, | clForest, | ||||
stragglerTrees * 7); | stragglerTrees * 7); | ||||
Engine.SetProgress(95); | Engine.SetProgress(95); | ||||
g_Map.log("Creating animals on islands"); | g_Map.log("Creating animals on islands"); | ||||
createFood( | createFood( | ||||
[ | [ | ||||
[new SimpleObject(oSheep, 4, 6, 0, 4)], | [new SimpleObject(oSheep, 4, 6, 0, 4)], | ||||
[new SimpleObject(oGoat, 4, 6, 0, 4)], | [new SimpleObject(oGoat, 4, 6, 0, 4)], | ||||
[new SimpleObject(oRabbit, 5, 8, 0, 4)] | [new SimpleObject(oRabbit, 5, 8, 0, 4)] | ||||
], | ], | ||||
[ | [ | ||||
10 * scaleByMapSize(5, 20), | 10 * scaleByMapSize(5, 20), | ||||
10 * scaleByMapSize(5, 20), | 10 * scaleByMapSize(5, 20), | ||||
10 * scaleByMapSize(5, 20) | 10 * scaleByMapSize(5, 20) | ||||
], | ], | ||||
[avoidClasses(clRock, 4, clMetal, 4, clFood, 3, clForest, 1, clOutpost, 2, clTower, 2), stayClasses(clIsland, 4)], | [avoidClasses(clRock, 4, clMetal, 4, clFood, 3, clForest, 1, clLookout, 2, clTower, 2), stayClasses(clIsland, 4)], | ||||
clFood); | clFood); | ||||
Engine.SetProgress(98); | Engine.SetProgress(98); | ||||
g_Map.log("Creating treasures"); | g_Map.log("Creating treasures"); | ||||
createObjectGroupsByAreas( | createObjectGroupsByAreas( | ||||
new SimpleGroup( | new SimpleGroup( | ||||
[new SimpleObject(pickRandom(oTreasures), 1, 1, 0, 2)], | [new SimpleObject(pickRandom(oTreasures), 1, 1, 0, 2)], | ||||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Expected literal to be on the right side of <.