NukeWars: enable transport ships within team zones but prevent crossing midpoint

This commit is contained in:
Restart2008
2025-10-24 21:35:05 -07:00
parent 6f44b0539b
commit fd1081d392
2 changed files with 25 additions and 6 deletions
@@ -1,6 +1,8 @@
import {
Execution,
Game,
GameMapType,
GameMode,
MessageType,
Player,
PlayerID,
@@ -103,6 +105,27 @@ export class TransportShipExecution implements Execution {
return;
}
// In Nuke Wars on Baikal, prevent transport ships from crossing the midpoint
const gc = this.mg.config().gameConfig();
if (
gc.gameMode === GameMode.NukeWars &&
gc.gameMap === GameMapType.Baikal
) {
const mapWidth = this.mg.width();
const wantLeft = this.attacker.smallID() % 2 === 1;
const dstX = this.mg.x(this.dst);
const dstLeft = dstX < Math.floor(mapWidth / 2);
if (wantLeft !== dstLeft) {
this.mg.displayMessage(
"Transport ships cannot cross the midpoint in Nuke Wars",
MessageType.ATTACK_FAILED,
this.attacker.id(),
);
this.active = false;
return;
}
}
const closestTileSrc = this.attacker.canBuild(
UnitType.TransportShip,
this.dst,
+2 -6
View File
@@ -930,17 +930,13 @@ export class PlayerImpl implements Player {
return false;
}
// Prevent crossing midpoint with ships/boats at any time in Nuke Wars.
// In Nuke Wars on Baikal, prevent ships from crossing the midpoint but allow them within team zones
const gc = this.mg.config().gameConfig();
if (
gc.gameMode === GameMode.NukeWars &&
gc.gameMap === GameMapType.Baikal
) {
if (
unitType === UnitType.TransportShip ||
unitType === UnitType.Warship ||
unitType === UnitType.TradeShip
) {
if (unitType === UnitType.Warship || unitType === UnitType.TradeShip) {
if (!this.isInTeamSpawnZone(targetTile)) return false;
}