Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "CreateNewGame" to "GameIsFull" #328

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added client/public/audio/sfx/join_notification.mp3
Binary file not shown.
101 changes: 46 additions & 55 deletions client/public/img/game/obstacles/life_preserver.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions client/src/scripts/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@
// reload the page with a time stamp to try clearing cache
location.search = `t=${Date.now()}`;
}

// Sound which notifies the player that the game started if page
// is out of focus.
document.hasFocus() || this.soundManager.play('join_notification');

Check warning on line 395 in client/src/scripts/game.ts

View workflow job for this annotation

GitHub Actions / Lint

Strings must use doublequote

Check warning on line 395 in client/src/scripts/game.ts

View workflow job for this annotation

GitHub Actions / Lint

Strings must use doublequote

this.uiManager.emotes = packet.emotes;
this.uiManager.updateEmoteWheel();

Expand Down
4 changes: 3 additions & 1 deletion client/src/scripts/managers/soundManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ export class SoundManager {
puzzle_error: "audio/sfx/puzzle_error",
puzzle_solved: "audio/sfx/puzzle_solved",

bleed: "audio/sfx/bleed"
bleed: "audio/sfx/bleed",

join_notification: "audio/sfx/join_notification"
};

for (const material of Materials) {
Expand Down
4 changes: 4 additions & 0 deletions client/src/scripts/rendering/minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@ export class Minimap {
$("#btn-close-minimap").show();
$("#ui-kill-leader").hide();
$("#center-bottom-container").hide();
$("#kill-feed").hide();

$("#kill-counter").show();
this.resize();
}
Expand All @@ -594,6 +596,8 @@ export class Minimap {
$("#center-bottom-container").show();
$("#gas-msg-info").show();
$("#scopes-container").show();
$("#kill-feed").show();

if (this.game.spectating) $("#spectating-container").show();
const width = $(window).width();
if (width && width > 1200) $("#ui-kill-leader").show();
Expand Down
47 changes: 34 additions & 13 deletions client/src/scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
updateServerSelectors();

// eslint-disable-next-line @typescript-eslint/no-misused-promises
serverList.children("li.server-list-item").on("click", async function(this: HTMLLIElement) {
serverList.children("li.server-list-item").on("click", async function (this: HTMLLIElement) {

Check failure on line 210 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses

Check failure on line 210 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses
const region = this.getAttribute("data-region");

if (region === null) return;
Expand Down Expand Up @@ -312,7 +312,7 @@
});

const createTeamMenu = $("#create-team-menu");
$("#btn-create-team, #btn-join-team").on("click", function() {
$("#btn-create-team, #btn-join-team").on("click", function () {

Check failure on line 315 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses

Check failure on line 315 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses
const now = Date.now();
if (now - lastPlayButtonClickTime < 1500 || teamSocket) return;
lastPlayButtonClickTime = now;
Expand Down Expand Up @@ -438,6 +438,13 @@
$("#splash-server-message").show();
resetPlayButtons();
createTeamMenu.fadeOut(250);

// ---------------------------------------------------------
// Dimmed backdrop on team menu. (Probably not needed here)
// ---------------------------------------------------------
$("#splash-ui").css("filter", "");
$("#splash-ui").css("pointer-events", "");
// ---------------------------------------------------------
};

teamSocket.onclose = (): void => {
Expand All @@ -457,9 +464,23 @@
joinedTeam = false;
window.location.hash = "";
createTeamMenu.fadeOut(250);

// ----------------------------------------------
// Dimmed Backdrop on team menu.
// ----------------------------------------------
$("#splash-ui").css("filter", "");
$("#splash-ui").css("pointer-events", "");
// ----------------------------------------------
};

createTeamMenu.fadeIn(250);

// ----------------------------------------------
// Dimmed Backdrop on team menu.
// ----------------------------------------------
$("#splash-ui").css("filter", "brightness(0.6)");
$("#splash-ui").css("pointer-events", "none");
// ----------------------------------------------
});

$("#close-create-team").on("click", () => {
Expand Down Expand Up @@ -500,15 +521,15 @@
.css("color", "#FFFFFF00");
});

$("#create-team-toggle-auto-fill").on("click", function() {
$("#create-team-toggle-auto-fill").on("click", function () {

Check failure on line 524 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses

Check failure on line 524 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses
autoFill = $(this).prop("checked");
teamSocket?.send(JSON.stringify({
type: CustomTeamMessages.Settings,
autoFill
}));
});

$("#create-team-toggle-lock").on("click", function() {
$("#create-team-toggle-lock").on("click", function () {

Check failure on line 532 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses

Check failure on line 532 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses
teamSocket?.send(JSON.stringify({
type: CustomTeamMessages.Settings,
locked: $(this).prop("checked")
Expand Down Expand Up @@ -664,7 +685,7 @@
void game.endGame();
});
// eslint-disable-next-line @typescript-eslint/no-misused-promises
$("#btn-play-again, #btn-spectate-replay").on("click", async() => {
$("#btn-play-again, #btn-spectate-replay").on("click", async () => {

Check failure on line 688 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses

Check failure on line 688 in client/src/scripts/ui.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected space before function parentheses
await game.endGame();
if (teamSocket) teamSocket.send(JSON.stringify({ type: CustomTeamMessages.Start })); // TODO Check if player is team leader
else joinGame();
Expand Down Expand Up @@ -775,7 +796,7 @@
</div>
<span class="skin-name">${skin.name}</span>
</div>`);
skinItem.on("click", function() {
skinItem.on("click", function () {
game.console.setBuiltInCVar("cv_loadout_skin", skin.idString);
$(this).addClass("selected").siblings().removeClass("selected");
updateSplashCustomize(skin.idString);
Expand All @@ -801,7 +822,7 @@
<span class="emote-name">${emote.name}</span>
</div>`);

emoteItem.on("click", function() {
emoteItem.on("click", function () {
if (selectedEmoteSlot === undefined) return;
game.console.setBuiltInCVar(`cv_loadout_${selectedEmoteSlot}_emote`, emote.idString);

Expand Down Expand Up @@ -903,7 +924,7 @@
"background-repeat": "no-repeat"
});

crosshairItem.on("click", function() {
crosshairItem.on("click", function () {
game.console.setBuiltInCVar("cv_loadout_crosshair", crosshairIndex);
loadCrosshair();
$(this).addClass("selected").siblings().removeClass("selected");
Expand Down Expand Up @@ -954,7 +975,7 @@
</div>`
);

noBadgeItem.on("click", function() {
noBadgeItem.on("click", function () {
game.console.setBuiltInCVar("cv_loadout_badge", "");
$(this).addClass("selected").siblings().removeClass("selected");
});
Expand All @@ -971,7 +992,7 @@
</div>`
);

badgeItem.on("click", function() {
badgeItem.on("click", function () {
game.console.setBuiltInCVar("cv_loadout_badge", badge.idString);
$(this).addClass("selected").siblings().removeClass("selected");
});
Expand Down Expand Up @@ -1182,7 +1203,7 @@
});
renderSelect.value = game.console.getBuiltInCVar("cv_renderer");

void (async() => {
void (async () => {
$("#webgpu-option").toggle(await isWebGPUSupported());
})();

Expand Down Expand Up @@ -1549,7 +1570,7 @@

$("#btn-toggle-ping")
.show()
.on("click", function() {
.on("click", function () {
game.inputManager.pingWheelActive = !game.inputManager.pingWheelActive;
const { pingWheelActive } = game.inputManager;
$(this)
Expand Down Expand Up @@ -1609,7 +1630,7 @@
tabContent.show();
});

$("#warning-modal-agree-checkbox").on("click", function() {
$("#warning-modal-agree-checkbox").on("click", function () {
$("#warning-btn-play-solo, #btn-play-solo").toggleClass("btn-disabled", !$(this).prop("checked"));
});

Expand Down
2 changes: 1 addition & 1 deletion server/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ export class Game {
this.gas.advanceGasStage();

this.addTimeout(() => {
parentPort?.postMessage({ type: WorkerMessages.CreateNewGame });
parentPort?.postMessage({ type: WorkerMessages.GameIsFull });
Logger.log(`Game ${this.id} | Preventing new players from joining`);
this.setGameData({ allowJoin: false });
}, Config.preventJoinAfter);
Expand Down
6 changes: 3 additions & 3 deletions server/src/gameManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class GameContainer {
}
break;
}
case WorkerMessages.CreateNewGame: {
case WorkerMessages.GameIsFull: {
newGame();
break;
}
Expand Down Expand Up @@ -73,7 +73,7 @@ export enum WorkerMessages {
AllowIP,
IPAllowed,
UpdateGameData,
CreateNewGame
GameIsFull
}

export type WorkerMessage =
Expand All @@ -86,7 +86,7 @@ export type WorkerMessage =
data: Partial<GameData>
} |
{
type: WorkerMessages.CreateNewGame
type: WorkerMessages.GameIsFull
};

export interface GameData {
Expand Down
Loading