From 0afa39222a812dec5550cd98b164e28a093af498 Mon Sep 17 00:00:00 2001 From: Cyprian Klimaszewski Date: Tue, 24 Mar 2026 22:07:56 +0100 Subject: [PATCH] Add: availability for BaNaNaS content. --- openttd_protocol/protocol/content.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/openttd_protocol/protocol/content.py b/openttd_protocol/protocol/content.py index e646d7c..79cba31 100644 --- a/openttd_protocol/protocol/content.py +++ b/openttd_protocol/protocol/content.py @@ -48,6 +48,12 @@ class ContentType(enum.IntEnum): CONTENT_TYPE_END = 11 +class Availability(enum.IntEnum): + AVAILABILITY_SAVEGAMES_ONLY = 0 + AVAILABILITY_NEW_GAMES = 1 + AVAILABILITY_INVALID = 0xFF + + class ContentInfo: def __init__(self, content_id=None, content_type=None, unique_id=None, md5sum=None): super().__init__() @@ -187,7 +193,19 @@ def receive_PACKET_CONTENT_CLIENT_CONTENT(cls, source, data): return {"content_infos": content_infos} async def send_PACKET_CONTENT_SERVER_INFO( - self, content_type, content_id, filesize, name, version, url, description, unique_id, md5sum, dependencies, tags + self, + content_type, + content_id, + filesize, + name, + version, + url, + description, + unique_id, + md5sum, + dependencies, + tags, + availability=Availability.AVAILABILITY_INVALID, ): data = write_init(PacketContentType.PACKET_CONTENT_SERVER_INFO) @@ -224,6 +242,8 @@ async def send_PACKET_CONTENT_SERVER_INFO( for tag in tags: write_string(data, tag) + write_uint8(data, availability) + write_presend(data, SEND_TCP_COMPAT_MTU) return await self.send_packet(data)