mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-26 04:42:42 +00:00
add Oceania and North America maps
This commit is contained in:
@@ -6,7 +6,6 @@ import { BotSpawner } from "./BotSpawner";
|
||||
import { TransportShipExecution } from "./TransportShipExecution";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { FakeHumanExecution } from "./FakeHumanExecution";
|
||||
import Usernames from '../../../resources/Usernames.txt'
|
||||
import { processName, sanitize, simpleHash } from "../Util";
|
||||
import { AllianceRequestExecution } from "./alliance/AllianceRequestExecution";
|
||||
import { AllianceRequestReplyExecution } from "./alliance/AllianceRequestReplyExecution";
|
||||
@@ -29,7 +28,6 @@ import { CityExecution } from "./CityExecution";
|
||||
|
||||
export class Executor {
|
||||
|
||||
private usernames = Usernames.split('\n')
|
||||
|
||||
// private random = new PseudoRandom(999)
|
||||
private random: PseudoRandom = null
|
||||
|
||||
@@ -20,7 +20,9 @@ export enum Difficulty {
|
||||
export enum GameMap {
|
||||
World,
|
||||
Europe,
|
||||
Mena
|
||||
Mena,
|
||||
NorthAmerica,
|
||||
Oceania
|
||||
}
|
||||
|
||||
export enum GameType {
|
||||
|
||||
@@ -9,10 +9,18 @@ import worldInfo from "../../../resources/maps/WorldMap.json"
|
||||
import menaBin from "!!binary-loader!../../../resources/maps/Mena.bin"
|
||||
import menaInfo from "../../../resources/maps/Mena.json"
|
||||
|
||||
import northAmericaBin from "!!binary-loader!../../../resources/maps/NorthAmerica.bin"
|
||||
import northAmericaInfo from "../../../resources/maps/NorthAmerica.json"
|
||||
|
||||
import oceaniaBin from "!!binary-loader!../../../resources/maps/Oceania.bin"
|
||||
import oceaniaInfo from "../../../resources/maps/Oceania.json"
|
||||
|
||||
const maps = new Map()
|
||||
.set(GameMap.World, { bin: worldBin, info: worldInfo })
|
||||
.set(GameMap.Europe, { bin: europeBin, info: europeInfo })
|
||||
.set(GameMap.Mena, { bin: menaBin, info: menaInfo });
|
||||
.set(GameMap.Mena, { bin: menaBin, info: menaInfo })
|
||||
.set(GameMap.NorthAmerica, { bin: northAmericaBin, info: northAmericaInfo })
|
||||
.set(GameMap.Oceania, { bin: oceaniaBin, info: oceaniaInfo })
|
||||
|
||||
const loadedMaps = new Map<GameMap, TerrainMapImpl>()
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TerrainTile } from '../core/game/Game';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const mapName = "Mena"
|
||||
const mapName = "Oceania"
|
||||
|
||||
interface Coord {
|
||||
x: number;
|
||||
@@ -40,7 +40,6 @@ export async function loadTerrainMap(): Promise<void> {
|
||||
|
||||
let max = 0
|
||||
let min = 1000
|
||||
const array: number[] = new Array(256).fill(0);
|
||||
|
||||
|
||||
// Iterate through each pixel
|
||||
@@ -50,15 +49,13 @@ export async function loadTerrainMap(): Promise<void> {
|
||||
const alpha = color & 0xff;
|
||||
const blue = (color >> 8) & 0xff;
|
||||
|
||||
if (alpha < 20) { // transparent
|
||||
if (alpha < 20 || blue == 106) { // transparent
|
||||
terrain[x][y] = new Terrain(TerrainType.Water);
|
||||
} else {
|
||||
terrain[x][y] = new Terrain(TerrainType.Land)
|
||||
terrain[x][y].magnitude = 0
|
||||
|
||||
|
||||
array[blue]++
|
||||
|
||||
// 140 -> 200 = 60
|
||||
const mag = Math.min(200, Math.max(140, blue)) - 140
|
||||
terrain[x][y].magnitude = mag / 2
|
||||
|
||||
Reference in New Issue
Block a user