File tree Expand file tree Collapse file tree 6 files changed +58
-9
lines changed Expand file tree Collapse file tree 6 files changed +58
-9
lines changed Original file line number Diff line number Diff line change 77
77
<PackagePath >\</PackagePath >
78
78
</None >
79
79
</ItemGroup >
80
+
81
+ <ItemGroup >
82
+ <AdditionalThisAssemblyFields Condition =" '$(Configuration)'=='Modman'" Include =" IsBepinexBuild" Boolean =" true" />
83
+ <AdditionalThisAssemblyFields Condition =" '$(Configuration)'!='Modman'" Include =" IsBepinexBuild" Boolean =" false" />
84
+ </ItemGroup >
80
85
81
86
<ItemGroup >
82
87
<!-- Mod Package assets -->
98
103
99
104
<!-- Deploy full Steam-Release build and files to vanilla local plugins dir for Workshop publish -->
100
105
<Target Condition =" '$(Configuration)'=='Release'" Name =" CopyReleaseVanillaPlugin" AfterTargets =" Build" >
101
- <!--
102
- <Copy SourceFiles="$(OutputPath)\$(AssemblyName).dll;@(SharedFiles);@(SteamFiles)" DestinationFolder="$(OutputPath)\Publish" />
103
- -->
106
+ <!-- Create SteamCMD publish package -->
107
+ <Copy SourceFiles =" $(OutputPath)\$(AssemblyName).dll;@(SharedFiles)" DestinationFolder =" $(OutputPath)\Publish" />
104
108
<!-- Clear Steam Workshop deploy folder -->
105
109
<RemoveDir Directories =" $(CWPluginOutputPath)" />
106
110
<Message Text =" Cleaned $(CWPluginOutputPath)" Importance =" high" />
Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ public class ShopApiPlugin
22
22
#if STEAM
23
23
static ShopApiPlugin ( )
24
24
{
25
+ SteamLobbyMetadataHandler . RegisterSteamworksCallbacks ( ) ;
25
26
Debug . Log ( $ "{ MOD_GUID } initialised via the vanilla mod loader.") ;
26
27
}
27
28
#elif MODMAN
28
29
private Harmony harmony = new Harmony ( MOD_GUID ) ;
29
30
void Awake ( )
30
31
{
31
32
harmony . PatchAll ( ) ;
33
+ SteamLobbyMetadataHandler . RegisterSteamworksCallbacks ( ) ;
32
34
Debug . Log ( $ "{ MOD_GUID } initialised via BepInEx mod loader.") ;
33
35
}
34
36
#endif
Original file line number Diff line number Diff line change 1
1
using Steamworks ;
2
- using UnityEngine ;
3
2
4
3
namespace ContentWarningShop
5
4
{
6
5
internal static class SteamLobbyMetadataHandler
7
6
{
7
+ private static bool _initialised = false ;
8
+
8
9
private static Callback < LobbyCreated_t > cb_onLobbyCreated ;
9
10
private static Callback < LobbyEnter_t > cb_onLobbyEntered ;
10
11
private static Callback < LobbyDataUpdate_t > cb_onLobbyDataUpdate ;
11
12
//
12
13
internal static event Action ? OnLobbyJoined ;
13
14
internal static event Action ? OnLobbyCreated ;
14
15
internal static event Action ? OnLobbyDataUpdate ;
15
-
16
+ /// <summary>
17
+ /// The ID of the current lobby, if we are in one.
18
+ /// </summary>
19
+ /// <remarks>
20
+ /// Cleared automatically in <see cref="ShopAPI.Patches.SteamLobbyHandlerPatch.LeaveLobby"/> patch whenever the player clicks Leave.
21
+ /// </remarks>
16
22
internal static CSteamID CurrentLobby = CSteamID . Nil ;
17
- // GetLobbyOwner returns nil if the current lobby is invalid / we are not in it
18
- internal static bool InLobby => SteamMatchmaking . GetLobbyOwner ( CurrentLobby ) != CSteamID . Nil ;
23
+
24
+ internal static bool InLobby => CurrentLobby != CSteamID . Nil ;
19
25
internal static bool IsHost => SteamMatchmaking . GetLobbyOwner ( CurrentLobby ) == SteamUser . GetSteamID ( ) ;
20
26
21
- static SteamLobbyMetadataHandler ( )
27
+ internal static void RegisterSteamworksCallbacks ( )
22
28
{
29
+ if ( _initialised ) return ;
30
+
23
31
cb_onLobbyCreated = Callback < LobbyCreated_t > . Create ( Steam_LobbyCreated ) ;
24
32
cb_onLobbyEntered = Callback < LobbyEnter_t > . Create ( Steam_LobbyEntered ) ;
25
33
cb_onLobbyDataUpdate = Callback < LobbyDataUpdate_t > . Create ( Steam_LobbyDataUpdated ) ;
34
+
35
+ _initialised = true ;
26
36
}
27
37
28
38
private static void Steam_LobbyCreated ( LobbyCreated_t e )
Original file line number Diff line number Diff line change 3
3
All notable changes will be documented in this file.
4
4
This project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
5
5
6
+
7
+ ## 1.2.1
8
+ - Steamworks events are now immediately subscribed on plugin initialisation, instead of on first item registration
9
+
6
10
## 1.2.0
7
11
- DLLs are now correctly versioned
8
12
- Added default value constructor to SynchronisedMetadata
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ShopAPI" ,
3
- "version_number" : " 1.2.0 " ,
3
+ "version_number" : " 1.2.1 " ,
4
4
"website_url" : " https://github.com/Xerren09/ContentWarningShopAPI" ,
5
5
"description" : " Exposes an easy-to-use API to add custom items to the in-game shop." ,
6
6
"dependencies" : [
Original file line number Diff line number Diff line change
1
+ " workshopitem"
2
+ {
3
+ " appid" " 2881650"
4
+ " publishedfileid" " 3408837293"
5
+ " contentfolder" " D:\Code\GitHub\ContentWarningShopAPI\bin\Release\n etstandard2.1\Publish"
6
+ " previewfile" " D:\Code\GitHub\ContentWarningShopAPI\publish\steam\preview.png"
7
+ " visibility" " 0"
8
+ " title" " ShopAPI"
9
+ " description" " Exposes an easy-to-use API to add custom items to the in-game shop.
10
+
11
+ [i][b]This mod is meant for other mod developers, and does not add any extra content on its own.[/b][/i]
12
+
13
+ [h2]For players[/h2]
14
+ [b] This mod needs to be first in your Load Order so other mods that depend on it will work.[/b]
15
+ If you are experiencing issues:
16
+ [list]
17
+ [*]Go to your Steam Library
18
+ [*]Right click Content Warning
19
+ [*]Click " Properties"
20
+ [*]Select " Workshop" on the right-hand side
21
+ [*]Drag " ShopAPI" to the top of the list
22
+ [/list]
23
+
24
+ [h2]For developers[/h2]
25
+ Source and instructions are available at the mod's repository: [url=https://github.com/Xerren09/ContentWarningShopAPI] https://github.com/Xerren09/ContentWarningShopAPI [/url]
26
+
27
+ If you run into any problems, please open an new Issue on GitHub.
28
+ "
29
+ }
You can’t perform that action at this time.
0 commit comments