inital mod
This commit is contained in:
parent
3da63b56cf
commit
66f28b4b45
51
FrameLimiter.cs
Normal file
51
FrameLimiter.cs
Normal file
@ -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<FrameLimiter>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Mod/frame_limiter.dll
Normal file
BIN
Mod/frame_limiter.dll
Normal file
Binary file not shown.
10
ModInfo.xml
Normal file
10
ModInfo.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Mod ID="frame_limiter">
|
||||||
|
<Compatible>1.11b</Compatible>
|
||||||
|
<Name>
|
||||||
|
<EN>Frame Limiter</EN>
|
||||||
|
</Name>
|
||||||
|
<Description>
|
||||||
|
<EN>Limits the frame rate when the game is paused.</EN>
|
||||||
|
</Description>
|
||||||
|
<Version>1.0.0.2</Version>
|
||||||
|
</Mod>
|
169
frame_limiter.csproj
Normal file
169
frame_limiter.csproj
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.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')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProjectGuid>{53821041-E269-4717-BAED-3C9C6836E83F}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>frame_limiter</RootNamespace>
|
||||||
|
<AssemblyName>frame_limiter</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>Mod\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="BaseModLib">
|
||||||
|
<HintPath>../../../libs/BaseModLib.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Assembly-CSharp-firstpass">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Assembly-CSharp-firstpass.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Assembly-CSharp">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Assembly-CSharp.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Assembly-UnityScript-firstpass">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Assembly-UnityScript-firstpass.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Assembly-UnityScript">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Assembly-UnityScript.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="bolt">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/bolt.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="bolt.user">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/bolt.user.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="SteamworksManaged">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/SteamworksManaged.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Boo.Lang">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Boo.Lang.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.Security">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Mono.Security.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityScript.Lang">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/UnityScript.Lang.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Boo.Lang">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Boo.Lang.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.Posix">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Mono.Posix.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mono.Security">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Mono.Security.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="mscorlib">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/mscorlib.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Pathfinding.ClipperLib">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.ClipperLib.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Pathfinding.Ionic.Zip.Reduced">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.Ionic.Zip.Reduced.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Pathfinding.JsonFx">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.JsonFx.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Pathfinding.Poly2Tri">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Pathfinding.Poly2Tri.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PlayMaker">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/PlayMaker.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Rewired_Core">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/Rewired_Core.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Configuration">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/System.Configuration.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Core">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/System.Core.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/System.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/System.Security.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/System.Xml.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="TheForest.Commons">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/TheForest.Commons.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="TheForest.Modding">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/TheForest.Modding.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/UnityEngine.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.Networking">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/UnityEngine.Networking.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.UI">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/UnityEngine.UI.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityScript.Lang">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/UnityScript.Lang.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="udpkit">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/udpkit.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="udpkit.common">
|
||||||
|
<HintPath>../../../modlib/TheForest/TheForest_data/Managed/udpkit.common.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="FrameLimiter.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
18
frame_limiter.sln
Normal file
18
frame_limiter.sln
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user