sync changes with master

This commit is contained in:
Ayush Saini 2022-06-30 00:31:52 +05:30
parent 03034e4aa0
commit de0199ad50
178 changed files with 2191 additions and 1481 deletions

View file

@ -5,7 +5,7 @@ from __future__ import annotations
from enum import Enum
from dataclasses import field, dataclass
from typing import TYPE_CHECKING, Optional, Any
from typing import TYPE_CHECKING, Any
from efro.dataclassio import ioprepped
@ -60,11 +60,11 @@ class ServerConfig:
# playlist editor in the regular version of the game.
# This will give you a numeric code you can enter here to host that
# playlist.
playlist_code: Optional[int] = None
playlist_code: int | None = None
# Alternately, you can embed playlist data here instead of using codes.
# Make sure to set session_type to the correct type for the data here.
playlist_inline: Optional[list[dict[str, Any]]] = None
playlist_inline: list[dict[str, Any]] | None = None
# Whether to shuffle the playlist or play its games in designated order.
playlist_shuffle: bool = True
@ -105,7 +105,7 @@ class ServerConfig:
# currently-signed-in account's id. To fetch info about an account,
# your back-end server can use the following url:
# https://legacy.ballistica.net/accountquery?id=ACCOUNT_ID_HERE
stats_url: Optional[str] = None
stats_url: str | None = None
# If present, the server subprocess will attempt to gracefully exit after
# this amount of time. A graceful exit can occur at the end of a series
@ -113,32 +113,32 @@ class ServerConfig:
# default) will then spin up a fresh subprocess. This mechanism can be
# useful to clear out any memory leaks or other accumulated bad state
# in the server subprocess.
clean_exit_minutes: Optional[float] = None
clean_exit_minutes: float | None = None
# If present, the server subprocess will shut down immediately after this
# amount of time. This can be useful as a fallback for clean_exit_time.
# The server manager will then spin up a fresh server subprocess if
# auto-restart is enabled (the default).
unclean_exit_minutes: Optional[float] = None
unclean_exit_minutes: float | None = None
# If present, the server subprocess will shut down immediately if this
# amount of time passes with no activity from any players. The server
# manager will then spin up a fresh server subprocess if auto-restart is
# enabled (the default).
idle_exit_minutes: Optional[float] = None
idle_exit_minutes: float | None = None
# Should the tutorial be shown at the beginning of games?
show_tutorial: bool = False
# Team names (teams mode only).
team_names: Optional[tuple[str, str]] = None
team_names: tuple[str, str] | None = None
# Team colors (teams mode only).
team_colors: Optional[tuple[tuple[float, float, float],
tuple[float, float, float]]] = None
team_colors: tuple[tuple[float, float, float], tuple[float, float,
float]] | None = None
# (internal) stress-testing mode.
stress_test_players: Optional[int] = None
stress_test_players: int | None = None
# NOTE: as much as possible, communication from the server-manager to the
@ -171,15 +171,15 @@ class ShutdownCommand(ServerCommand):
class ChatMessageCommand(ServerCommand):
"""Chat message from the server."""
message: str
clients: Optional[list[int]]
clients: list[int] | None
@dataclass
class ScreenMessageCommand(ServerCommand):
"""Screen-message from the server."""
message: str
color: Optional[tuple[float, float, float]]
clients: Optional[list[int]]
color: tuple[float, float, float] | None
clients: list[int] | None
@dataclass
@ -191,4 +191,4 @@ class ClientListCommand(ServerCommand):
class KickCommand(ServerCommand):
"""Kick a client."""
client_id: int
ban_time: Optional[int]
ban_time: int | None