Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/rmgen/math.js
Context not available. | |||||
return [points, angle]; | return [points, angle]; | ||||
} | } | ||||
function getRandomMapPoints(pointCount) | |||||
elexis: We have a function picking a random coordinate already in g_Map.
The library complexity should… | |||||
aeoniosAuthorUnsubmitted Not Done Inline ActionsThat's true. I could probably just move this to g_Map and have it use the existing random point function. I wanted a way to generate large numbers of points with one line of code though. I don't really want to have to use a loop every time I want multiple points. Also the existing features are.. lacking in a lot of ways. I had to make custom implementations of 'createbumps' and 'createpatches' because the library versions were more or less useless. aeonios: That's true. I could probably just move this to g_Map and have it use the existing random point… | |||||
{ | |||||
let points = []; | |||||
let mapSize = g_Map.getSize(); | |||||
for (let i = 0; i < pointCount; ++i) | |||||
points[i] = new Vector2D(randIntExclusive(0, mapSize), randIntExclusive(0, mapSize)); | |||||
return points; | |||||
} | |||||
/** | /** | ||||
* Returns the shortest distance from a point to a line. | * Returns the shortest distance from a point to a line. | ||||
* The sign of the return value determines the direction! | * The sign of the return value determines the direction! | ||||
Context not available. |
Wildfire Games · Phabricator
We have a function picking a random coordinate already in g_Map.
The library complexity should be reduced while keeping the same features.