Skip to content

Name a workshop addon when changing level to a community map - #89

Open
SixFive7 wants to merge 2 commits into
Source2ZE:mainfrom
SixFive7:fix-community-map-extra-addons
Open

SixFive7 wants to merge 2 commits into
Source2ZE:mainfrom
SixFive7:fix-community-map-extra-addons

Conversation

@SixFive7

Copy link
Copy Markdown

Fixes #88.

What changes

One condition in Hook_SendNetMessage. A SIGNONSTATE_CHANGELEVEL message that lists more than one addon is still cut down to one entry (f5b3ade). Two things must hold for the change to apply:

  • the first entry is a community map's addon (a folder under OFFICIAL_ADDONS, the check ReloadMap and Hook_SetPendingHostStateRequest already use);
  • the client is recorded as having the next addon (it is in downloadedAddons).

Then the message names that next addon instead, and it becomes the client's pending addon. Nothing else changes.

Why it works

A community map's addon ships with the game. A message naming only that addon makes the client change level in place with it alone: it unmounts every extra addon and never goes through ReplyConnection. After that, Hook_SendNetMessage sends whatever is still missing, except the addons listed in downloadedAddons. So with mm_cache_clients_with_addons 1, the extras are never sent again for the rest of the map (#88).

A message naming a workshop addon makes the client take the path it takes for a workshop map: Downloading Addons (<addon>) (instant, since it already has the item), a full reconnect, and Hook_ReplyConnection sends the full list. ReplyConnection itself needs no change. The client is recorded as having <addon>, so it stays in the list, and the community map becomes the pending addon if it is not recorded yet.

The second condition limits the change to the case that is actually broken. An addon the client is not recorded as having, which with mm_cache_clients_with_addons 0 is every addon, is still sent after the in-place change, as in v1.7.4.

Tests

Run on 2026-11-20 on a Linux dedicated server (CS2 1.42.0.0, SteamRT4 build of this branch at 74357cd) with one workshop addon in mm_extra_addons and a Windows client, with mm_cache_clients_with_addons 1 unless noted.

Before (v1.7.4, 033de6c): changelevel de_eldorado changes level in place. The client logs SwitchToLoop levelload requested: id [7] addons [de_eldorado] and Unmounting addon '<addon>', nothing follows, and <addon> stays missing until the player reconnects by hand. With the cache at 0, the same in-place load is followed by one reconnect with [addons:'de_eldorado,<addon>'].

After (this branch):

Change Client In game after
Valve map → de_eldorado Downloading Addons (<addon>), one reconnect, [addons:'de_eldorado,<addon>'], both mounted about 5 s
de_eldorado → de_debris the same, [addons:'de_debris,<addon>'] 4-5 s
de_debris → de_poseidon the same, [addons:'de_poseidon,<addon>'] about 5 s
de_poseidon → Valve map (ar_baggage) unchanged: one reconnect, [addons:'<addon>'] about 5 s
Valve map → workshop map unchanged: one reconnect, [addons:'<workshop map>,<addon>'] 3-4 s
workshop map → de_eldorado one reconnect, [addons:'de_eldorado,<addon>'] about 5.5 s
Fresh join on de_eldorado [addons:'de_eldorado,<addon>'], both mounted, no extra download -
Cache 0: Valve map → de_eldorado unchanged from v1.7.4: in place with [de_eldorado], then one reconnect with [addons:'de_eldorado,<addon>'] about 8 s
No mm_extra_addons: Valve map → de_eldorado unchanged: the list holds only the map, so the change does not apply; the client changes level in place and the server keeps running about 7 s

No reconnect loops and no missing content in any case: every change took at most one reconnect. "In game after" runs from the changelevel to the client being in game, by the client's whole-second stamps.

Client console for Valve map → de_eldorado:

[HostStateManager] CHostStateMgr::QueueNewRequest( Downloading Addons (<addon>), 3 )
[HostStateManager] HostStateRequest::Start(HSR_GAME):  loop(addondownload) id(3) addons(<addon>) desc(Downloading Addons (<addon>))
[HostStateManager] Discarding pending request 'Downloading Addons (<addon>), 3'
[EngineServiceManager] Unmounting addon '<addon>'
[Client] Received S2C_CONNECTION from <address> [addons:'de_eldorado,<addon>']
[EngineServiceManager] SwitchToLoop levelload requested:  id [4] addons [de_eldorado,<addon>]
[EngineServiceManager] Mounting addon 'de_eldorado'
[EngineServiceManager] Mounting addon '<addon>'

Built by this repository's workflow on the fork (Windows, SteamRT3 and SteamRT4): https://github.com/SixFive7/MultiAddonManager/actions/runs/44670162240. It gives the same compiler warnings as main's run, none from this change.

Cost

  • With the cache on, a change to a community map now costs every client one reconnect, the same as a workshop map change.
  • With mm_cache_clients_with_addons 0, or for a client that is not recorded as having the addon, nothing changes. The client changes level in place and the addon follows after one reconnect, as in v1.7.4.

A CHANGELEVEL signon with more than one addon is cut down to its first
entry (f5b3ade). For a community map that entry is the map's own addon
under game/csgo_community_addons, which clients ship with the game, so
they change level in place with that addon alone: every extra addon is
unmounted, and the client never reconnects through ReplyConnection to
get the full list. With mm_cache_clients_with_addons the extras are not
re-sent either, so they stay missing for the whole map.

In that case, name the next addon instead. The client reconnects for it
as it does for a workshop map, and ReplyConnection sends the full list.
Workshop maps, Valve's built-in maps and single-addon lists are unchanged.
The previous commit names the next addon whenever a community map leads
the CHANGELEVEL list. With mm_cache_clients_with_addons 0 the client's
downloaded list is cleared on every map, so ReplyConnection then sends
the community map alone first and the extra addon follows on a second
reconnect: one more than before, where the in-place change already
recovers with one.

Do it only when the client is recorded as having the next addon, which
is exactly when the downloaded-list check in Hook_SendNetMessage would
keep it from being sent again. Otherwise the in-place change and the
usual follow-up send stay as they were.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extra addons are dropped on clients when changing level to a community map

1 participant