JustJelly-AudibleDistanceLib icon

AudibleDistanceLib

A small library for audible distance determination.

Last updated a year ago
Total downloads 39820
Total rating 1 
Categories Libraries
Dependency string JustJelly-AudibleDistanceLib-0.0.0
Dependants 78 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

AudibleDistanceLib

A small library for audible distance determination.

Usage

Example

using static AudibleDistanceLib.AudibleDistanceLib;

[HarmonyPrefix]
[HarmonyPatch(nameof(AudioSource.PlayOneShotHelper), new[] { typeof(AudioSource), typeof(AudioClip), typeof(float) })]
public static void PlayOneShotHelper_Prefix(AudioSource source, ref AudioClip clip, float volumeScale)
{
    if (IsInWithinAudiableDistance(GameNetworkManager.Instance, audioSource, volumeScale, minimumAudibleVolume: 12f))
    {
        // do something
    }
}