Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
update to melon 4.3
Browse files Browse the repository at this point in the history
add assume polaroids option
  • Loading branch information
ttr committed Aug 22, 2021
1 parent b2a80b1 commit 3d58ddd
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 21 deletions.
10 changes: 8 additions & 2 deletions MapTweaks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@
</Reference>
<Reference Include="Il2Cppmscorlib, Version=3.7.1.6, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="Il2CppSystem, Version=3.7.1.6, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="MelonLoader.ModHandler, Version=0.2.7.1, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="ModSettings, Version=1.6.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.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Games\SteamLibrary\steamapps\common\TheLongDark\Mods\ModSettings.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand Down
17 changes: 8 additions & 9 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
using MelonLoader;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MapTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MapTweaks")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Expand All @@ -26,14 +25,14 @@
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: MelonModInfo(typeof(MapTweaks.MapTweaks), "MapTweaks", "2.0", "MikeyPdog, AlexTheRegent, ttr")]
[assembly: MelonModGame("Hinterland", "TheLongDark")]
[assembly: MelonInfo(typeof(MapTweaks.MapTweaks), "MapTweaks", "2.2", "MikeyPdog, AlexTheRegent, ttr")]
[assembly: MelonGame("Hinterland", "TheLongDark")]
4 changes: 1 addition & 3 deletions src/MapTweaks.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using MelonLoader;
using System.IO;
using UnityEngine;


Expand All @@ -10,11 +9,10 @@ internal class MapTweaks : MelonMod

public override void OnApplicationStart()
{
Debug.Log($"[{InfoAttribute.Name}] Version {InfoAttribute.Version} loaded!");
Debug.Log($"[{Info.Name}] Version {Info.Version} loaded!");
Settings.OnLoad();
}
}
}



33 changes: 26 additions & 7 deletions src/Patches.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Harmony;
using HarmonyLib;
using MelonLoader;
using UnityEngine;


namespace MapTweaks
Expand All @@ -12,23 +11,43 @@ internal static class Patches
[HarmonyPatch(typeof(Panel_Map), "DoNearbyDetailsCheck")]
public class MapTweaksDrawing
{
public static void Prefix(ref float radius)
public static void Prefix(ref float radius, ref bool shouldAllowVistaReveals)
{
radius *= Settings.options.rangeMulti;
// MelonLogger.Log("range: " + radius);
MelonLogger.Msg("range: " + radius + " " + shouldAllowVistaReveals);
}
}
[HarmonyPatch(typeof(Panel_Map), "HasVistaLocationRequiredGearItem")]
public class panel_map_HasVistaLocationRequiredGearItem
{
public static void Postfix(VistaLocation vistaLocation, bool __result)
{
if (Settings.options.assumePolaroids && !__result)
{
MelonLogger.Msg(__result + " Would add: " + vistaLocation.m_RequiredGearItem.name);
GameManager.GetPlayerManagerComponent().AddItemToPlayerInventory(vistaLocation.m_RequiredGearItem);
}
}
}
[HarmonyPatch(typeof(Panel_Map), "RevealOnPolaroidDiscovery")]
public class panel_map_RevealOnPolaroidDiscovery
{
public static bool Prefix()
{
if (Settings.options.assumePolaroids)
{ return false; }
return true;
}
}

[HarmonyPatch(typeof(CharcoalItem))]
[HarmonyPatch("Awake")]
class PatchCharcoalMappingTime
{
static void Postfix(CharcoalItem __instance)
{
__instance.m_SurveyGameMinutes *= Settings.options.timeMulti;
// MelonLogger.Log("time: " + __instance.m_SurveyGameMinutes);
}
}

}

}
4 changes: 4 additions & 0 deletions src/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ internal class MapTweaksSettings : JsonModSettings
[Slider(0.1f, 5f)]
public float timeMulti = 1f;

[Name("Polarods discovered")]
[Description("Surveying vistas w/o polaroid will silently add it to inventory. Finding polaroids will not discover their locations.")]
public bool assumePolaroids = false;

}
internal static class Settings
{
Expand Down

0 comments on commit 3d58ddd

Please sign in to comment.