RSR update

This commit is contained in:
SamSWAT 2023-02-06 23:13:20 +03:00
parent f74ad87802
commit 1cee7c22ae
8 changed files with 28 additions and 29 deletions

View File

@ -1,7 +1,7 @@
using System.Reflection;
using Aki.Bundles.Models;
using Aki.Bundles.Utils;
using Aki.Common.Utils;
using Aki.Custom.Models;
using Aki.Custom.Utils;
using Aki.Reflection.Patching;
using Newtonsoft.Json.Linq;

View File

@ -32,8 +32,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="aki-bundles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\aki-bundles.dll</HintPath>
<Reference Include="aki-custom">
<HintPath>..\..\References\aki-custom.dll</HintPath>
</Reference>
<Reference Include="Aki.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Aki.Common.dll</HintPath>
@ -44,6 +44,9 @@
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\References\BepInEx.dll</HintPath>
</Reference>
<Reference Include="BepInEx, Version=5.4.21.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\BepInEx.dll</HintPath>
</Reference>

View File

@ -34,7 +34,7 @@ namespace SamSWAT.SixthSense
new Patch().Enable();
string uri = "file://" + (BepInEx.Paths.PluginPath + "/SamSWAT.SixthSense/audio.ogg").Replace("\\", "/");
using (UnityWebRequest web = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.OGGVORBIS))
using (var web = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.OGGVORBIS))
{
var asyncOperation = web.SendWebRequest();
@ -55,7 +55,7 @@ namespace SamSWAT.SixthSense
public class Patch : ModulePatch
{
private static float nextTime = 0;
private static float nextTime;
protected override MethodBase GetTargetMethod()
{
@ -65,23 +65,19 @@ namespace SamSWAT.SixthSense
[PatchPostfix]
public static void PatchPostfix(BotOwner bot)
{
if (Plugin.PluginEnabled.Value && Plugin.AudioClip != null && Time.time > nextTime)
{
if (!Plugin.PluginEnabled.Value || Plugin.AudioClip == null || Time.time < nextTime) return;
//GClass442 goalEnemy = bot.Memory.GoalEnemy;
object goalEnemy = bot.Memory.GetType().GetProperty("GoalEnemy").GetValue(bot.Memory);
if (goalEnemy != null)
{
if (goalEnemy == null) return;
IAIDetails person = (IAIDetails)goalEnemy.GetType().GetProperty("Person").GetValue(goalEnemy);
bool isVisible = (bool)goalEnemy.GetType().GetProperty("IsVisible").GetValue(goalEnemy);
if (person.GetPlayer.IsYourPlayer && isVisible)
{
if (!person.GetPlayer.IsYourPlayer || !isVisible) return;
Singleton<GUISounds>.Instance.PlaySound(Plugin.AudioClip);
nextTime = Time.time + Plugin.Cooldown.Value;
}
}
}
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
References/aki-custom.dll Normal file

Binary file not shown.