updated bacommon

This commit is contained in:
imayushsaini 2021-10-26 23:32:18 +05:30
parent 162b04b6b5
commit a5321fd1a0
9 changed files with 48 additions and 26 deletions

Binary file not shown.

View file

@ -4,10 +4,13 @@
from __future__ import annotations
from typing import TYPE_CHECKING
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Dict, Optional, List
from enum import Enum
from efro import entity
from typing_extensions import Annotated
from efro.dataclassio import ioprepped, IOAttrs
if TYPE_CHECKING:
pass
@ -33,26 +36,27 @@ class AssetType(Enum):
COLLISION_MESH = 'collision_mesh'
class AssetPackageFlavorManifestValue(entity.CompoundValue):
@ioprepped
@dataclass
class AssetPackageFlavorManifest:
"""A manifest of asset info for a specific flavor of an asset package."""
assetfiles = entity.DictField('assetfiles', str, entity.StringValue())
assetfiles: Annotated[Dict[str, str],
IOAttrs('assetfiles')] = field(default_factory=dict)
class AssetPackageFlavorManifest(entity.EntityMixin,
AssetPackageFlavorManifestValue):
"""A self contained AssetPackageFlavorManifestValue."""
class AssetPackageBuildState(entity.Entity):
@ioprepped
@dataclass
class AssetPackageBuildState:
"""Contains info about an in-progress asset cloud build."""
# Asset names still being built.
in_progress_builds = entity.ListField('b', entity.StringValue())
in_progress_builds: Annotated[List[str],
IOAttrs('b')] = field(default_factory=list)
# The initial number of assets needing to be built.
initial_build_count = entity.Field('c', entity.IntValue())
initial_build_count: Annotated[int, IOAttrs('c')] = 0
# Build error string. If this is present, it should be presented
# to the user and they should required to explicitly restart the build
# in some way if desired.
error = entity.Field('e', entity.OptionalStringValue())
error: Annotated[Optional[str], IOAttrs('e')] = None

View file

@ -5,32 +5,37 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, List, Dict, Any, Tuple
from dataclasses import dataclass
from dataclasses import dataclass, field
from efro import entity
from efro.dataclassio import ioprepped
from typing_extensions import Annotated
from efro.dataclassio import ioprepped, IOAttrs
if TYPE_CHECKING:
pass
class ServerNodeEntry(entity.CompoundValue):
@ioprepped
@dataclass
class ServerNodeEntry:
"""Information about a specific server."""
region = entity.Field('r', entity.StringValue())
address = entity.Field('a', entity.StringValue())
port = entity.Field('p', entity.IntValue())
region: Annotated[str, IOAttrs('r')]
address: Annotated[str, IOAttrs('a')]
port: Annotated[int, IOAttrs('p')]
class ServerNodeQueryResponse(entity.Entity):
@ioprepped
@dataclass
class ServerNodeQueryResponse:
"""A response to a query about server-nodes."""
# If present, something went wrong, and this describes it.
error = entity.Field('e', entity.OptionalStringValue(store_default=False))
error: Annotated[Optional[str], IOAttrs('e', store_default=False)] = None
# The set of servernodes.
servers = entity.CompoundListField('s',
ServerNodeEntry(),
store_default=False)
servers: Annotated[List[ServerNodeEntry],
IOAttrs('s', store_default=False)] = field(
default_factory=list)
@ioprepped
@ -56,6 +61,9 @@ class PrivateHostingConfig:
custom_team_colors: Optional[Tuple[Tuple[float, float, float],
Tuple[float, float, float]]] = None
playlist: Optional[List[Dict[str, Any]]] = None
exit_minutes: float = 120.0
exit_minutes_unclean: float = 180.0
exit_minutes_idle: float = 10.0
@ioprepped

View file

@ -51,10 +51,11 @@ class ServerConfig:
# exposed but I'll try to add that soon.
max_party_size: int = 6
# Options here are 'ffa' (free-for-all) and 'teams'
# Options here are 'ffa' (free-for-all), 'teams' and 'coop' (cooperative)
# This value is ignored if you supply a playlist_code (see below).
session_type: str = 'ffa'
# Playlist-code for teams or free-for-all mode sessions.
# To host your own custom playlists, use the 'share' functionality in the
# playlist editor in the regular version of the game.
# This will give you a numeric code you can enter here to host that
@ -72,6 +73,15 @@ class ServerConfig:
# (teams mode only).
auto_balance_teams: bool = True
# The campaign used when in co-op session mode.
# Do print(ba.app.campaigns) to see available campaign names.
coop_campaign: str = 'Easy'
# The level name within the campaign used in co-op session mode.
# For campaign name FOO, do print(ba.app.campaigns['FOO'].levels) to see
# available level names.
coop_level: str = 'Onslaught Training'
# Whether to enable telnet access.
# IMPORTANT: This option is no longer available, as it was being used
# for exploits. Live access to the running server is still possible through