Skip to content

Commit

Permalink
1.8.0 - update to new TLD/Melon.
Browse files Browse the repository at this point in the history
Small code cleanup
  • Loading branch information
ttr committed Feb 24, 2023
1 parent abda2c9 commit e46b2b9
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 173 deletions.
122 changes: 39 additions & 83 deletions ArrowMod.csproj
Original file line number Diff line number Diff line change
@@ -1,96 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<!--This is an xml comment. Comments have no impact on compiling.-->

<PropertyGroup>
<!--This is the .NET version the mod will be compiled with. Don't change it.-->
<TargetFramework>net6.0</TargetFramework>

<!--This tells the compiler to use the latest C# version.-->
<LangVersion>Latest</LangVersion>

<!--This adds global usings for a few common System namespaces.-->
<ImplicitUsings>enable</ImplicitUsings>

<!--This enables nullable annotation and analysis. It's good coding form.-->
<Nullable>enable</Nullable>

<!--This tells the compiler to use assembly attributes instead of generating its own.-->
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

<!--PDB files give line numbers in stack traces (errors). This is useful for debugging. There are 3 options:-->
<!--full has a pdb file created beside the dll.-->
<!--embedded has the pdb data embedded within the dll. This is useful because bug reports will then have line numbers.-->
<!--none skips creation of pdb data.-->
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DAF59C7B-B568-4A66-BECA-0D8B47971845}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ArrowMod</RootNamespace>
<AssemblyName>ArrowMod</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>

<PropertyGroup />

<ItemGroup>
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\TheLongDark\tld_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2Cppmscorlib, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\Managed\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="MelonLoader, Version=0.4.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="ModSettings, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="UnhollowerBaseLib, Version=0.4.15.4, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\Managed\UnhollowerBaseLib.dll</HintPath>
</Reference>
<Reference Include="UnhollowerRuntimeLib, Version=0.4.10.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\MelonLoader\Managed\UnhollowerRuntimeLib.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\TheLongDark\tld_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\SteamLibrary\steamapps\common\TheLongDark\tld_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="src\Patches.cs" />
<Compile Include="src\Settings.cs" />
<Compile Include="src\ArrowMod.cs" />
<PackageReference Include="ds5678.Modding.TLD.Il2CppAssemblies.Windows" Version="2.6.0" />
</ItemGroup>

<ItemGroup>
<None Include="LICENSE" />
<None Include="README.md" />
<Reference Include="ModSettings">
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\ModSettings.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /y "$(ProjectDir)bin\Debug\ArrowMod.dll" "D:\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\"</PostBuildEvent>
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /y &quot;$(ProjectDir)bin\Debug\net6.0\ArrowMod.dll&quot; &quot;D:\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\&quot;" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
22 changes: 8 additions & 14 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
using MelonLoader;
using System.Reflection;
using System.Runtime.InteropServices;
using BuildInfo = ArrowMod.BuildInfo;

[assembly: ComVisible(false)]
[assembly: Guid("daf59c7b-b568-4a66-beca-0d8b47971845")]
//This is a C# comment. Comments have no impact on compilation.

[assembly: AssemblyTitle(BuildInfo.Name)]
[assembly: AssemblyDescription(BuildInfo.Description)]
[assembly: AssemblyCompany(BuildInfo.Company)]
[assembly: AssemblyProduct(BuildInfo.Name)]
[assembly: AssemblyCopyright("Created by " + BuildInfo.Author)]
[assembly: AssemblyTrademark(BuildInfo.Company)]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle(ArrowMod.BuildInfo.ModName)]
[assembly: AssemblyCopyright($"Created by {ArrowMod.BuildInfo.ModAuthor}")]

[assembly: AssemblyVersion(BuildInfo.Version)]
[assembly: AssemblyFileVersion(BuildInfo.Version)]
[assembly: MelonInfo(typeof(ArrowMod.ArrowMod), BuildInfo.Name, BuildInfo.Version, BuildInfo.Author, BuildInfo.DownloadLink)]
[assembly: AssemblyVersion(ArrowMod.BuildInfo.ModVersion)]
[assembly: AssemblyFileVersion(ArrowMod.BuildInfo.ModVersion)]
[assembly: MelonInfo(typeof(ArrowMod.ArrowMod), ArrowMod.BuildInfo.ModName, ArrowMod.BuildInfo.ModVersion, ArrowMod.BuildInfo.ModAuthor)]

//This tells MelonLoader that the mod is only for The Long Dark.
[assembly: MelonGame("Hinterland", "TheLongDark")]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ This mod for *The Long Dark* allows you to adjust how arrows are crafted. Requir

## Installation

Always up to date instructions: https://xpazeman.com/tld-mod-list/install.html

1. If you haven't done so already, install MelonLoader by downloading and running [MelonLoader.Installer.exe](https://github.com/HerpDerpinstine/MelonLoader/releases/latest/download/MelonLoader.Installer.exe)
2. Download the latest version of `ArrowMod.dll` from the [releases page](https://github.com/ds5678/tld-ArrowMod/releases/latest)
3. Download the latest version of `ModSettings.dll` from its [release page](https://github.com/zeobviouslyfakeacc/ModSettings/releases/latest)
4. Move `ArrowMod.dll` and `ModSettings.dll` into the Mods folder in your TLD install directory

## Notes

Settings change will require game restart.

Many thanks to all TLD moding commniunity for support and assist.
37 changes: 19 additions & 18 deletions src/ArrowMod.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
using MelonLoader;

using UnityEngine;

namespace ArrowMod
{
public static class BuildInfo
{
public const string Name = "ArrowMod"; // Name of the Mod. (MUST BE SET)
public const string Description = "A mod to make arrow crafting more realistic."; // Description for the Mod. (Set as null if none)
public const string Author = "ttr, ds5678"; // Author of the Mod. (MUST BE SET)
public const string Company = null; // Company that made the Mod. (Set as null if none)
public const string Version = "1.7.1"; // Version of the Mod. (MUST BE SET)
public const string DownloadLink = null; // Download Link for the Mod. (Set as null if none)
}
internal class ArrowMod : MelonMod
{
public override void OnApplicationStart()
{
Debug.Log($"[{Info.Name}] Version {Info.Version} loaded!");
Settings.OnLoad();
}
}
public static class BuildInfo
{
internal const string ModName = "ArrowMod";
internal const string ModAuthor = "ttr";
internal const string ModVersion = "1.8.0";
}
internal class ArrowMod : MelonMod
{

public override void OnInitializeMelon()
{
Settings.OnLoad();
LoggerInstance.Msg($"[{BuildInfo.ModName}] Version {BuildInfo.ModVersion} loaded!");
}
public static void Log(string msg)
{
MelonLogger.Msg(msg);
}
}
}
Loading

0 comments on commit e46b2b9

Please sign in to comment.