v0.1.6
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Kitchen.Modules;
|
||||
using KitchenLib.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchen.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(ConsentElement), "Update")]
|
||||
public class ConsentElement_Patch
|
||||
{
|
||||
public static bool Prefix(ConsentElement __instance)
|
||||
{
|
||||
|
||||
MethodInfo updateBar = ReflectionUtils.GetMethod<ConsentElement>("UpdateBar");
|
||||
MethodInfo getProgressSpeed = ReflectionUtils.GetMethod<ConsentElement>("GetProgressSpeed");
|
||||
FieldInfo progress = ReflectionUtils.GetField<ConsentElement>("Progress");
|
||||
PropertyInfo isCompleted = AccessTools.Property(typeof(ConsentElement), "IsCompleted");
|
||||
|
||||
FieldInfo consentsSwap = ReflectionUtils.GetField<ConsentElement>("ConsentsSwap");
|
||||
|
||||
Dictionary<int, bool> x = (Dictionary<int, bool>)consentsSwap.GetValue(__instance);
|
||||
|
||||
int counter = 0;
|
||||
foreach (int y in x.Keys)
|
||||
if (x[y])
|
||||
counter++;
|
||||
|
||||
float progressSpeed = (float)getProgressSpeed.Invoke(__instance, new object[] { });
|
||||
|
||||
if ((((float)counter / (float)x.Count) * 100) >= PreferenceUtils.Get<KitchenLib.IntPreference>(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value)
|
||||
progressSpeed = 1f;
|
||||
|
||||
if (progressSpeed <= 0f)
|
||||
progress.SetValue(__instance, (float)progress.GetValue(__instance) - (2f * Time.unscaledDeltaTime));
|
||||
else
|
||||
progress.SetValue(__instance, (float)progress.GetValue(__instance) + (progressSpeed * Time.unscaledDeltaTime));
|
||||
|
||||
isCompleted.SetValue(__instance, ((float)progress.GetValue(__instance) >= 1f));
|
||||
progress.SetValue(__instance, Mathf.Clamp01((float)progress.GetValue(__instance)));
|
||||
updateBar.Invoke(__instance, new object[] { });
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace MMOKitchen
|
||||
{
|
||||
public static void Prefix(NewFromTexture __instance)
|
||||
{
|
||||
__instance.SourceTexture = Main.LoadImage("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAMUExURQD/ACQA/+nKIQAAAOiZT8gAAAAEdFJOU////wBAKqn0AAAACXBIWXMAAA6/AAAOvwE4BVMkAAAASUlEQVQoU52MyQ0AIAgEBfrv2StcYTXReSAyLE2u/Og2p7uAjTComihrZ32ITse9U5KuvKSh3kTFrMXSNTkxPV6wAUPgOOaqRToQCQU9rUN4jgAAAABJRU5ErkJggg==");
|
||||
__instance.SourceTexture = Main.LoadImage("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAMUExURQD/ACQA/+nKIQAAAOiZT8gAAAAEdFJOU////wBAKqn0AAAACXBIWXMAAA6/AAAOvwE4BVMkAAAAS0lEQVQoU52MUQ4AIAhCU+9/5yzLbFJb8YGOJxa56geXlpqBixBkTLRjtRH0QXR6vrapDWe9tCE2RcQ8zdu52eRYJ7iAJfAc64pFKggsBTc0VJH0AAAAAElFTkSuQmCC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(LayoutBuilder), "BuildWallBetween")]
|
||||
|
||||
[HarmonyPatch(typeof(LayoutBuilder), "BuildWallBetween")]
|
||||
public class LayoutBuilder_Patch
|
||||
{
|
||||
public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2)
|
||||
{
|
||||
if ((tile1 == new Vector2(-11, -5) && tile2 == new Vector2(-10, -5))
|
||||
|| (tile1 == new Vector2(-11, -6) && tile2 == new Vector2(-10, -6))
|
||||
|| (tile1 == new Vector2(-11, -7) && tile2 == new Vector2(-10, -7))
|
||||
|| (tile1 == new Vector2(-11, -8) && tile2 == new Vector2(-10, -8)))
|
||||
return false;
|
||||
{
|
||||
if (__instance.Blueprint.ID == 4771956)
|
||||
{
|
||||
if ((tile1 == new Vector2(-11, -5) && tile2 == new Vector2(-10, -5))
|
||||
|| (tile1 == new Vector2(-11, -6) && tile2 == new Vector2(-10, -6))
|
||||
|| (tile1 == new Vector2(-11, -7) && tile2 == new Vector2(-10, -7))
|
||||
|| (tile1 == new Vector2(-11, -8) && tile2 == new Vector2(-10, -8)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user