Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/caledonian_meadows.js
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
// Groves, only Wood | // Groves, only Wood | ||||
let groveEntities = ["gaia/flora_bush_temperate", "gaia/flora_tree_euro_beech"]; | let groveEntities = ["gaia/flora_bush_temperate", "gaia/flora_tree_euro_beech"]; | ||||
let groveActors = [ | let groveActors = [ | ||||
"actor|geology/highland1_moss.xml", "actor|geology/highland2_moss.xml", | "actor|geology/highland1_moss.xml", "actor|geology/highland2_moss.xml", | ||||
"actor|props/flora/bush.xml", "actor|props/flora/bush_dry_a.xml", "actor|props/flora/bush_highlands.xml", | "actor|props/flora/bush.xml", "actor|props/flora/bush_dry_a.xml", "actor|props/flora/bush_highlands.xml", | ||||
"actor|props/flora/bush_tempe_a.xml", "actor|props/flora/bush_tempe_b.xml", "actor|props/flora/ferns.xml" | "actor|props/flora/bush_tempe_a.xml", "actor|props/flora/bush_tempe_b.xml", "actor|props/flora/ferns.xml" | ||||
]; | ]; | ||||
let clGrove = g_Map.createTileClass(); | |||||
function placeGrove(point) | function placeGrove(point) | ||||
{ | { | ||||
g_Map.placeEntityPassable(pickRandom(oGroveEntities), 0, point, randomAngle()); | g_Map.placeEntityPassable(pickRandom(oGroveEntities), 0, point, randomAngle()); | ||||
let quantity = randIntInclusive(20, 30); | let quantity = randIntInclusive(20, 30); | ||||
let dAngle = 2 * Math.PI / quantity; | let dAngle = 2 * Math.PI / quantity; | ||||
for (let i = 0; i < quantity; ++i) | for (let i = 0; i < quantity; ++i) | ||||
{ | { | ||||
let angle = dAngle * randFloat(i, i + 1); | let angle = dAngle * randFloat(i, i + 1); | ||||
let dist = randFloat(2, 5); | let dist = randFloat(2, 5); | ||||
let objectList = groveEntities; | let objectList = groveEntities; | ||||
if (i % 3 == 0) | if (i % 3 == 0) | ||||
objectList = groveActors; | objectList = groveActors; | ||||
let position = Vector2D.add(point, new Vector2D(dist, 0).rotate(-angle)); | let position = Vector2D.add(point, new Vector2D(dist, 0).rotate(-angle)); | ||||
g_Map.placeEntityPassable(pickRandom(objectList), 0, position, randomAngle()); | g_Map.placeEntityPassable(pickRandom(objectList), 0, position, randomAngle()); | ||||
createArea( | createArea( | ||||
new ClumpPlacer(5, 1, 1, Infinity, position), | new ClumpPlacer(5, 1, 1, Infinity, position), | ||||
[ | new TerrainPainter(tGrove)); | ||||
new TerrainPainter(tGrove), | |||||
new TileClassPainter(clGrove) | |||||
]); | |||||
} | } | ||||
} | } | ||||
// Camps with fire and gold treasure | // Camps with fire and gold treasure | ||||
function placeCamp(point, | function placeCamp(point, | ||||
centerEntity = "actor|props/special/eyecandy/campfire.xml", | centerEntity = "actor|props/special/eyecandy/campfire.xml", | ||||
otherEntities = ["gaia/treasure/metal", "gaia/treasure/standing_stone", | otherEntities = ["gaia/treasure/metal", "gaia/treasure/standing_stone", | ||||
"units/brit_infantry_slinger_b", "units/brit_infantry_javelinist_b", "units/gaul_infantry_slinger_b", "units/gaul_infantry_javelinist_b", "units/gaul_champion_fanatic", | "units/brit_infantry_slinger_b", "units/brit_infantry_javelinist_b", "units/gaul_infantry_slinger_b", "units/gaul_infantry_javelinist_b", "units/gaul_champion_fanatic", | ||||
Show All 31 Lines | for (let i = 0; i < quantity; ++i) | ||||
angle = currentAngle + randFloat(0, dAngle); | angle = currentAngle + randFloat(0, dAngle); | ||||
let objectList = groveEntities; | let objectList = groveEntities; | ||||
if (i % 2 == 0) | if (i % 2 == 0) | ||||
objectList = groveActors; | objectList = groveActors; | ||||
let woodPosition = Vector2D.add(point, new Vector2D(randFloat(10, 15), 0).rotate(-angle)); | let woodPosition = Vector2D.add(point, new Vector2D(randFloat(10, 15), 0).rotate(-angle)); | ||||
g_Map.placeEntityPassable(pickRandom(objectList), 0, woodPosition, randomAngle()); | g_Map.placeEntityPassable(pickRandom(objectList), 0, woodPosition, randomAngle()); | ||||
createArea( | createArea( | ||||
new ClumpPlacer(5, 1, 1, Infinity, woodPosition), | new ClumpPlacer(5, 1, 1, Infinity, woodPosition), | ||||
[ | new TerrainPainter("temp_grass_plants")); | ||||
new TerrainPainter("temp_grass_plants"), | |||||
new TileClassPainter(clGrove) | |||||
]); | |||||
currentAngle += dAngle; | currentAngle += dAngle; | ||||
} | } | ||||
// Metal and chicken | // Metal and chicken | ||||
dAngle = 2 * Math.PI * 2 / 9; | dAngle = 2 * Math.PI * 2 / 9; | ||||
angle = currentAngle + dAngle * randFloat(1, 3) / 4; | angle = currentAngle + dAngle * randFloat(1, 3) / 4; | ||||
let metalPosition = Vector2D.add(point, new Vector2D(13, 0).rotate(-angle)); | let metalPosition = Vector2D.add(point, new Vector2D(13, 0).rotate(-angle)); | ||||
placeMine(metalPosition, "gaia/geology_metal_temperate_slabs"); | placeMine(metalPosition, "gaia/geology_metal_temperate_slabs"); | ||||
Show All 11 Lines | function placeStartLocationResources(point, foodEntities = ["gaia/flora_bush_berry", "gaia/fauna_chicken", "gaia/fauna_chicken"]) | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Environment settings | * Environment settings | ||||
*/ | */ | ||||
setBiome("generic/alpine"); | setBiome("generic/alpine"); | ||||
g_Environment.Fog.FogColor = { "r": 0.8, "g": 0.8, "b": 0.8, "a": 0.01 }; | g_Environment.Fog.FogColor = { "r": 0.8, "g": 0.8, "b": 0.8, "a": 0.01 }; | ||||
g_Environment.Water.WaterBody.Colour = { "r" : 0.3, "g" : 0.05, "b" : 0.1, "a" : 0.1 }; | g_Environment.Water.WaterBody.Colour = { "r": 0.3, "g": 0.05, "b": 0.1, "a": 0.1 }; | ||||
g_Environment.Water.WaterBody.Murkiness = 0.4; | g_Environment.Water.WaterBody.Murkiness = 0.4; | ||||
/** | /** | ||||
* Base terrain shape generation and settings | * Base terrain shape generation and settings | ||||
*/ | */ | ||||
let heightScale = (g_Map.size + 256) / 768 / 4; | let heightScale = (g_Map.size + 256) / 768 / 4; | ||||
let heightRange = { "min": MIN_HEIGHT * heightScale, "max": MAX_HEIGHT * heightScale }; | let heightRange = { "min": MIN_HEIGHT * heightScale, "max": MAX_HEIGHT * heightScale }; | ||||
▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator