81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
using System;
|
|
using BepInEx;
|
|
using BepInEx.Configuration;
|
|
using BepInEx.Logging;
|
|
using BepInEx.Unity.IL2CPP;
|
|
using HarmonyLib;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
namespace BetterStuff;
|
|
|
|
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
|
|
public class Plugin : BasePlugin
|
|
{
|
|
internal static new ManualLogSource Log;
|
|
|
|
private static ConfigEntry<float> scanTimeMin;
|
|
private static ConfigEntry<float> scanTimeMax;
|
|
private static ConfigEntry<float> finishDuration;
|
|
private static ConfigEntry<float> timeAfterScans;
|
|
|
|
private static ConfigEntry<float> restockerSpeed;
|
|
|
|
public override void Load()
|
|
{
|
|
// Plugin startup logic
|
|
Log = base.Log;
|
|
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
|
|
|
|
Plugin.scanTimeMin = Config.Bind("Cashier Scantime", "min", 0.2f);
|
|
Plugin.scanTimeMax = Config.Bind("Cashier Scantime", "max", 0.8f);
|
|
Plugin.finishDuration = Config.Bind("Cashier PaymentTime", "FinishingDuration", 1f);
|
|
Plugin.timeAfterScans = Config.Bind("Cashier PaymentTime", "TimeAfterAllScans", 0.5f);
|
|
|
|
Plugin.restockerSpeed = Config.Bind("Restocker", "Speed", 5f);
|
|
|
|
Harmony harmony = new(MyPluginInfo.PLUGIN_GUID);
|
|
harmony.PatchAll();
|
|
}
|
|
|
|
public static class CashierPatch
|
|
{
|
|
[HarmonyPatch(typeof(Cashier), "Start")]
|
|
public static class Cashier_Start_Patch
|
|
{
|
|
[HarmonyPostfix]
|
|
public static void Postfix(Cashier __instance)
|
|
{
|
|
__instance.ScanningInterval = UnityEngine.Random.Range(Plugin.scanTimeMin.Value, Plugin.scanTimeMax.Value);
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(Checkout), "FinishedScanning")]
|
|
public static class Cashier_Checkout_Patch
|
|
{
|
|
[HarmonyPostfix]
|
|
public static void Postfix(Checkout __instance)
|
|
{
|
|
__instance.m_AutomatedCheckout.m_FinishingPaymentDuration = Plugin.finishDuration.Value;
|
|
__instance.m_AutomatedCheckout.m_IntervalAfterScanningAll = Plugin.timeAfterScans.Value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class RestockerPatch
|
|
{
|
|
[HarmonyPatch(typeof(Restocker), "Start")]
|
|
public static class Restocker_Start_Patch
|
|
{
|
|
[HarmonyPostfix]
|
|
public static void Postfix(Restocker __instance)
|
|
{
|
|
__instance.m_Agent.speed = Plugin.restockerSpeed.Value;
|
|
__instance.m_Agent.acceleration *= 200f;
|
|
__instance.m_Agent.angularSpeed *= 200f;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|