mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:30:43 +00:00
Fix random spawn (#2958)
## Description: "You can pick your spawn in random spawn games in v29. You need to open the menu and click on the attack button. That's it." Thats the fix for this problem. Radial menu no longer allows to attack (pick a spawn) while random spawn is enabled. And SpawnExecution got a check so you cannot send malicious intents. ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin
This commit is contained in:
@@ -572,6 +572,9 @@ export const centerButtonElement: CenterButtonElement = {
|
||||
return true;
|
||||
}
|
||||
if (params.game.inSpawnPhase()) {
|
||||
if (params.game.config().isRandomSpawn()) {
|
||||
return true;
|
||||
}
|
||||
if (tileOwner.isPlayer()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ export class SpawnExecution implements Execution {
|
||||
player = this.mg.addPlayer(this.playerInfo);
|
||||
}
|
||||
|
||||
// Security: If random spawn is enabled, prevent players from re-rolling their spawn location
|
||||
if (this.mg.config().isRandomSpawn() && player.hasSpawned()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.tile ??= this.randomSpawnLand();
|
||||
|
||||
if (this.tile === undefined) {
|
||||
|
||||
Reference in New Issue
Block a user