Skip to content

Commit

Permalink
feat: Vibrate on airhorn
Browse files Browse the repository at this point in the history
I am so sorry people, i got paid 5 euros to add this
  • Loading branch information
bananasov committed Jan 14, 2024
1 parent f7213c0 commit 79e25d1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions LethalVibrations/Buttplug/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ internal class Config
internal static ConfigEntry<float> RoundSurvivalDuration { get; set; }
internal static ConfigEntry<float> RoundSurvivalStrength { get; set; }
#endregion

#region Airhorn config entries
internal static ConfigEntry<bool> AirhornEnabled { get; set; }
internal static ConfigEntry<float> AirhornDuration { get; set; }
internal static ConfigEntry<float> AirhornStrength { get; set; }
#endregion

static Config()
{
Expand Down Expand Up @@ -112,6 +118,10 @@ static Config()
VibrateScreenShakeEnabled = ConfigFile.Bind("Vibrations.ShakeScreen", "Enabled", true, "Vibrate when your screen shakes");
VibrateScreenShakeDuration = ConfigFile.Bind("Vibrations.ShakeScreen", "Duration", 1.0f, "Length of time to vibrate for");
VibrateScreenShakeAmplifier = ConfigFile.Bind("Vibrations.ShakeScreen", "Amplifier", 0.0f, "Change the amplification of vibration");

AirhornEnabled = ConfigFile.Bind("Vibrations.Airhorn", "Enabled", true, "Vibrate when someone airs the horn");
AirhornDuration = ConfigFile.Bind("Vibrations.Airhorn", "Duration", 1.0f, "Length of time to vibrate for");
AirhornStrength = ConfigFile.Bind("Vibrations.Airhorn", "Strength", 0.1f, "Change the amplification of vibration");
}
}
}
23 changes: 23 additions & 0 deletions LethalVibrations/Patches/NoisemakerProp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using HarmonyLib;
using LethalVibrations.Buttplug;

namespace LethalVibrations.Patches
{
internal class NoisemakerPropPatches
{
[HarmonyPatch(typeof(NoisemakerProp), "ItemActivate")]
[HarmonyPostfix]
private static void ChargeItemPatch(NoisemakerProp __instance)
{
Plugin.Mls.LogDebug($"NoisemakerProp.ItemActivate got called: {__instance.itemProperties.itemName}");

if (__instance.itemProperties.itemName != "Airhorn")
return;

if (Plugin.DeviceManager.IsConnected() && Config.AirhornEnabled.Value)
{
Plugin.DeviceManager.VibrateConnectedDevices(Config.AirhornStrength.Value, Config.AirhornDuration.Value);
}
}
}
}
1 change: 1 addition & 0 deletions LethalVibrations/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private void Awake()
harmony.PatchAll(typeof(Patches.HUDManagerPatches));
harmony.PatchAll(typeof(Patches.GrabbableObjectPatches));
harmony.PatchAll(typeof(Patches.RoundManagerPatches));
harmony.PatchAll(typeof(Patches.NoisemakerPropPatches));

Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_NAME} ({PluginInfo.PLUGIN_VERSION}) is loaded!");
}
Expand Down

0 comments on commit 79e25d1

Please sign in to comment.