Skip to content

Commit 302c24b

Browse files
committed
Default individual fight commands to starting the game
1 parent 7cd97cb commit 302c24b

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

javascript/features/fights/fight_registry.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export class FightRegistry {
3535
// Gets a particular location by the given |name|. Returns NULL when it's invalid.
3636
getLocation(name) { return this.#locations_.get(name) ?? null; }
3737

38+
// Gets the known locations that are defined to be visible for the "/match" command.
39+
getVisibleLocations() { return this.#locations_.keys(); }
40+
3841
// ---------------------------------------------------------------------------------------------
3942

4043
// Initializes the full fight system from the files the data is defined in. Will be called by
@@ -107,6 +110,10 @@ export class FightRegistry {
107110
case 'watch':
108111
params.type = GameCommandParams.kTypeWatch;
109112
break;
113+
114+
default:
115+
params.type = GameCommandParams.kTypeStart;
116+
break;
110117
}
111118

112119
params.registrationId = registrationId;

javascript/features/fights/fights.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export default class Fights extends Feature {
6161

6262
// Option: Location (string)
6363
new Setting(
64-
'fights', 'location', [ ...this.registry_.locations.keys() ], defaultLocation,
65-
'Location'),
64+
'fights', 'location', [ ...this.registry_.getVisibleLocations() ],
65+
defaultLocation, 'Location'),
6666

6767
// Option: Pickups (boolean)
6868
new Setting('fights', 'pickups', Setting.TYPE_BOOLEAN, true, 'Pickups'),

javascript/features/games/game_command_params.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export class GameCommandParams {
99
// Types of commands that can be encapsulated by this object.
1010
static kTypeDefault = 0;
1111
static kTypeCustomise = 1;
12-
static kTypeWatch = 2;
12+
static kTypeStart = 2;
13+
static kTypeWatch = 3;
1314

1415
// The type of command that is being executed. Must be one of the above constants.
1516
type = GameCommandParams.kTypeDefault;

javascript/features/games/game_commands.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ export class GameCommands {
349349
// If the customise flag has not been set, return the |settings| immediately as we're done
350350
// unless the game prefers customisable versions.
351351
if (params.type !== GameCommandParams.kTypeCustomise) {
352+
if (params.type === GameCommandParams.kTypeStart)
353+
return settings; // force-start when the params tell us to
354+
352355
const registrations = this.manager_.getPendingGameRegistrations(description);
353356
const publicRegistrations = registrations.filter(registration =>
354357
registration.type === GameRegistration.kTypePublic);

0 commit comments

Comments
 (0)