mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 02:24:36 +00:00
use europe map
This commit is contained in:
@@ -36,9 +36,14 @@ export class FakeHumanExecution implements Execution {
|
||||
|
||||
if (this.mg.inSpawnPhase()) {
|
||||
if (ticks % this.random.nextInt(5, 30) == 0) {
|
||||
const rl = this.randomLand()
|
||||
if (rl == null) {
|
||||
console.warn(`cannot spawn ${this.playerInfo.name}`)
|
||||
return
|
||||
}
|
||||
this.mg.addExecution(new SpawnExecution(
|
||||
this.playerInfo,
|
||||
this.randomLand().cell()
|
||||
rl.cell()
|
||||
))
|
||||
}
|
||||
return
|
||||
@@ -195,9 +200,11 @@ export class FakeHumanExecution implements Execution {
|
||||
this.sendBoat(tries + 1, oceanShore)
|
||||
}
|
||||
|
||||
randomLand(): Tile {
|
||||
randomLand(): Tile | null {
|
||||
const delta = 25
|
||||
while (true) {
|
||||
let tries = 0
|
||||
while (tries < 50) {
|
||||
tries++
|
||||
const cell = new Cell(
|
||||
this.random.nextInt(this.cell.x - delta, this.cell.x + delta),
|
||||
this.random.nextInt(this.cell.y - delta, this.cell.y + delta)
|
||||
@@ -213,6 +220,7 @@ export class FakeHumanExecution implements Execution {
|
||||
return tile
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
sendAttack(toAttack: Player | TerraNullius) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Cell, TerrainType} from './Game';
|
||||
import binAsString from "!!binary-loader!../../../resources/maps/WorldMap.bin";
|
||||
import worldMapInfo from "../../../resources/maps/WorldMap.json"
|
||||
import binAsString from "!!binary-loader!../../../resources/maps/Europe.bin";
|
||||
import worldMapInfo from "../../../resources/maps/Europe.json"
|
||||
|
||||
export interface NationMap {
|
||||
name: string;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {fileURLToPath} from 'url';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
|
||||
const mapName = "Europe"
|
||||
|
||||
interface Coord {
|
||||
x: number;
|
||||
@@ -44,7 +44,7 @@ export class Terrain {
|
||||
}
|
||||
|
||||
export async function loadTerrainMap(): Promise<void> {
|
||||
const imagePath = path.resolve(__dirname, '..', '..', 'resources', 'maps', 'WorldMap.png');
|
||||
const imagePath = path.resolve(__dirname, '..', '..', 'resources', 'maps', mapName + '.png');
|
||||
|
||||
const readStream = createReadStream(imagePath);
|
||||
const img = await PImage.decodePNGFromStream(readStream);
|
||||
@@ -92,7 +92,7 @@ export async function loadTerrainMap(): Promise<void> {
|
||||
processDistToLand(shorelineWaters, terrain)
|
||||
processOcean(terrain)
|
||||
const packed = packTerrain(terrain)
|
||||
const outputPath = path.join(__dirname, '..', '..', 'resources', 'maps', 'WorldMap.bin');
|
||||
const outputPath = path.join(__dirname, '..', '..', 'resources', 'maps', mapName + '.bin');
|
||||
fs.writeFile(outputPath, packed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user