Skip to content
Open
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
22 changes: 21 additions & 1 deletion openttd_protocol/protocol/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
Loading