Skip to content

Commit

Permalink
Prevent grid size & beat divisor from being synced during multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Schürz committed Jan 17, 2025
1 parent e86b04f commit 00bd685
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
22 changes: 8 additions & 14 deletions packages/core/src/beatmap/BeatmapInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { SharedStructure } from '@osucad/multiplayer';
import { BindableNumber } from '@osucad/framework';
import { SharedObject } from '@osucad/multiplayer';
import { BindableBeatDivisor } from '../editor/BindableBeatDivisor';
import { RulesetInfo } from '../rulesets/RulesetInfo';
import { BeatmapDifficultyInfo } from './BeatmapDifficultyInfo';
import { BeatmapMetadata } from './BeatmapMetadata';
Expand Down Expand Up @@ -149,32 +151,24 @@ export class BeatmapInfo extends SharedObject {
this.#distanceSpacing.value = value;
}

readonly #beatDivisor = this.property('beatDivisor', 4);

get beatDivisorBindable() {
return this.#beatDivisor.bindable;
}
readonly beatDivisorBindable = new BindableBeatDivisor(4);

get beatDivisor() {
return this.#beatDivisor.value;
return this.beatDivisorBindable.value;
}

set beatDivisor(value) {
this.#beatDivisor.value = value;
this.beatDivisorBindable.value = value;
}

readonly #gridSize = this.property('gridSize', 0);

get gridSizeBindable() {
return this.#gridSize.bindable;
}
readonly gridSizeBindable = new BindableNumber(0);

get gridSize() {
return this.#gridSize.value;
return this.gridSizeBindable.value;
}

set gridSize(value) {
this.#gridSize.value = value;
this.gridSizeBindable.value = value;
}

readonly #timelineZoom = this.property('timelineZoom', 1);
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/editor/BindableBeatDivisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { OsucadColors } from '../OsucadColors';
export class BindableBeatDivisor extends BindableNumber {
constructor(value: number = 1) {
super(value);

this.minValue = 1;
this.maxValue = 16;
this.precision = 1;
}

static readonly PREDEFINED_DIVISORS = [1, 2, 3, 4, 6, 8, 12, 16];
Expand Down

0 comments on commit 00bd685

Please sign in to comment.