Skip to content

Commit 8813f77

Browse files
committed
3.0 (Headlights & Compass)
- Option to make compass constantly active - Option to make headlights on by default
1 parent 5ca5172 commit 8813f77

8 files changed

Lines changed: 85 additions & 2 deletions

File tree

Distance.LittleThings/ConfigLogic.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ public bool EnableQuarantineInArcade
1818
get { return Get<bool>("EnableQuarantineInArcade"); }
1919
set { Set("EnableQuarantineInArcade", value); }
2020
}
21+
22+
public bool EnableHeadLights
23+
{
24+
get { return Get<bool>("EnableHeadLights"); }
25+
set { Set("EnableHeadLights", value); }
26+
}
27+
28+
public bool ActiveCompass
29+
{
30+
get { return Get<bool>("ActiveCompass"); }
31+
set { Set("ActiveCompass", value); }
32+
}
2133
#endregion
2234

2335
internal Settings Config;
@@ -36,6 +48,8 @@ public void Awake()
3648
//Setting Defaults
3749
Get("EnableGPSInArcade", true);
3850
Get("EnableQuarantineInArcade", true);
51+
Get("EnableHeadLights", false);
52+
Get("ActiveCompass", false);
3953
//Save settings to Config.json
4054
Save();
4155
}

Distance.LittleThings/Distance.LittleThings.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@
9191
</ItemGroup>
9292
<ItemGroup>
9393
<Compile Include="ConfigLogic.cs" />
94+
<Compile Include="Harmony\Assembly-CSharp\CarScreenLogic\OnEventGo.cs" />
95+
<Compile Include="Harmony\Assembly-CSharp\CarScreenLogic\UpdateBeforeRender.cs" />
9496
<Compile Include="Harmony\Assembly-CSharp\GPSTrigger\Start.cs" />
9597
<Compile Include="Harmony\Assembly-CSharp\LocalPlayerControlledCar\CheckInput.cs" />
98+
<Compile Include="Harmony\Assembly-CSharp\LocalPlayerControlledCar\Start.cs" />
9699
<Compile Include="Harmony\Assembly-CSharp\QuarantineTrigger\Start.cs" />
97100
<Compile Include="Mod.cs" />
98101
<Compile Include="Properties\AssemblyInfo.cs" />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using HarmonyLib;
2+
3+
namespace Distance.LittleThings.Harmony
4+
{
5+
[HarmonyPatch(typeof(CarScreenLogic), "OnEventGo")]
6+
internal class CarScreenLogic__OnEventGo
7+
{
8+
[HarmonyPrefix]
9+
internal static bool DisablePlacementText(CarScreenLogic __instance)
10+
{
11+
if (Mod.Instance.Config.ActiveCompass)
12+
{
13+
//Literally just skip the method if active compass is on
14+
__instance.ModeWidgetVisible_ = true;
15+
return false;
16+
}
17+
else
18+
return true;
19+
}
20+
}
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using HarmonyLib;
2+
3+
namespace Distance.LittleThings.Harmony
4+
{
5+
[HarmonyPatch(typeof(CarScreenLogic), "UpdateBeforeRender")]
6+
internal class CarScreenLogic__UpdateBeforeRender
7+
{
8+
[HarmonyPostfix]
9+
internal static void KeepCompassActive(CarScreenLogic __instance)
10+
{
11+
if(Mod.Instance.Config.ActiveCompass)
12+
{
13+
__instance.SetCurrentModeVisual(__instance.compass_);
14+
}
15+
}
16+
}
17+
}

Distance.LittleThings/Harmony/Assembly-CSharp/LocalPlayerControlledCar/CheckInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Distance.LittleThings.Harmony
66
{
77
[HarmonyPatch(typeof(LocalPlayerControlledCar), "CheckInput")]
8-
internal class CheckInput
8+
internal class LocalPlayerControlledCar__CheckInput
99
{
1010
[HarmonyPrefix]
1111
internal static bool GPSCheck(LocalPlayerControlledCar __instance, InputStates inputStates, float dt)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using HarmonyLib;
2+
3+
namespace Distance.LittleThings.Harmony
4+
{
5+
[HarmonyPatch(typeof(LocalPlayerControlledCar), "Start")]
6+
internal class LocalPlayerControlledCar__Start
7+
{
8+
[HarmonyPostfix]
9+
internal static void HeadlightsCheck(LocalPlayerControlledCar __instance)
10+
{
11+
if (Mod.Instance.Config.EnableHeadLights)
12+
{
13+
//Hardcoded cause I'm cringe. Didn't feel like building menu values to manipulate
14+
__instance.carLogic_.carVisuals_.SetHeadlightsValues(1f, 100f, 150f, .5f, false);
15+
}
16+
}
17+
}
18+
}

Distance.LittleThings/Harmony/Assembly-CSharp/QuarantineTrigger/Start.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Distance.LittleThings.Harmony
44
{
55
[HarmonyPatch(typeof(QuarantineTrigger), "Start")]
6-
internal class Start
6+
internal class QuarantineTrigger__Start
77
{
88
[HarmonyPrefix]
99
internal static bool StartRewrite(QuarantineTrigger __instance)

Distance.LittleThings/Mod.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ private void CreateSettingsMenu()
9292
.WithGetter(() => Config.EnableQuarantineInArcade)
9393
.WithSetter((x) => Config.EnableQuarantineInArcade = x)
9494
.WithDescription("Toggles whether Quarantine zones will activate in arcade mode"),
95+
96+
new CheckBox(MenuDisplayMode.Both, "settings::headlights_enable", "ENABLE HEADLIGHTS")
97+
.WithGetter(() => Config.EnableHeadLights)
98+
.WithSetter((x) => Config.EnableHeadLights = x)
99+
.WithDescription("Toggles whether head lights are always active on the car, just like the Beta days!"),
100+
101+
new CheckBox(MenuDisplayMode.Both, "settings::active_compass", "PERMANENT COMPASS")
102+
.WithGetter(() => Config.ActiveCompass)
103+
.WithSetter((x) => Config.ActiveCompass = x)
104+
.WithDescription("The compass will always stay active on the carscreen and never change"),
95105
};
96106

97107
Menus.AddNew(MenuDisplayMode.Both, settingsMenu, "LITTLE THINGS", "Settings for the LittleThings mod");

0 commit comments

Comments
 (0)