diff --git a/binaries/data/mods/public/maps/random/ardennes_forest.js b/binaries/data/mods/public/maps/random/ardennes_forest.js index d0558136a3..86446c0cc5 100644 --- a/binaries/data/mods/public/maps/random/ardennes_forest.js +++ b/binaries/data/mods/public/maps/random/ardennes_forest.js @@ -362,8 +362,8 @@ for (var ix = 0; ix < mapSize; ix++) explorableArea.points.push(pt); } - if (h > 35 && g_Map.validT(ix, iz) && randBool(0.1) || - h < 15 && g_Map.validT(ix, iz) && randBool(0.05) && hillDecoClass.countMembersInRadius(ix, iz, 1) == 0) + if (h > 35 && randBool(0.1) || + h < 15 && randBool(0.05) && hillDecoClass.countMembersInRadius(ix, iz, 1) == 0) placeObject(ix + randFloat(0, 1), iz + randFloat(0, 1), pickRandom(aTrees), 0, randFloat(0, 2 * PI)); } } diff --git a/binaries/data/mods/public/maps/random/rmgen/library.js b/binaries/data/mods/public/maps/random/rmgen/library.js index 3a2b0ef420..a9a0d42802 100644 --- a/binaries/data/mods/public/maps/random/rmgen/library.js +++ b/binaries/data/mods/public/maps/random/rmgen/library.js @@ -226,7 +226,7 @@ function createObjectGroups(placer, player, constraint, amount, retryFactor = 10 "placer": placer, "player": player, "constraint": constraint, - "halfMapSize": g_Map.size / 2 - 3 + "halfMapSize": getMapSize() / 2 - MAP_BORDER_WIDTH }; return retryPlacing(placeFunc, args, retryFactor, amount, false, behaveDeprecated); @@ -280,7 +280,7 @@ function createSimpleTerrain(terrain) function placeObject(x, z, type, player, angle) { - if (g_Map.validT(x, z, MAP_BORDER_WIDTH)) + if (g_Map.validT(x, z)) g_Map.addObject(new Entity(type, player, x, z, angle)); } diff --git a/binaries/data/mods/public/maps/random/rmgen/map.js b/binaries/data/mods/public/maps/random/rmgen/map.js index 1b6b77069f..91956ec3bb 100644 --- a/binaries/data/mods/public/maps/random/rmgen/map.js +++ b/binaries/data/mods/public/maps/random/rmgen/map.js @@ -86,6 +86,8 @@ Map.prototype.getEntityID = function() // Check bounds on tile map Map.prototype.validT = function(x, z, distance = 0) { + distance += MAP_BORDER_WIDTH; + if (g_MapSettings.CircularMap) { let halfSize = Math.floor(this.size / 2); @@ -159,7 +161,7 @@ Map.prototype.getTerrainObjects = function(x, z) Map.prototype.setTerrainObject = function(x, z, object) { - if (!this.validT(x, z, 2)) + if (!this.validT(x, z)) throw "setTerrainObject: invalid tile position (" + x + ", " + z + ")"; this.terrainObjects[x][z] = object; diff --git a/binaries/data/mods/public/maps/random/rmgen/placer.js b/binaries/data/mods/public/maps/random/rmgen/placer.js index fb68d19754..17ac525ec8 100644 --- a/binaries/data/mods/public/maps/random/rmgen/placer.js +++ b/binaries/data/mods/public/maps/random/rmgen/placer.js @@ -523,7 +523,7 @@ SimpleGroup.prototype.place = function(player, constraint) // Add placed objects to map for (let obj of resultObjs) { - if (g_Map.validT(obj.position.x / CELL_SIZE, obj.position.z / CELL_SIZE, MAP_BORDER_WIDTH)) + if (g_Map.validT(obj.position.x / CELL_SIZE, obj.position.z / CELL_SIZE)) g_Map.addObject(obj); // Convert position to integer number of tiles diff --git a/binaries/data/mods/public/maps/random/rmgen/terrain.js b/binaries/data/mods/public/maps/random/rmgen/terrain.js index 5b13dc6a31..6fd83e7030 100644 --- a/binaries/data/mods/public/maps/random/rmgen/terrain.js +++ b/binaries/data/mods/public/maps/random/rmgen/terrain.js @@ -41,7 +41,7 @@ SimpleTerrain.prototype = new Terrain(); SimpleTerrain.prototype.constructor = SimpleTerrain; SimpleTerrain.prototype.placeNew = function(x, z) { - if (this.treeType !== undefined && g_Map.validT(round(x), round(z), MAP_BORDER_WIDTH)) + if (this.treeType !== undefined && g_Map.validT(Math.round(x), Math.round(z))) g_Map.terrainObjects[x][z] = new Entity(this.treeType, 0, x + 0.5, z + 0.5, randFloat(0, 2 * PI)); g_Map.texture[x][z] = g_Map.getTextureID(this.texture); diff --git a/binaries/data/mods/public/maps/random/rmgen2/gaia.js b/binaries/data/mods/public/maps/random/rmgen2/gaia.js index 16eb6306d8..4e3a3b212d 100644 --- a/binaries/data/mods/public/maps/random/rmgen2/gaia.js +++ b/binaries/data/mods/public/maps/random/rmgen2/gaia.js @@ -875,7 +875,7 @@ function addStragglerTrees(constraint, size, deviation, fill) var trees = [g_Gaia.tree1, g_Gaia.tree2, g_Gaia.tree3, g_Gaia.tree4]; var treesPerPlayer = 40; - var playerBonus = Math.max(1, (getNumPlayers() - 3) / 2); + var playerBonus = Math.max(1, (getNumPlayers() - MAP_BORDER_WIDTH) / 2); var offset = getRandomDeviation(size, deviation); var treeCount = treesPerPlayer * playerBonus * fill; @@ -1170,7 +1170,7 @@ function smoothElevation(x, z) { var thisX = x + xOffset; var thisZ = z + zOffset; - if (!g_Map.validT(thisX, thisZ)) + if (!g_Map.validH(thisX, thisZ)) continue; var height = g_Map.getHeight(thisX, thisZ); diff --git a/binaries/data/mods/public/maps/random/unknown_nomad.js b/binaries/data/mods/public/maps/random/unknown_nomad.js index ad26bfcb43..19fd6db3d7 100644 --- a/binaries/data/mods/public/maps/random/unknown_nomad.js +++ b/binaries/data/mods/public/maps/random/unknown_nomad.js @@ -1069,7 +1069,7 @@ for (var i = 0; i < numPlayers; i++) { for (var mz = 0; mz < mapSize; mz++) { - if (!g_Map.validT(mx, mz, 6)) + if (!g_Map.validT(mx, mz, 3)) continue; var placable = true; @@ -1090,7 +1090,7 @@ for (var i = 0; i < numPlayers; i++) { for (var mz = 0; mz < mapSize; mz++) { - if (!g_Map.validT(mx, mz, 6)) + if (!g_Map.validT(mx, mz, 3)) continue; var placable = true;