Skip to content

Commit

Permalink
fix: Replace NetcodePatcher action with MSBuild (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Distractic authored Jan 21, 2024
1 parent cd26604 commit e156fde
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 3 additions & 9 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ runs:
shell: bash
run: dotnet restore

- name: Setup Netcode Patcher
id: setup-netcode-patcher
uses: Lordfirespeed/setup-netcode-patcher@v0
with:
netcode-patcher-version: 2.4.0
# https://www.nuget.org/packages/LethalCompany.GameLibs.Steam
# Must be the same version as the one used in the project
deps-packages: '[{"id": "UnityEngine.Modules", "version": "2022.3.9"}, {"id": "LethalCompany.GameLibs.Steam", "version": "49.0.0-alpha.1"}]'
target-framework: "netstandard2.1"
- name: Install NetcodePatcher
shell: bash
run: dotnet tool install -g evaisa.netcodepatcher.cli

- name: Install Thunderstore client
if: ${{ inputs.thunderstore-client == 'true' }}
Expand Down
11 changes: 9 additions & 2 deletions Template/Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" IncludeAssets="compile"/>
</ItemGroup>

<!-- https://github.com/EvaisaDev/UnityNetcodePatcher#usage-as-a-post-build-event -->
<!-- Syntax to use the tool installed globally -->
<!-- Allows to patch elements like networked behaviours, RPCs, etc. -->
<Target Name="NetcodePatch" AfterTargets="PostBuildEvent">
<Exec Command="netcode-patch &quot;$(TargetPath)&quot; @(ReferencePathWithRefAssemblies->'&quot;%(Identity)&quot;', ' ')"/>
</Target>

<!-- Avoid that the game's assemblies are copied to the plugin's target directory -->
<Target Name="ClearReferenceCopyLocalPaths" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
Expand All @@ -58,11 +65,11 @@

<!-- Build the plugin for Thunderstore publication -->
<!-- The command will create a zip file in the target directory using the thunderstore.toml file -->
<Target Condition="'$(BuildThunderstorePackage)' == 'true'" Name="ThunderstoreBuild" AfterTargets="PostBuildEvent" DependsOnTargets="MinVer">
<Target Condition="'$(BuildThunderstorePackage)' == 'true'" Name="ThunderstoreBuild" AfterTargets="PostBuildEvent" DependsOnTargets="MinVer;NetcodePatch">
<PropertyGroup>
<PluginVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</PluginVersion>
</PropertyGroup>
<!-- https://github.com/thunderstore-io/thunderstore-cli/wiki -->
<Exec Command="tcli build --config-path $(SolutionDir)thunderstore.toml --package-version $(PluginVersion)" />
<Exec Command="tcli build --config-path $(SolutionDir)thunderstore.toml --package-version $(PluginVersion)"/>
</Target>
</Project>

0 comments on commit e156fde

Please sign in to comment.