Skip to content

Commit a108ac0

Browse files
authored
Merge pull request #662 from PhantomGamers/logdspver
log expected game version
2 parents 8313fa5 + 53ec83c commit a108ac0

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

Nebula.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1515
SharedConfig.targets = SharedConfig.targets
1616
Shims\Shims.cs = Shims\Shims.cs
1717
version.json = version.json
18+
Directory.Build.rsp = Directory.Build.rsp
1819
EndProjectSection
1920
EndProject
2021
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NebulaWorld", "NebulaWorld\NebulaWorld.csproj", "{28AEA139-FB22-4672-AF51-28B728CF2978}"

NebulaPatcher/NebulaPatcher.csproj

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,31 @@
99
<ProjectReference Include="..\NebulaNetwork\NebulaNetwork.csproj"/>
1010
<ProjectReference Include="..\NebulaWorld\NebulaWorld.csproj" SpecificVersion="true"/>
1111
</ItemGroup>
12+
13+
<Target Name="WritePackageVersion" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)GeneratedFile.cs">
14+
<PropertyGroup>
15+
<PackageVersion></PackageVersion>
16+
<ProjectAssetsJsonPath>$(BaseIntermediateOutputPath)project.assets.json</ProjectAssetsJsonPath>
17+
</PropertyGroup>
18+
<Exec Command="powershell -Command &quot;$projectAssets = Get-Content $(ProjectAssetsJsonPath) -Raw | ConvertFrom-Json; $packageKey = $projectAssets.libraries.PSObject.Properties.Name | Where-Object { $_ -match 'DysonSphereProgram.GameLibs' }; $version = $packageKey.Split('/')[1].Split('-')[0]; Write-Output $version&quot;" ConsoleToMSBuild="true">
19+
<Output TaskParameter="ConsoleOutput" PropertyName="PackageVersion" />
20+
</Exec>
21+
<PropertyGroup>
22+
<GeneratedText><![CDATA[
23+
namespace $(RootNamespace)
24+
{
25+
internal static class DSPGameVersion
26+
{
27+
public const string VERSION = "$(PackageVersion)"%3B
28+
}
29+
}
30+
]]></GeneratedText>
31+
<GeneratedFilePath>$(IntermediateOutputPath)DSPGameVersion.cs</GeneratedFilePath>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Compile Include="$(GeneratedFilePath)" />
35+
<FileWrites Include="$(GeneratedFilePath)" />
36+
</ItemGroup>
37+
<WriteLinesToFile Lines="$(GeneratedText)" File="$(GeneratedFilePath)" WriteOnlyWhenDifferent="true" Overwrite="true" />
38+
</Target>
1239
</Project>

NebulaPatcher/NebulaPlugin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private static void InitPatches()
298298

299299
try
300300
{
301-
Log.Info($"Applying patches from {PluginInfo.PLUGIN_NAME} {PluginInfo.PLUGIN_DISPLAY_VERSION}");
301+
Log.Info($"Applying patches from {PluginInfo.PLUGIN_NAME} {PluginInfo.PLUGIN_DISPLAY_VERSION} made for game version {DSPGameVersion.VERSION}");
302302
#if DEBUG
303303
if (Directory.Exists("./mmdump"))
304304
{
@@ -328,7 +328,7 @@ private static void InitPatches()
328328
Log.Error("Unhandled exception occurred while patching the game:", ex);
329329
// Show error in UIFatalErrorTip to inform normal users
330330
Harmony.CreateAndPatchAll(typeof(UIFatalErrorTip_Patch));
331-
Log.Error("Nebula Multiplayer Mod is incompatible with game version\nUnhandled exception occurred while patching the game.");
331+
Log.Error($"Nebula Multiplayer Mod is incompatible with game version, expected version {DSPGameVersion.VERSION}\nUnhandled exception occurred while patching the game.");
332332
}
333333
}
334334

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22

33
An open-source, multiplayer mod for the game [Dyson Sphere Program](https://store.steampowered.com/app/1366540/Dyson_Sphere_Program/).
44

5-
# Download Prerelease
5+
## Download Prerelease
66

77
[![Build - Win x64](https://github.com/NebulaModTeam/nebula/actions/workflows/build-winx64.yml/badge.svg?branch=master)](https://nightly.link/NebulaModTeam/nebula/workflows/build-winx64/master/build-artifacts-Release.zip)
88
Note: This is the bleeding edge build, for the more stable build see below. You can use this one if you want to try out the latest development builds, which may contain bugs and unfinished work.
99

1010
You will also need some extra steps to get this installed, see 2nd point in ["How can I play this mod?"](#how-can-i-play-this-mod).
1111

12-
# FAQ
12+
## FAQ
1313

14-
## Where can I get mod support?
14+
### Where can I get mod support?
1515

1616
Please join our [Discord Server](https://discord.gg/UHeB2QvgDa) and ask your question in the `support` channel. We have a really nice community that will be able to answer your questions.
1717

18-
## How can I play this mod?
18+
### How can I play this mod?
1919

2020
Please do keep in mind that this mod is still in heavy development, it may still contains bugs.
2121

2222
- Stable version of the mod can be downloaded from [Thunderstore](https://dsp.thunderstore.io/package/nebula/NebulaMultiplayerMod/) (Recommended).
2323
- If you want to install the latest version of the mod, you can install pre-release versions be following the [installation guide](https://github.com/NebulaModTeam/nebula/wiki/Installation#manual-installation).
2424
- To connect, check [hosting and joining guide](https://github.com/NebulaModTeam/nebula/wiki/Hosting-and-Joining).
2525

26-
## API Documentation
26+
### API Documentation
2727

2828
This mod has an API, that makes it easier for other mod developers to make their mods compatible with Nebula. If you are a mod developer and you want your mods to be compatible, follow the instructions [here](https://github.com/NebulaModTeam/nebula/wiki/Nebula-mod-API). Also you can always join our [Discord Server](https://discord.gg/UHeB2QvgDa) for help with using the API.
2929

30-
## Chat
30+
### Chat
3131

3232
The chat window can opened/closed using Alt + Backtick (configurable in Settings - Multiplayer - Chat). Type `/help` to view all commands. Also in settings is an option to disable the chat window from automatically opening when a message is received.
3333

34-
## What is the current status?
34+
### What is the current status?
3535

3636
Major refactors will happen while the project grows or game updates. Join the [Discord Server](https://discord.gg/UHeB2QvgDa) if you want to see to latest state of our development. Check [Wiki](https://github.com/NebulaModTeam/nebula/wiki/About-Nebula) for overview of features.
3737

@@ -116,13 +116,10 @@ Most of the battle aspect are sync, only few features are still WIP.
116116

117117
</details>
118118

119-
120-
121-
## How can I contribute?
119+
### How can I contribute?
122120

123121
Please join our [Discord Server](https://discord.gg/UHeB2QvgDa) to ask if someone is already working on the task that you want to do. Once, you are done with your modification, simply submit a pull request. Contribution documentation can be found here: [Wiki](https://github.com/NebulaModTeam/nebula/wiki/Setting-up-a-development-environment).
124122

125-
## How can I support the team?
123+
### How can I support the team?
126124

127125
If you like what we do and would like to support us, you can donate through our [Patreon](https://www.patreon.com/nebula_mod_team). Thanks for the support <3
128-

0 commit comments

Comments
 (0)