Skip to content

Commit 2a9eb0d

Browse files
safety
1 parent a2f5668 commit 2a9eb0d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/Gamemodes/Domination.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ export default class DominationArena extends ArenaEntity {
9292

9393
public spawnPlayer(tank: TankBody, client: Client) {
9494
const team = this.decideTeam(client);
95-
const teamBase = team.base as TeamBase;
9695
TeamEntity.setTeam(team, tank);
9796

97+
const teamBase = team.base;
98+
if (!teamBase) return super.spawnPlayer(tank, client);
99+
98100
const pos = ObjectEntity.getRandomPosition(teamBase);
99101
tank.positionData.values.x = pos.x;
100102
tank.positionData.values.y = pos.y;

src/Gamemodes/Team2.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export default class Teams2Arena extends ArenaEntity {
6969
const success = this.attemptFactorySpawn(tank);
7070
if (success) return; // This player was spawned from a factory instead
7171

72-
const base = team.base as TeamBase;
72+
const base = team.base;
73+
if (!base) return super.spawnPlayer(tank, client);
74+
7375
const pos = ObjectEntity.getRandomPosition(base);
7476
tank.positionData.x = pos.x;
7577
tank.positionData.y = pos.y;

src/Gamemodes/Team4.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ export default class Teams4Arena extends ArenaEntity {
7979
const success = this.attemptFactorySpawn(tank);
8080
if (success) return; // This player was spawned from a factory instead
8181

82-
const base = team.base as TeamBase;
82+
const base = team.base;
83+
if (!base) return super.spawnPlayer(tank, client);
84+
8385
const pos = ObjectEntity.getRandomPosition(base);
8486
tank.positionData.x = pos.x;
8587
tank.positionData.y = pos.y;

0 commit comments

Comments
 (0)