From 66f28b4b45b0978e55508953c6c78c634a545f0a Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 3 Jan 2024 01:20:51 +0000 Subject: [PATCH] inital mod --- FrameLimiter.cs | 51 +++++++++++++ Mod/frame_limiter.dll | Bin 0 -> 4096 bytes ModInfo.xml | 10 +++ frame_limiter.csproj | 169 ++++++++++++++++++++++++++++++++++++++++++ frame_limiter.sln | 18 +++++ 5 files changed, 248 insertions(+) create mode 100644 FrameLimiter.cs create mode 100644 Mod/frame_limiter.dll create mode 100644 ModInfo.xml create mode 100644 frame_limiter.csproj create mode 100644 frame_limiter.sln diff --git a/FrameLimiter.cs b/FrameLimiter.cs new file mode 100644 index 0000000..f5cb1e8 --- /dev/null +++ b/FrameLimiter.cs @@ -0,0 +1,51 @@ +using ModAPI.Attributes; +using TheForest.Items.Inventory; +using TheForest.Utils; +using UnityEngine; + +namespace frame_limiter +{ + class FrameLimiter : MonoBehaviour + { + /** + * The frame limit to apply when the player is in the pause menu or loading screen. + */ + private const int FrameLimit = 30; + + [ExecuteOnGameStart] + private static void AddMeToScene() + { + new GameObject("__FrameLimiter__").AddComponent(); + + } + + private void Update() + { + PlayerInventory inventory = LocalPlayer.Inventory; + if (inventory == null) + { + return; + } + + switch (inventory.CurrentView) + { + case PlayerInventory.PlayerViews.Pause: + { + Application.targetFrameRate = FrameLimit; + break; + } + + case PlayerInventory.PlayerViews.Loading: + { + Application.targetFrameRate = FrameLimit; + break; + } + default: // The frame limiter is set to the max frame rate that the user has set in the options. + { + Application.targetFrameRate = PlayerPreferences.MaxFrameRate; + break; + } + } + } + } +} \ No newline at end of file diff --git a/Mod/frame_limiter.dll b/Mod/frame_limiter.dll new file mode 100644 index 0000000000000000000000000000000000000000..f899e3b47f41e11af13a254d98c8d7f5a7ff6bc5 GIT binary patch literal 4096 zcmeHJOKclO82-j_oYbLdW7;Z(s%%ILAq|Vu2AcBB!$}DwO^DO*kcGRp2WMfuYj)Rd z!XX6lQV&Q4aX{h#LL89bPze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=j2%>2?_*3F;?Y$?3yn8f+1o?z2;aaF-hGSNO!kN512?Wc z-F5HTGv9r=@YVU3)uha=xr$e^s&@Wh`rvSSba*sB%p3V;Go9l%fht^(+bnQSm$0#2 zb6(-m-0J8pIi3i~LwT{(tdI1B#7xvSJ{(||VmCMZ$dZAum<6_IvyORDBzS2|Q4iAj+yCK?mibZ^ca2Z*ijAcw= zk=P8sw2qOUA)JoBy6{Q-=ij22Qcv3ichxcV2DF&f+zg?hRf{KYnrG1A8JvO3x6{+| zefs5C(r490K)J|J+QTwd=p*#DoYia1*ZC?7YOO{_6{T*vf41g`j&p&wJo-^% zK0;PV-Hpv?n{ld``Aw$hj8h|^W`)^x=%w+u^EmbYcDXWOMBl4#9===#|F`pB%E0d| CrT@wR literal 0 HcmV?d00001 diff --git a/ModInfo.xml b/ModInfo.xml new file mode 100644 index 0000000..14ef391 --- /dev/null +++ b/ModInfo.xml @@ -0,0 +1,10 @@ + + 1.11b + + Frame Limiter + + + Limits the frame rate when the game is paused. + + 1.0.0.2 + \ No newline at end of file diff --git a/frame_limiter.csproj b/frame_limiter.csproj new file mode 100644 index 0000000..d5f10f9 --- /dev/null +++ b/frame_limiter.csproj @@ -0,0 +1,169 @@ + + + + + Release + x86 + {53821041-E269-4717-BAED-3C9C6836E83F} + Library + Properties + frame_limiter + frame_limiter + v4.8 + 512 + + + + pdbonly + true + Mod\ + TRACE + prompt + 4 + false + + + + + + ../../../libs/BaseModLib.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Assembly-CSharp-firstpass.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Assembly-CSharp.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Assembly-UnityScript-firstpass.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Assembly-UnityScript.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/bolt.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/bolt.user.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/SteamworksManaged.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Boo.Lang.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Mono.Security.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/UnityScript.Lang.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Boo.Lang.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Mono.Posix.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Mono.Security.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/mscorlib.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.ClipperLib.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.Ionic.Zip.Reduced.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.JsonFx.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.Poly2Tri.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/PlayMaker.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/Rewired_Core.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/System.Configuration.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/System.Core.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/System.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/System.Security.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/System.Xml.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/TheForest.Commons.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/TheForest.Modding.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/UnityEngine.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/UnityEngine.Networking.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/UnityEngine.UI.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/UnityScript.Lang.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/udpkit.dll + False + + + ../../../modlib/TheForest/TheForest_data/Managed/udpkit.common.dll + False + + + + + + + \ No newline at end of file diff --git a/frame_limiter.sln b/frame_limiter.sln new file mode 100644 index 0000000..8418af8 --- /dev/null +++ b/frame_limiter.sln @@ -0,0 +1,18 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "frame_limiter", "frame_limiter.csproj", "{53821041-E269-4717-BAED-3C9C6836E83F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {53821041-E269-4717-BAED-3C9C6836E83F}.Release|x86.ActiveCfg = Release|x86 + {53821041-E269-4717-BAED-3C9C6836E83F}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal