Skip to content

Commit 9470b80

Browse files
committed
fix: lobby button updating
1 parent 210fdf9 commit 9470b80

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

src/client/components/teleport-portal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export class TeleportPortal extends DestroyableComponent<Attributes, PortalModel
5353
root.CFrame = destinationPart.CFrame.add(new Vector3(0, 6, 0));
5454
humanoid.WalkSpeed = defaultWalkSpeed;
5555

56-
this.checkpoints.setInLobby(false, true);
56+
this.checkpoints.notLobbyNotObby = true;
57+
this.checkpoints.updateInLobby();
5758
if (this.instance.HasTag("PvPPortal")) {
5859
Events.tools.addItemToBackpack("PvPSword", "ExtraItems", true);
5960
let lobbyUpdateDebounce = false;

src/client/components/ui/lobby-button.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ export class LobbyButton extends BaseComponent<{}, ImageButton & { Icon: ImageLa
3232
}
3333

3434
private updateIcon(inLobby: boolean): void {
35-
this.instance.Icon.Image = inLobby ? this.obbyIcon : this.lobbyIcon;
35+
this.instance.Icon.Image = inLobby && !this.checkpoints.notLobbyNotObby ? this.obbyIcon : this.lobbyIcon;
3636
}
3737
}

src/client/controllers/checkpoints.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ const STAGE_ARROW_COOLDOWN = 0.1;
2121
@Controller({ loadOrder: 2 })
2222
export class CheckpointsController implements OnInit, OnDataUpdate, LogStart {
2323
public readonly offsetUpdated = new Signal<(newStage: number) => void>;
24-
public readonly inLobbyUpdated = new Signal<(inLobby: boolean, onlyUpdateButton: boolean) => void>;
24+
public readonly inLobbyUpdated = new Signal<(inLobby: boolean) => void>;
2525
public inLobby = true;
26+
public notLobbyNotObby = false;
2627
public stage = 0;
2728

2829
private stageOffset = 0;
@@ -110,15 +111,16 @@ export class CheckpointsController implements OnInit, OnDataUpdate, LogStart {
110111
return clamp(this.stage + this.stageOffset, 0, TOTAL_STAGE_COUNT + 1);
111112
}
112113

113-
public setInLobby(inLobby: boolean, onlyUpdateButton?: boolean): void {
114-
if (!onlyUpdateButton)
115-
this.inLobby = inLobby;
114+
public setInLobby(inLobby: boolean): void {
115+
if (inLobby)
116+
this.notLobbyNotObby = false;
116117

117-
this.updateInLobby(onlyUpdateButton, onlyUpdateButton ? inLobby : undefined);
118+
this.inLobby = inLobby;
119+
this.updateInLobby();
118120
}
119121

120-
private updateInLobby(onlyUpdateButton = false, overrideInLobby?: boolean): void {
121-
this.inLobbyUpdated.Fire(overrideInLobby ?? this.inLobby, onlyUpdateButton);
122+
public updateInLobby(): void {
123+
this.inLobbyUpdated.Fire(this.inLobby);
122124
}
123125

124126
private update(advancing = false): void {

src/client/controllers/lobby-music.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export class LobbyMusicController implements OnInit, LogStart {
1818
) { }
1919

2020
public onInit(): void {
21-
this.checkpoints.inLobbyUpdated.Connect((inLobby, onlyUpdateButton) => {
22-
if (onlyUpdateButton) return;
21+
this.checkpoints.inLobbyUpdated.Connect(inLobby => {
22+
if (this.checkpoints.notLobbyNotObby) return;
2323
if (inLobby) {
2424
if (!this.currentSong?.IsPlaying)
2525
this.playCurrentSong();

src/client/controllers/lobby.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export class LobbyController implements OnInit, OnCharacterAdd {
1919
) { }
2020

2121
public onInit(): void {
22-
this.checkpoints.inLobbyUpdated.Connect(async (inLobby, onlyUpdateButton) => {
23-
if (onlyUpdateButton) return;
22+
this.checkpoints.inLobbyUpdated.Connect(async inLobby => {
23+
if (this.checkpoints.notLobbyNotObby) return;
2424
const zoneName = <TextLabel>PlayerGui.WaitForChild("Main").WaitForChild("Main").WaitForChild("StageInfo").WaitForChild("ZoneName")
2525
const zoneMusicEnabled = await this.settings.get<boolean>("music");
2626
zoneName.Visible = !inLobby;

0 commit comments

Comments
 (0)