mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 18:46:49 +00:00
Merge branch 'main' into defenseposture
This commit is contained in:
@@ -31,6 +31,7 @@ REGION=$1
|
||||
VERSION_TAG="latest"
|
||||
DOCKER_REPO=""
|
||||
ENV=""
|
||||
SSH_KEY=""
|
||||
|
||||
# Set environment-specific variables
|
||||
if [ "$REGION" == "staging" ]; then
|
||||
@@ -38,15 +39,18 @@ if [ "$REGION" == "staging" ]; then
|
||||
SERVER_HOST=$SERVER_HOST_STAGING
|
||||
DOCKER_REPO=$DOCKER_REPO_STAGING
|
||||
ENV="staging"
|
||||
SSH_KEY=$SSH_KEY_STAGING
|
||||
elif [ "$REGION" == "us" ]; then
|
||||
print_header "DEPLOYING TO US ENVIRONMENT"
|
||||
SERVER_HOST=$SERVER_HOST_US
|
||||
DOCKER_REPO=$DOCKER_REPO_PROD # Uses prod Docker repo for alt environment
|
||||
SSH_KEY=$SSH_KEY_PROD
|
||||
ENV="prod"
|
||||
else
|
||||
print_header "DEPLOYING TO EU ENVIRONMENT"
|
||||
SERVER_HOST=$SERVER_HOST_EU
|
||||
DOCKER_REPO=$DOCKER_REPO_PROD
|
||||
SSH_KEY=$SSH_KEY_PROD
|
||||
ENV="prod"
|
||||
fi
|
||||
|
||||
@@ -57,10 +61,11 @@ if [ -z "$SERVER_HOST" ]; then
|
||||
fi
|
||||
|
||||
# Configuration
|
||||
SSH_KEY=${SSH_KEY:-"~/.ssh/id_rsa"} # Use default or override from .env
|
||||
DOCKER_USERNAME=${DOCKER_USERNAME} # Docker Hub username
|
||||
UPDATE_SCRIPT="./update.sh" # Path to your update script
|
||||
REMOTE_UPDATE_SCRIPT="/root/update-openfront.sh" # Where to place the script on server
|
||||
REMOTE_USER="openfront"
|
||||
REMOTE_UPDATE_PATH="/home/$REMOTE_USER"
|
||||
REMOTE_UPDATE_SCRIPT="$REMOTE_UPDATE_PATH/update-openfront.sh" # Where to place the script on server
|
||||
|
||||
# Check if update script exists
|
||||
if [ ! -f "$UPDATE_SCRIPT" ]; then
|
||||
@@ -90,28 +95,23 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Failed to push image to Docker Hub. Stopping deployment."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Docker image built and pushed successfully."
|
||||
|
||||
# Step 2: Copy update script to Hetzner server
|
||||
print_header "STEP 2: Copying update script to server"
|
||||
echo "Target: $SERVER_HOST"
|
||||
echo "Target: $REMOTE_USER@$SERVER_HOST"
|
||||
|
||||
# Make sure the update script is executable
|
||||
chmod +x $UPDATE_SCRIPT
|
||||
|
||||
# Copy the update script to the server
|
||||
scp -i $SSH_KEY $UPDATE_SCRIPT $SERVER_HOST:$REMOTE_UPDATE_SCRIPT
|
||||
scp -i $SSH_KEY $UPDATE_SCRIPT $REMOTE_USER@$SERVER_HOST:$REMOTE_UPDATE_SCRIPT
|
||||
|
||||
# Copy environment variables if needed
|
||||
if [ -f .env ]; then
|
||||
scp -i $SSH_KEY .env $SERVER_HOST:/root/.env
|
||||
scp -i $SSH_KEY .env $REMOTE_USER@$SERVER_HOST:$REMOTE_UPDATE_PATH/.env
|
||||
# Secure the .env file
|
||||
ssh -i $SSH_KEY $SERVER_HOST "chmod 600 /root/.env"
|
||||
ssh -i $SSH_KEY $REMOTE_USER@$SERVER_HOST "chmod 600 $REMOTE_UPDATE_PATH/.env"
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -125,7 +125,7 @@ echo "✅ Update script successfully copied to server."
|
||||
print_header "STEP 3: Executing update script on server"
|
||||
|
||||
# Make the script executable on the remote server and execute it with the environment parameter
|
||||
ssh -i $SSH_KEY $SERVER_HOST "chmod +x $REMOTE_UPDATE_SCRIPT && $REMOTE_UPDATE_SCRIPT $REGION $DOCKER_USERNAME $DOCKER_REPO"
|
||||
ssh -i $SSH_KEY $REMOTE_USER@$SERVER_HOST "chmod +x $REMOTE_UPDATE_SCRIPT && $REMOTE_UPDATE_SCRIPT $REGION $DOCKER_USERNAME $DOCKER_REPO"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Failed to execute update script on server."
|
||||
|
||||
+18
-12
@@ -1,14 +1,20 @@
|
||||
# AWS Configuration
|
||||
AWS_REGION=region-name
|
||||
AWS_ACCOUNT_ID=your-account-id
|
||||
# Server Configuration
|
||||
SERVER_HOST_STAGING=xxx.xxx.xx.xxx
|
||||
SERVER_HOST_EU=xxx.xxx.xxx.xxx
|
||||
SERVER_HOST_US=x.xxx.xxx.xxx
|
||||
SSH_KEY_STAGING=~/.ssh/your-staging-key
|
||||
SSH_KEY_PROD=~/.ssh/your-prod-key
|
||||
|
||||
# ECR (Elastic Container Registry)
|
||||
ECR_REPO_NAME=your-repo-name
|
||||
# Docker Configuration
|
||||
DOCKER_USERNAME=username
|
||||
DOCKER_REPO_PROD=your-prod-repo
|
||||
DOCKER_REPO_STAGING=your-staging-repo
|
||||
DOCKER_TOKEN=your_docker_token
|
||||
|
||||
# EC2 Deployment Hosts
|
||||
EC2_HOST_STAGING=ec2-user@your-staging-ip
|
||||
EC2_HOST_PROD=ec2-user@your-production-ip
|
||||
EC2_KEY=~/.ssh/your-key-file.pem
|
||||
|
||||
# Application Secrets
|
||||
ADMIN_TOKEN=your-admin-token
|
||||
# Admin credentials
|
||||
ADMIN_TOKEN=your_admin_token
|
||||
R2_ACCESS_KEY=your_r2_access_key
|
||||
R2_SECRET_KEY=your_r2_secret_key
|
||||
R2_ACCOUNT_ID=your_r2_account_id
|
||||
R2_PROD_BUCKET=your-prod-bucket
|
||||
R2_STAGING_BUCKET=your-staging-bucket
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
ownerdomain=openfront.io
|
||||
managerdomain=venatus.com
|
||||
managerdomain=adinplay.com
|
||||
#V 01.04.2025 VH
|
||||
#V
|
||||
|
||||
@@ -994,4 +994,6 @@ smartadserver.com, 3490, DIRECT
|
||||
|
||||
##################################
|
||||
# AdinPlay.com ads.txt - 2025-04-16
|
||||
##################################
|
||||
##################################
|
||||
|
||||
venatus.com, OFI, DIRECT
|
||||
@@ -120,7 +120,8 @@
|
||||
"pangaea": "Pangaea",
|
||||
"japan": "Japan and Neighbors",
|
||||
"betweentwoseas": "Between Two Seas",
|
||||
"knownworld": "Known World"
|
||||
"knownworld": "Known World",
|
||||
"faroeislands": "Faroe Islands"
|
||||
},
|
||||
"private_lobby": {
|
||||
"title": "Join Private Lobby",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "Faroe Islands",
|
||||
"width": 1600,
|
||||
"height": 2000,
|
||||
"nations": [
|
||||
{
|
||||
"coordinates": [920, 1780],
|
||||
"name": "Suduroy Region",
|
||||
"strength": 2,
|
||||
"flag": "fo"
|
||||
},
|
||||
{
|
||||
"coordinates": [880, 1070],
|
||||
"name": "Sandoy Region",
|
||||
"strength": 2,
|
||||
"flag": "fo"
|
||||
},
|
||||
{
|
||||
"coordinates": [480, 630],
|
||||
"name": "Vagar Region",
|
||||
"strength": 1,
|
||||
"flag": "fo"
|
||||
},
|
||||
{
|
||||
"coordinates": [735, 580],
|
||||
"name": "Streymoy Region",
|
||||
"strength": 2,
|
||||
"flag": "fo"
|
||||
},
|
||||
{
|
||||
"coordinates": [815, 375],
|
||||
"name": "Eysturoy Region",
|
||||
"strength": 2,
|
||||
"flag": "fo"
|
||||
},
|
||||
{
|
||||
"coordinates": [1115, 265],
|
||||
"name": "Nordoyar Region",
|
||||
"strength": 2,
|
||||
"flag": "fo"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 663 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
@@ -1,37 +1,80 @@
|
||||
#!/bin/bash
|
||||
# Comprehensive setup script for Hetzner server with Docker and Cloudflare R2 configuration
|
||||
|
||||
# Comprehensive setup script for Hetzner server with Docker and user setup
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
echo "====================================================="
|
||||
echo "🚀 STARTING SERVER SETUP"
|
||||
echo "====================================================="
|
||||
|
||||
echo "🔄 Updating system..."
|
||||
apt update && apt upgrade -y
|
||||
|
||||
echo "🐳 Installing Docker..."
|
||||
# Install Docker using official script
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sh get-docker.sh
|
||||
systemctl enable --now docker
|
||||
# Check if Docker is already installed
|
||||
if command -v docker &> /dev/null; then
|
||||
echo "Docker is already installed"
|
||||
else
|
||||
echo "🐳 Installing Docker..."
|
||||
# Install Docker using official script
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sh get-docker.sh
|
||||
systemctl enable --now docker
|
||||
echo "Docker installed successfully"
|
||||
fi
|
||||
|
||||
# Set up Docker Hub credentials
|
||||
echo "🔐 Setting up Docker Hub login..."
|
||||
echo "Enter your Docker Hub username:"
|
||||
read DOCKER_USERNAME
|
||||
echo "Enter your Docker Hub password/token:"
|
||||
read -s DOCKER_PASSWORD
|
||||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
||||
echo "✅ Docker Hub login configured"
|
||||
echo "👤 Setting up openfront user..."
|
||||
# Create openfront user if it doesn't exist
|
||||
if id "openfront" &>/dev/null; then
|
||||
echo "User openfront already exists"
|
||||
else
|
||||
useradd -m -s /bin/bash openfront
|
||||
echo "User openfront created"
|
||||
fi
|
||||
|
||||
echo "🔄 Installing Node Exporter..."
|
||||
# Check if openfront is already in docker group
|
||||
if groups openfront | grep -q '\bdocker\b'; then
|
||||
echo "User openfront is already in the docker group"
|
||||
else
|
||||
# Add openfront to docker group
|
||||
usermod -aG docker openfront
|
||||
echo "Added openfront to docker group"
|
||||
fi
|
||||
|
||||
docker run -d --name node-exporter --restart=unless-stopped \
|
||||
--net="host" \
|
||||
--pid="host" \
|
||||
-v "/:/host:ro,rslave" \
|
||||
prom/node-exporter:latest \
|
||||
--path.rootfs=/host
|
||||
# Create .ssh directory for openfront if it doesn't exist
|
||||
if [ ! -d "/home/openfront/.ssh" ]; then
|
||||
mkdir -p /home/openfront/.ssh
|
||||
chmod 700 /home/openfront/.ssh
|
||||
echo "Created .ssh directory for openfront"
|
||||
fi
|
||||
|
||||
echo "node-exporter installed"
|
||||
# Copy SSH keys from root if they exist and haven't been copied yet
|
||||
if [ -f /root/.ssh/authorized_keys ] && [ ! -f /home/openfront/.ssh/authorized_keys ]; then
|
||||
cp /root/.ssh/authorized_keys /home/openfront/.ssh/
|
||||
chmod 600 /home/openfront/.ssh/authorized_keys
|
||||
echo "SSH keys copied from root to openfront"
|
||||
fi
|
||||
|
||||
echo "🎉 Setup complete! You can find helpful Docker and R2 commands in ~/docker-commands.sh"
|
||||
echo "Test your R2 connection: aws s3 ls --profile r2"
|
||||
# Check if node-exporter container already exists
|
||||
if docker ps -a | grep -q "node-exporter"; then
|
||||
echo "Node Exporter is already installed"
|
||||
else
|
||||
echo "🔄 Installing Node Exporter..."
|
||||
docker run -d --name node-exporter --restart=unless-stopped \
|
||||
--net="host" \
|
||||
--pid="host" \
|
||||
-v "/:/host:ro,rslave" \
|
||||
prom/node-exporter:latest \
|
||||
--path.rootfs=/host
|
||||
echo "Node Exporter installed successfully"
|
||||
fi
|
||||
|
||||
# Set proper ownership for openfront's home directory
|
||||
chown -R openfront:openfront /home/openfront
|
||||
echo "Set proper ownership for openfront's home directory"
|
||||
|
||||
echo "====================================================="
|
||||
echo "🎉 SETUP COMPLETE!"
|
||||
echo "====================================================="
|
||||
echo "The openfront user has been set up and has Docker permissions."
|
||||
echo "You can now deploy using the openfront user."
|
||||
echo "====================================================="
|
||||
@@ -12,6 +12,7 @@ import { createGameRecord } from "../core/Util";
|
||||
import { ServerConfig } from "../core/configuration/Config";
|
||||
import { getConfig } from "../core/configuration/ConfigLoader";
|
||||
import { Team, UnitType } from "../core/game/Game";
|
||||
import { TileRef } from "../core/game/GameMap";
|
||||
import {
|
||||
ErrorUpdate,
|
||||
GameUpdateType,
|
||||
@@ -28,6 +29,7 @@ import { endGame, startGame, startTime } from "./LocalPersistantStats";
|
||||
import { getPersistentIDFromCookie } from "./Main";
|
||||
import {
|
||||
SendAttackIntentEvent,
|
||||
SendBoatAttackIntentEvent,
|
||||
SendHashEvent,
|
||||
SendSpawnIntentEvent,
|
||||
Transport,
|
||||
@@ -359,6 +361,18 @@ export class ClientGameRunner {
|
||||
this.myPlayer.troops() * this.renderer.uiState.attackRatio,
|
||||
),
|
||||
);
|
||||
} else if (
|
||||
actions.canBoat !== false &&
|
||||
this.shouldBoat(tile, actions.canBoat) &&
|
||||
this.gameView.isLand(tile)
|
||||
) {
|
||||
this.eventBus.emit(
|
||||
new SendBoatAttackIntentEvent(
|
||||
this.gameView.owner(tile).id(),
|
||||
cell,
|
||||
this.myPlayer.troops() * this.renderer.uiState.attackRatio,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
const owner = this.gameView.owner(tile);
|
||||
@@ -370,6 +384,18 @@ export class ClientGameRunner {
|
||||
});
|
||||
}
|
||||
|
||||
private shouldBoat(tile: TileRef, src: TileRef) {
|
||||
// TODO: Global enable flag
|
||||
// TODO: Global limit autoboat to nearby shore flag
|
||||
// if (!enableAutoBoat) return false;
|
||||
// if (!limitAutoBoatNear) return true;
|
||||
const distanceSquared = this.gameView.euclideanDistSquared(tile, src);
|
||||
const limit = 100;
|
||||
const limitSquared = limit * limit;
|
||||
if (distanceSquared > limitSquared) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private onMouseMove(event: MouseMoveEvent) {
|
||||
this.lastMousePosition = { x: event.x, y: event.y };
|
||||
this.checkTileUnderCursor();
|
||||
|
||||
@@ -23,6 +23,7 @@ export const MapDescription: Record<keyof typeof GameMapType, string> = {
|
||||
Japan: "Japan",
|
||||
BetweenTwoSeas: "Between Two Seas",
|
||||
KnownWorld: "Known World",
|
||||
FaroeIslands: "Faroe Islands",
|
||||
};
|
||||
|
||||
@customElement("map-display")
|
||||
|
||||
@@ -145,8 +145,14 @@ export class PlayerPanel extends LitElement implements Layer {
|
||||
this.eventBus.on(MouseUpEvent, (e: MouseEvent) => this.hide());
|
||||
}
|
||||
|
||||
tick() {
|
||||
this.requestUpdate();
|
||||
async tick() {
|
||||
if (this.isVisible && this.tile) {
|
||||
const myPlayer = this.g.myPlayer();
|
||||
if (myPlayer !== null && myPlayer.isAlive()) {
|
||||
this.actions = await myPlayer.actions(this.tile);
|
||||
this.requestUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getTotalNukesSent(otherId: PlayerID): number {
|
||||
|
||||
@@ -8,7 +8,7 @@ import swordIcon from "../../../../resources/images/SwordIconWhite.svg";
|
||||
import traitorIcon from "../../../../resources/images/TraitorIconWhite.svg";
|
||||
import { consolex } from "../../../core/Consolex";
|
||||
import { EventBus } from "../../../core/EventBus";
|
||||
import { Cell, PlayerActions } from "../../../core/game/Game";
|
||||
import { Cell, PlayerActions, TerraNullius } from "../../../core/game/Game";
|
||||
import { TileRef } from "../../../core/game/GameMap";
|
||||
import { GameView, PlayerView } from "../../../core/game/GameView";
|
||||
import { ClientID } from "../../../core/Schemas";
|
||||
@@ -44,6 +44,7 @@ export class RadialMenu implements Layer {
|
||||
private clickedCell: Cell | null = null;
|
||||
private lastClosed: number = 0;
|
||||
|
||||
private originalTileOwner: PlayerView | TerraNullius;
|
||||
private menuElement: d3.Selection<HTMLDivElement, unknown, null, undefined>;
|
||||
private isVisible: boolean = false;
|
||||
private readonly menuItems = new Map([
|
||||
@@ -267,8 +268,26 @@ export class RadialMenu implements Layer {
|
||||
.style("pointer-events", "none");
|
||||
}
|
||||
|
||||
tick() {
|
||||
// Update logic if needed
|
||||
async tick() {
|
||||
// Only update when menu is visible
|
||||
if (!this.isVisible || this.clickedCell === null) return;
|
||||
const myPlayer = this.g.myPlayer();
|
||||
if (myPlayer === null || !myPlayer.isAlive()) return;
|
||||
const tile = this.g.ref(this.clickedCell.x, this.clickedCell.y);
|
||||
if (this.originalTileOwner.isPlayer()) {
|
||||
if (this.g.owner(tile) != this.originalTileOwner) {
|
||||
this.closeMenu();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (this.g.owner(tile).isPlayer() || this.g.owner(tile) == myPlayer) {
|
||||
this.closeMenu();
|
||||
return;
|
||||
}
|
||||
}
|
||||
const actions = await myPlayer.actions(tile);
|
||||
this.disableAllButtons();
|
||||
this.handlePlayerActions(myPlayer, actions, tile);
|
||||
}
|
||||
|
||||
renderLayer(context: CanvasRenderingContext2D) {
|
||||
@@ -291,12 +310,7 @@ export class RadialMenu implements Layer {
|
||||
} else {
|
||||
this.showRadialMenu(event.x, event.y);
|
||||
}
|
||||
this.enableCenterButton(false);
|
||||
for (const item of this.menuItems.values()) {
|
||||
item.disabled = true;
|
||||
this.updateMenuItemState(item);
|
||||
}
|
||||
|
||||
this.disableAllButtons();
|
||||
this.clickedCell = this.transformHandler.screenToWorldCoordinates(
|
||||
event.x,
|
||||
event.y,
|
||||
@@ -305,7 +319,7 @@ export class RadialMenu implements Layer {
|
||||
return;
|
||||
}
|
||||
const tile = this.g.ref(this.clickedCell.x, this.clickedCell.y);
|
||||
|
||||
this.originalTileOwner = this.g.owner(tile);
|
||||
if (this.g.inSpawnPhase()) {
|
||||
if (this.g.isLand(tile) && !this.g.hasOwner(tile)) {
|
||||
this.enableCenterButton(true);
|
||||
@@ -313,10 +327,8 @@ export class RadialMenu implements Layer {
|
||||
return;
|
||||
}
|
||||
|
||||
const myPlayer = this.g
|
||||
.playerViews()
|
||||
.find((p) => p.clientID() == this.clientID);
|
||||
if (!myPlayer) {
|
||||
const myPlayer = this.g.myPlayer();
|
||||
if (myPlayer === null) {
|
||||
consolex.warn("my player not found");
|
||||
return;
|
||||
}
|
||||
@@ -430,6 +442,14 @@ export class RadialMenu implements Layer {
|
||||
this.hideRadialMenu();
|
||||
}
|
||||
|
||||
private disableAllButtons() {
|
||||
this.enableCenterButton(false);
|
||||
for (const item of this.menuItems.values()) {
|
||||
item.disabled = true;
|
||||
this.updateMenuItemState(item);
|
||||
}
|
||||
}
|
||||
|
||||
private activateMenuElement(
|
||||
slot: Slot,
|
||||
color: string,
|
||||
|
||||
@@ -5,6 +5,7 @@ import betweenTwoSeas from "../../../resources/maps/BetweenTwoSeasThumb.webp";
|
||||
import blackSea from "../../../resources/maps/BlackSeaThumb.webp";
|
||||
import britannia from "../../../resources/maps/BritanniaThumb.webp";
|
||||
import europe from "../../../resources/maps/EuropeThumb.webp";
|
||||
import faroeislands from "../../../resources/maps/FaroeIslandsThumb.webp";
|
||||
import gatewayToTheAtlantic from "../../../resources/maps/GatewayToTheAtlanticThumb.webp";
|
||||
import iceland from "../../../resources/maps/IcelandThumb.webp";
|
||||
import japan from "../../../resources/maps/JapanThumb.webp";
|
||||
@@ -57,6 +58,8 @@ export function getMapsImage(map: GameMapType): string {
|
||||
return betweenTwoSeas;
|
||||
case GameMapType.KnownWorld:
|
||||
return knownworld;
|
||||
case GameMapType.FaroeIslands:
|
||||
return faroeislands;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export abstract class DefaultServerConfig implements ServerConfig {
|
||||
return process.env.GIT_COMMIT;
|
||||
}
|
||||
r2Endpoint(): string {
|
||||
return process.env.R2_ENDPOINT;
|
||||
return `https://${process.env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com`;
|
||||
}
|
||||
r2AccessKey(): string {
|
||||
return process.env.R2_ACCESS_KEY;
|
||||
@@ -89,6 +89,7 @@ export abstract class DefaultServerConfig implements ServerConfig {
|
||||
GameMapType.Mars,
|
||||
GameMapType.Oceania,
|
||||
GameMapType.Japan, // Japan at this level because its 2/3 water
|
||||
GameMapType.FaroeIslands,
|
||||
].includes(map)
|
||||
) {
|
||||
return Math.random() < 0.2 ? 70 : 40;
|
||||
|
||||
@@ -67,6 +67,7 @@ export enum GameMapType {
|
||||
Japan = "Japan",
|
||||
BetweenTwoSeas = "Between Two Seas",
|
||||
KnownWorld = "Known World",
|
||||
FaroeIslands = "FaroeIslands",
|
||||
}
|
||||
|
||||
export enum GameType {
|
||||
@@ -416,7 +417,7 @@ export interface Player {
|
||||
// Misc
|
||||
toUpdate(): PlayerUpdate;
|
||||
playerProfile(): PlayerProfile;
|
||||
canBoat(tile: TileRef): boolean;
|
||||
canBoat(tile: TileRef): TileRef | false;
|
||||
tradingPorts(port: Unit): Unit[];
|
||||
}
|
||||
|
||||
@@ -474,7 +475,7 @@ export interface Game extends GameMap {
|
||||
}
|
||||
|
||||
export interface PlayerActions {
|
||||
canBoat: boolean;
|
||||
canBoat: TileRef | false;
|
||||
canAttack: boolean;
|
||||
buildableUnits: BuildableUnit[];
|
||||
canSendEmojiAllPlayers: boolean;
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
Attack,
|
||||
Cell,
|
||||
EmojiMessage,
|
||||
GameMode,
|
||||
Gold,
|
||||
MessageType,
|
||||
MutableAlliance,
|
||||
@@ -518,6 +519,13 @@ export class PlayerImpl implements Player {
|
||||
}
|
||||
|
||||
canDonate(recipient: Player): boolean {
|
||||
if (
|
||||
recipient.type() == PlayerType.Human &&
|
||||
this.mg.config().gameConfig().gameMode == GameMode.FFA
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.isFriendly(recipient)) {
|
||||
return false;
|
||||
}
|
||||
@@ -543,7 +551,7 @@ export class PlayerImpl implements Player {
|
||||
this.id(),
|
||||
);
|
||||
this.mg.displayMessage(
|
||||
`Recieved ${renderTroops(troops)} troops from ${this.name()}`,
|
||||
`Received ${renderTroops(troops)} troops from ${this.name()}`,
|
||||
MessageType.SUCCESS,
|
||||
recipient.id(),
|
||||
);
|
||||
@@ -557,7 +565,7 @@ export class PlayerImpl implements Player {
|
||||
this.id(),
|
||||
);
|
||||
this.mg.displayMessage(
|
||||
`Recieved ${renderNumber(gold)} gold from ${this.name()}`,
|
||||
`Received ${renderNumber(gold)} gold from ${this.name()}`,
|
||||
MessageType.SUCCESS,
|
||||
recipient.id(),
|
||||
);
|
||||
@@ -886,7 +894,7 @@ export class PlayerImpl implements Player {
|
||||
return rel;
|
||||
}
|
||||
|
||||
public canBoat(tile: TileRef): boolean {
|
||||
public canBoat(tile: TileRef): TileRef | false {
|
||||
if (
|
||||
this.units(UnitType.TransportShip).length >=
|
||||
this.mg.config().boatMaxNumber()
|
||||
@@ -929,7 +937,7 @@ export class PlayerImpl implements Player {
|
||||
}
|
||||
|
||||
if (myPlayerBordersOcean && otherPlayerBordersOcean) {
|
||||
return this.canBuild(UnitType.TransportShip, dst) != false;
|
||||
return this.canBuild(UnitType.TransportShip, dst);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -952,7 +960,7 @@ export class PlayerImpl implements Player {
|
||||
|
||||
for (const t of sorted) {
|
||||
if (this.mg.owner(t) == this) {
|
||||
return this.canBuild(UnitType.TransportShip, dst) != false;
|
||||
return this.canBuild(UnitType.TransportShip, dst);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -41,6 +41,7 @@ const MAP_FILE_NAMES: Record<GameMapType, string> = {
|
||||
[GameMapType.Japan]: "Japan",
|
||||
[GameMapType.BetweenTwoSeas]: "BetweenTwoSeas",
|
||||
[GameMapType.KnownWorld]: "KnownWorld",
|
||||
[GameMapType.FaroeIslands]: "FaroeIslands",
|
||||
};
|
||||
|
||||
class GameMapLoader {
|
||||
|
||||
@@ -22,6 +22,7 @@ const maps = [
|
||||
"BetweenTwoSeas",
|
||||
"Japan",
|
||||
"KnownWorld",
|
||||
"FaroeIslands",
|
||||
];
|
||||
|
||||
const removeSmall = true;
|
||||
|
||||
@@ -101,6 +101,7 @@ export class MapPlaylist {
|
||||
BetweenTwoSeas: 3,
|
||||
Japan: 3,
|
||||
BlackSea: 1,
|
||||
FaroeIslands: 2,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,13 @@ echo "Container name: ${CONTAINER_NAME}"
|
||||
echo "Docker image: ${FULL_IMAGE_NAME}"
|
||||
|
||||
# Load environment variables if .env exists
|
||||
if [ -f /root/.env ]; then
|
||||
if [ -f /home/openfront/.env ]; then
|
||||
echo "Loading environment variables from .env file..."
|
||||
export $(grep -v '^#' /root/.env | xargs)
|
||||
export $(grep -v '^#' /home/openfront/.env | xargs)
|
||||
fi
|
||||
|
||||
docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN
|
||||
|
||||
# Install Loki Docker plugin if not already installed
|
||||
if ! docker plugin ls | grep -q "loki"; then
|
||||
echo "Installing Loki Docker plugin..."
|
||||
@@ -99,7 +101,7 @@ docker run -d -p 80:80 -p 127.0.0.1:9090:9090 \
|
||||
--log-opt loki-external-labels="job=docker,environment=${ENV},host=${REGION},region=${REGION}" \
|
||||
--env GAME_ENV=${ENV} \
|
||||
--env REGION=${REGION} \
|
||||
--env-file /root/.env \
|
||||
--env-file /home/openfront/.env \
|
||||
--name ${CONTAINER_NAME} \
|
||||
$FULL_IMAGE_NAME
|
||||
|
||||
|
||||
Reference in New Issue
Block a user