Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/rmgen/utilityfunctions.js
Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | |||||
function createMines(mines, constraint, tileclass, count) | function createMines(mines, constraint, tileclass, count) | ||||
{ | { | ||||
tileclass = (tileclass !== undefined ? tileclass : clRock); | tileclass = (tileclass !== undefined ? tileclass : clRock); | ||||
constraint = (constraint !== undefined ? constraint : avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1)); | constraint = (constraint !== undefined ? constraint : avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1)); | ||||
count = (count !== undefined ? count : scaleByMapSize(4,16)); | count = (count !== undefined ? count : scaleByMapSize(4,16)); | ||||
for (var i = 0; i < mines.length; ++i) | for (var i = 0; i < mines.length; ++i) | ||||
{ | { | ||||
var group = new SimpleGroup(mines[i], true, tileclass); | var group = new SimpleGroup(mines[i], true, tileclass); | ||||
createObjectGroups(group, 0, | createObjectGroupsDeprecated(group, 0, | ||||
constraint, | constraint, | ||||
count, 70 | count, 70 | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Places 8 stone mines in a small circular shape. | * Places 8 stone mines in a small circular shape. | ||||
Show All 24 Lines | function createDecoration(objects, counts, constraint) | ||||
log("Creating decoration..."); | log("Creating decoration..."); | ||||
constraint = (constraint !== undefined ? constraint : avoidClasses(clForest, 0, clPlayer, 0, clHill, 0)); | constraint = (constraint !== undefined ? constraint : avoidClasses(clForest, 0, clPlayer, 0, clHill, 0)); | ||||
for (var i = 0; i < objects.length; ++i) | for (var i = 0; i < objects.length; ++i) | ||||
{ | { | ||||
var group = new SimpleGroup( | var group = new SimpleGroup( | ||||
objects[i], | objects[i], | ||||
true | true | ||||
); | ); | ||||
createObjectGroups( | createObjectGroupsDeprecated( | ||||
group, 0, | group, 0, | ||||
constraint, | constraint, | ||||
counts[i], 5 | counts[i], 5 | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
function createFood(objects, counts, constraint, tileclass) | function createFood(objects, counts, constraint, tileclass) | ||||
{ | { | ||||
log("Creating food..."); | log("Creating food..."); | ||||
constraint = (constraint !== undefined ? constraint : avoidClasses(clForest, 0, clPlayer, 20, clHill, 1, clFood, 20)); | constraint = (constraint !== undefined ? constraint : avoidClasses(clForest, 0, clPlayer, 20, clHill, 1, clFood, 20)); | ||||
tileclass = (tileclass !== undefined ? tileclass : clFood); | tileclass = (tileclass !== undefined ? tileclass : clFood); | ||||
for (var i = 0; i < objects.length; ++i) | for (var i = 0; i < objects.length; ++i) | ||||
{ | { | ||||
var group = new SimpleGroup( | var group = new SimpleGroup( | ||||
objects[i], | objects[i], | ||||
true, tileclass | true, tileclass | ||||
); | ); | ||||
createObjectGroups( | createObjectGroupsDeprecated( | ||||
group, 0, | group, 0, | ||||
constraint, | constraint, | ||||
counts[i], 50 | counts[i], 50 | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
function createStragglerTrees(types, constraint, tileclass) | function createStragglerTrees(types, constraint, tileclass) | ||||
{ | { | ||||
log("Creating straggler trees..."); | log("Creating straggler trees..."); | ||||
constraint = constraint !== undefined ? | constraint = constraint !== undefined ? | ||||
constraint : | constraint : | ||||
avoidClasses(clForest, 8, clHill, 1, clPlayer, 12, clMetal, 6, clRock, 6); | avoidClasses(clForest, 8, clHill, 1, clPlayer, 12, clMetal, 6, clRock, 6); | ||||
tileclass = tileclass !== undefined ? tileclass : clForest; | tileclass = tileclass !== undefined ? tileclass : clForest; | ||||
var num = floor(g_numStragglerTrees / types.length); | var num = floor(g_numStragglerTrees / types.length); | ||||
for (var i = 0; i < types.length; ++i) | for (var i = 0; i < types.length; ++i) | ||||
{ | { | ||||
let group = new SimpleGroup( | let group = new SimpleGroup( | ||||
[new SimpleObject(types[i], 1,1, 0,3)], | [new SimpleObject(types[i], 1,1, 0,3)], | ||||
true, tileclass | true, tileclass | ||||
); | ); | ||||
createObjectGroups(group, 0, | createObjectGroupsDeprecated(group, 0, | ||||
constraint, | constraint, | ||||
num | num | ||||
); | ); | ||||
} | } | ||||
} | } |
Wildfire Games · Phabricator