Skip to content

Commit b615fca

Browse files
committed
CelesteNet: display the lobby icon instead of the map icon in the player list when playing a collab
1 parent 2976f96 commit b615fca

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

CollabUtils2.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
</PackageReference>
1616
</ItemGroup>
1717

18+
<ItemGroup>
19+
<Reference Include="CelesteNet.Client">
20+
<HintPath>lib-stripped\CelesteNet.Client.dll</HintPath>
21+
<Private>false</Private>
22+
</Reference>
23+
<Reference Include="CelesteNet.Shared">
24+
<HintPath>lib-stripped\CelesteNet.Shared.dll</HintPath>
25+
<Private>false</Private>
26+
</Reference>
27+
</ItemGroup>
28+
1829
<Choose>
1930
<When Condition="Exists('..\..\Celeste.exe')">
2031
<ItemGroup>

LobbyHelper.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Celeste.Mod.CelesteNet.Client.Components;
12
using Celeste.Mod.CollabUtils2.UI;
23
using Celeste.Mod.UI;
34
using Mono.Cecil;
@@ -35,6 +36,10 @@ internal static void OnInitialize() {
3536
) {
3637
LoadCollabIDFile(asset);
3738
}
39+
40+
if (Everest.Loader.DependencyLoaded(new EverestModuleMetadata() { Name = "CelesteNet.Client", Version = new Version(2, 0, 0) })) {
41+
adjustCollabIcon();
42+
}
3843
}
3944

4045
public static void LoadCollabIDFile(ModAsset asset) {
@@ -169,6 +174,19 @@ internal static void Unload() {
169174
hookOnOuiFileSelectSlotRender?.Dispose();
170175
}
171176

177+
private static void adjustCollabIcon() {
178+
CelesteNetPlayerListComponent.OnGetState += (blob, state) => {
179+
// if we are in a collab map, change the icon displayed in the CelesteNet player list to the lobby icon.
180+
AreaData data = AreaData.Get(state.SID);
181+
if (data != null) {
182+
string lobbySID = GetLobbyForLevelSet(data.LevelSet);
183+
if (lobbySID != null) {
184+
blob.Location.Icon = AreaData.Get(lobbySID)?.Icon ?? blob.Location.Icon;
185+
}
186+
}
187+
};
188+
}
189+
172190
public static void OnSessionCreated() {
173191
Session session = SaveData.Instance.CurrentSession_Safe;
174192
string levelSet = GetLobbyLevelSet(session.Area.GetSID());

everest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: CollabUtils2
2-
Version: 1.6.1
2+
Version: 1.6.2
33
DLL: bin/Debug/net452/CollabUtils2.dll
44
Dependencies:
55
- Name: Everest

lib-stripped/CelesteNet.Client.dll

81 KB
Binary file not shown.

lib-stripped/CelesteNet.Shared.dll

59.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)