Core: store multidata/multisave enums by value on py3.11 (#1783)

This is what py3.10 did and should be better for AP than the new default
This commit is contained in:
black-sliver
2023-05-02 08:23:39 +02:00
committed by GitHub
parent a368520200
commit 39c7c7291e
2 changed files with 13 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ from json import JSONEncoder, JSONDecoder
import websockets
from Utils import Version
from Utils import ByValue, Version
class JSONMessagePart(typing.TypedDict, total=False):
@@ -20,7 +20,7 @@ class JSONMessagePart(typing.TypedDict, total=False):
flags: int
class ClientStatus(enum.IntEnum):
class ClientStatus(ByValue, enum.IntEnum):
CLIENT_UNKNOWN = 0
CLIENT_CONNECTED = 5
CLIENT_READY = 10
@@ -28,7 +28,7 @@ class ClientStatus(enum.IntEnum):
CLIENT_GOAL = 30
class SlotType(enum.IntFlag):
class SlotType(ByValue, enum.IntFlag):
spectator = 0b00
player = 0b01
group = 0b10
@@ -39,7 +39,7 @@ class SlotType(enum.IntFlag):
return self.value != 0b01
class Permission(enum.IntFlag):
class Permission(ByValue, enum.IntFlag):
disabled = 0b000 # 0, completely disables access
enabled = 0b001 # 1, allows manual use
goal = 0b010 # 2, allows manual use after goal completion