Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/snowflake_searocks.js
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
const clLand = g_Map.createTileClass(); | const clLand = g_Map.createTileClass(); | ||||
const playerIslandRadius = scaleByMapSize(15, 30); | const playerIslandRadius = scaleByMapSize(15, 30); | ||||
const islandBetweenPlayerAndCenterDist = 0.16; | const islandBetweenPlayerAndCenterDist = 0.16; | ||||
const islandBetweenPlayerAndCenterRadius = 0.81; | const islandBetweenPlayerAndCenterRadius = 0.81; | ||||
const centralIslandRadius = 0.36; | const centralIslandRadius = 0.36; | ||||
var [playerIDs, playerPosition, playerAngle, startAngle] = playerPlacementCircle(fractionToTiles(0.35)); | const [playerIDs, playerPosition, playerAngle, startAngle] = playerPlacementCircle(fractionToTiles(0.35)); | ||||
var numIslands = 0; | let numIslands = 0; | ||||
var isConnected = []; | const isConnected = []; | ||||
var islandPos = []; | const islandPos = []; | ||||
function initIsConnected() | function initIsConnected() | ||||
{ | { | ||||
for (let m = 0; m < numIslands; ++m) | for (let m = 0; m < numIslands; ++m) | ||||
{ | { | ||||
isConnected[m] = []; | isConnected[m] = []; | ||||
for (let n = 0; n < numIslands; ++n) | for (let n = 0; n < numIslands; ++n) | ||||
isConnected[m][n] = 0; | isConnected[m][n] = 0; | ||||
Show All 15 Lines | |||||
{ | { | ||||
const angle = startAngle + (playerID * 2 + playerIDOffset) * Math.PI / numPlayers; | const angle = startAngle + (playerID * 2 + playerIDOffset) * Math.PI / numPlayers; | ||||
islandPos[islandID] = Vector2D.add(mapCenter, new Vector2D(fractionToTiles(distFromCenter), 0).rotate(-angle)).round(); | islandPos[islandID] = Vector2D.add(mapCenter, new Vector2D(fractionToTiles(distFromCenter), 0).rotate(-angle)).round(); | ||||
createIsland(islandID, islandRadius, clLand); | createIsland(islandID, islandRadius, clLand); | ||||
} | } | ||||
function createSnowflakeSearockWithCenter(sizeID) | function createSnowflakeSearockWithCenter(sizeID) | ||||
{ | { | ||||
const [tertiaryIslandDist, tertiaryIslandRadius, islandBetweenPlayersDist, islandBetweenPlayersRadius] = islandSizes[sizeID]; | const [tertiaryIslandDist, tertiaryIslandRadius, islandBetweenPlayersDist, islandBetweenPlayersRadius] = islandSizes[sizeID]; | ||||
Lint: no-use-before-define: 'islandSizes' was used before it was defined. | |||||
const islandID_center = 4 * numPlayers; | const islandID_center = 4 * numPlayers; | ||||
numIslands = islandID_center + 1; | numIslands = islandID_center + 1; | ||||
initIsConnected(); | initIsConnected(); | ||||
g_Map.log("Creating central island"); | g_Map.log("Creating central island"); | ||||
islandPos[islandID_center] = mapCenter; | islandPos[islandID_center] = mapCenter; | ||||
createIsland(islandID_center, centralIslandRadius, clLand); | createIsland(islandID_center, centralIslandRadius, clLand); | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
'islandSizes' was used before it was defined.