Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,7 @@ FodyWeavers.xsd
# JetBrains Rider
*.sln.iml

# End of https://www.toptal.com/developers/gitignore/api/csharp
# End of https://www.toptal.com/developers/gitignore/api/csharpmodFiles/PolyScriptTemplate.dll
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is everything in this line absolutely correct?

*.polymod

*.dll
10 changes: 7 additions & 3 deletions Main.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using BepInEx.Logging;
using PolyMod;

namespace PolyScriptTemplate;
public static class Main
public class Main : PolyScriptMod
{
public static void Load(ManualLogSource logger)
public override void Load()
{
this.Logger.LogMessage("Here we go!");
}
public override void UnLoad()
{
logger.LogMessage("Here we go!");
}
}
37 changes: 36 additions & 1 deletion PolyScriptTemplate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PolyMod" Version="*" />
<PackageReference Include="PolyMod" Version="*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MSBuildTasks" Version="1.5.0.235">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistent indent plz

<PropertyGroup>
<ModFilesDir>$(ProjectDir)..\modFiles\</ModFilesDir>
<ZipFile>$(ProjectDir)..\template.polymod</ZipFile>

<SteamDir Condition="'$(SteamDir)' != ''">$(SteamDir)</SteamDir>
<SteamDir Condition="'$(SteamDir)' == '' AND '$(OS)' == 'Windows_NT'">C:\Program Files (x86)\Steam</SteamDir>
<SteamDir Condition="'$(SteamDir)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(HOME)/.steam/steam')">$(HOME)/.steam/steam</SteamDir>
<SteamDir Condition="'$(SteamDir)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(HOME)/Library/Application Support/Steam')">$(HOME)/Library/Application Support/Steam</SteamDir>

<PolytopiaModsDir>$(SteamDir)/steamapps/common/The Battle of Polytopia/Mods</PolytopiaModsDir>
</PropertyGroup>

<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(ModFilesDir)" />

<ItemGroup>
<FilesToZip Include="$(ModFilesDir)**\*" />
</ItemGroup>

<ZipDirectory SourceDirectory="$(ModFilesDir)" DestinationFile="$(ZipFile)" Overwrite="true" />

<Error Condition="!Exists('$(PolytopiaModsDir)')"
Text="Polytopia Mods folder not found at '$(PolytopiaModsDir)'. Please set SteamDir manually (e.g. dotnet build -p:SteamDir=/path/to/steam)." />

<Message Text="Deploying $(ZipFile) to $(PolytopiaModsDir)" Importance="high" />

<Copy SourceFiles="$(ZipFile)" DestinationFolder="$(PolytopiaModsDir)"/>
</Target>
</Project>
5 changes: 5 additions & 0 deletions modFiles/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "template",
"version": "1.0.0",
"authors": ["your_name_here"]
}