Skip to content

Commit 0d76155

Browse files
FreecamRoll mod
1 parent 43aa3cc commit 0d76155

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

FreecamRoll/FreecamRoll.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31912.275
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreecamRoll", "FreecamRoll\FreecamRoll.csproj", "{D29C74F4-013B-4266-A666-3CD03FF9DB34}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D29C74F4-013B-4266-A666-3CD03FF9DB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D29C74F4-013B-4266-A666-3CD03FF9DB34}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D29C74F4-013B-4266-A666-3CD03FF9DB34}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D29C74F4-013B-4266-A666-3CD03FF9DB34}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {4C59D5F4-5110-4C65-AF0B-D931D8F69C10}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using HarmonyLib;
2+
using UnityEngine;
3+
4+
namespace FreecamRoll
5+
{
6+
[HarmonyPatch(typeof(FreecamController))]
7+
internal static class FreecamControllerPatches
8+
{
9+
[HarmonyPatch(nameof(FreecamController.Update))]
10+
internal static void FreecamControllerUpdatePostfix(FreecamController __instance)
11+
{
12+
float rollDelta = 0;
13+
if (Input.GetKey(KeyCode.Q)) rollDelta = -1;
14+
else if (Input.GetKey(KeyCode.E)) rollDelta = 1;
15+
rollDelta *= Main.sensitivity;
16+
rollDelta *= Time.deltaTime;
17+
__instance.tr.localEulerAngles += new Vector3(0, 0, rollDelta);
18+
}
19+
}
20+
}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net472</TargetFramework>
5+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<Reference Include="0Harmony">
10+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\BepInEx\core\0Harmony.dll</HintPath>
11+
</Reference>
12+
<Reference Include="Assembly-CSharp">
13+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\Subnautica_Data\Managed\publicized_assemblies\Assembly-CSharp_publicized.dll</HintPath>
14+
</Reference>
15+
<Reference Include="Assembly-CSharp-firstpass">
16+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\Subnautica_Data\Managed\publicized_assemblies\Assembly-CSharp-firstpass_publicized.dll</HintPath>
17+
</Reference>
18+
<Reference Include="QModInstaller">
19+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\BepInEx\plugins\QModManager\QModInstaller.dll</HintPath>
20+
</Reference>
21+
<Reference Include="UnityEngine.CoreModule">
22+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\Subnautica_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
23+
</Reference>
24+
<Reference Include="UnityEngine.InputLegacyModule">
25+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\Subnautica_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
26+
</Reference>
27+
<Reference Include="UnityEngine.InputModule">
28+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica.stable\Subnautica_Data\Managed\UnityEngine.InputModule.dll</HintPath>
29+
</Reference>
30+
</ItemGroup>
31+
32+
</Project>

FreecamRoll/FreecamRoll/Main.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using QModManager.API.ModLoading;
2+
using HarmonyLib;
3+
using System.Reflection;
4+
5+
namespace FreecamRoll
6+
{
7+
[QModCore]
8+
public static class Main
9+
{
10+
public static float sensitivity = 160;
11+
12+
[QModPatch]
13+
public static void Patch()
14+
{
15+
var harmony = new Harmony("Lee23.FreecamRoll");
16+
harmony.PatchAll(Assembly.GetExecutingAssembly());
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)