v0.1.7
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Kitchen.Modules;
|
||||
using KitchenLib.Preferences;
|
||||
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
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(ConsentElement), "Update")]
|
||||
public class ConsentElement_Patch
|
||||
@@ -18,6 +15,12 @@ namespace MMOKitchen.Patches
|
||||
public static bool Prefix(ConsentElement __instance)
|
||||
{
|
||||
|
||||
PlayerManager pm = Unity.Entities.World.DefaultGameObjectInjectionWorld.GetExistingSystem<PlayerManager>();
|
||||
if (pm == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
MethodInfo updateBar = ReflectionUtils.GetMethod<ConsentElement>("UpdateBar");
|
||||
MethodInfo getProgressSpeed = ReflectionUtils.GetMethod<ConsentElement>("GetProgressSpeed");
|
||||
FieldInfo progress = ReflectionUtils.GetField<ConsentElement>("Progress");
|
||||
@@ -34,14 +37,14 @@ namespace MMOKitchen.Patches
|
||||
|
||||
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)
|
||||
if ((((float)counter / (float)x.Count) * 100) >= Main.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").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[] { });
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Unity.Entities;
|
||||
using System.Reflection;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
using KitchenData;
|
||||
using Unity.Collections;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(CreateBedrooms), "OnUpdate")]
|
||||
public class CreateBedrooms_Patch
|
||||
{
|
||||
public static bool Prefix(CreateBedrooms __instance)
|
||||
{
|
||||
MethodInfo createAssigned = ReflectionUtils.GetMethod<CreateBedrooms>("CreateAssigned");
|
||||
MethodInfo placeSpawnMarker = ReflectionUtils.GetMethod<CreateBedrooms>("PlaceSpawnMarker");
|
||||
MethodInfo getComponent = ReflectionUtils.GetMethod<CreateBedrooms>("GetComponent").MakeGenericMethod(typeof(CPlayer));
|
||||
FieldInfo players = ReflectionUtils.GetField<CreateBedrooms>("Players");
|
||||
NativeArray<Entity> nativeArray = ((EntityQuery)players.GetValue(__instance)).ToEntityArray(Allocator.Temp);
|
||||
Vector3[] array = new Vector3[]
|
||||
{
|
||||
new Vector3(9f, 0f, 5f),
|
||||
new Vector3(9f, 0f, 2f),
|
||||
new Vector3(9f, 0f, -3f),
|
||||
new Vector3(9f, 0f, -6f),
|
||||
new Vector3(14f, 0f, 5f),
|
||||
new Vector3(14f, 0f, 2f),
|
||||
new Vector3(14f, 0f, -3f),
|
||||
new Vector3(14f, 0f, -6f),
|
||||
new Vector3(-12f, 0f, 5f),
|
||||
new Vector3(-12f, 0f, 2f),
|
||||
new Vector3(-12f, 0f, -3f),
|
||||
new Vector3(-12f, 0f, -6f)
|
||||
};
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Entity target = (Entity)createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get<Appliance>(AssetReference.Bed), array[i] + new Vector3(0f, 0f, 0f), Vector3.forward });
|
||||
Entity entity = (Entity)createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get<Appliance>(AssetReference.InteractionProxy), array[i] + new Vector3(0f, 0f, 0f), Vector3.forward });
|
||||
EntityUtils.GetEntityManager().AddComponentData<CInteractionProxy>(entity, new CInteractionProxy
|
||||
{
|
||||
Target = target,
|
||||
IsActive = true
|
||||
});
|
||||
createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get<Appliance>(AssetReference.OutfitStation), array[i] + new Vector3(-2f, 0f, 1f), Vector3.forward });
|
||||
createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get<Appliance>(AssetReference.CosmeticStation), array[i] + new Vector3(-2f, 0f, -1f), Vector3.forward });
|
||||
createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get<Appliance>(AssetReference.ColourStation), array[i] + new Vector3(-3f, 0f, 1f), Vector3.forward });
|
||||
createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get<Appliance>(AssetReference.OccupationIndicator), array[i] + new Vector3(1f, 0f, 0f), Vector3.forward });
|
||||
placeSpawnMarker.Invoke(__instance, new object[] { i, array[i] + new Vector3(-1f, 0f, 0f) });
|
||||
foreach (Entity entity2 in nativeArray)
|
||||
{
|
||||
bool flag = i == ((CPlayer)getComponent.Invoke(__instance, new object[] { entity2 })).Index;
|
||||
if (flag)
|
||||
{
|
||||
EntityUtils.GetEntityManager().SetComponentData<CPosition>(entity2, new CPosition(array[i] + new Vector3(-1f, 0f, 0f)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
nativeArray.Dispose();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Unity.Entities;
|
||||
using System.Reflection;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using KitchenData;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(CreateGarage), "OnUpdate")]
|
||||
public class CreateGarage_Patch
|
||||
{
|
||||
public static bool Prefix(CreateGarage __instance)
|
||||
{
|
||||
MethodInfo create = AccessTools.Method(typeof(CreateGarage), "Create", new Type[] {typeof(Appliance), typeof(Vector3), typeof(Vector3)});
|
||||
FieldInfo crates = ReflectionUtils.GetField<CreateGarage>("Crates");
|
||||
|
||||
GameObject garageDecorations = GameObjectUtils.GetChildObject(GameData.Main.Get<Appliance>(AssetReference.GarageDecorations).Prefab, "LoadoutDoor");
|
||||
GameObject doorLight = GameObjectUtils.GetChildObject(GameData.Main.Get<Appliance>(AssetReference.GarageDecorations).Prefab, "Door Light");
|
||||
doorLight.SetActive(false);
|
||||
garageDecorations.SetActive(false);
|
||||
create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.GarageDecorations), new Vector3(-8f, 0f, -2f), Vector3.forward});
|
||||
|
||||
Entity entity = default(Entity);
|
||||
entity = (Entity)create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.LoadoutPedestal), new Vector3(-8.5f, 0f, -4f), Vector3.right});
|
||||
EntityUtils.GetEntityManager().AddComponent<CItemPedestal>(entity);
|
||||
entity = (Entity)create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.LoadoutPedestal), new Vector3(-9.5f, 0f, -4f), Vector3.right});
|
||||
EntityUtils.GetEntityManager().AddComponent<CItemPedestal>(entity);
|
||||
bool isEmpty = ((EntityQuery)crates.GetValue(__instance)).IsEmpty;
|
||||
if (!isEmpty)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
bool flag = i == 2;
|
||||
if (!flag)
|
||||
{
|
||||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
Vector3 facing = (j % 2 == 1) ? Vector3.forward : Vector3.back;
|
||||
Entity entity2 = (Entity)create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.GarageShelf), new Vector3((float)(-5 - i), 0f, (float)(1 - j)), facing});
|
||||
EntityUtils.GetEntityManager().AddComponentData<CPersistentItemStorageLocation>(entity2, new CPersistentItemStorageLocation
|
||||
{
|
||||
Type = PersistentStorageType.Crate
|
||||
});
|
||||
bool flag2 = j % 2 == 1;
|
||||
if (flag2)
|
||||
{
|
||||
create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.GarageDivider), new Vector3((float)(-5 - i), 0f, (float)(1 - j)), Vector3.forward});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(DifficultyHelpers))]
|
||||
public class DifficultyHelpers_Patch
|
||||
{
|
||||
[HarmonyPatch("CustomerPlayersRateModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void CustomerPlayersRateModifier_Postfix(ref float __result, int player_count)
|
||||
{
|
||||
__result = 1 + (player_count * 0.25f);
|
||||
}
|
||||
|
||||
[HarmonyPatch("FireSpreadModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void FireSpreadModifier_Postfix(ref float __result, int player_count)
|
||||
{
|
||||
__result = 0.75f + (player_count * 0.25f);
|
||||
}
|
||||
|
||||
[HarmonyPatch("PatiencePlayerCountModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void PatiencePlayerCountModifier_Postfix(ref float __result, int player_count)
|
||||
{
|
||||
__result = 0.75f + (player_count * 0.25f);
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -1,14 +1,15 @@
|
||||
using HarmonyLib;
|
||||
using Discord;
|
||||
using HarmonyLib;
|
||||
using Kitchen.NetworkSupport;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace MMOKitchen
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(DiscordPlatform))]
|
||||
[HarmonyPatch("CreateNewLobby")]
|
||||
/*
|
||||
* This patch is used to change how many players can join the lobby using Discord.
|
||||
*/
|
||||
|
||||
[HarmonyPatch(typeof(DiscordPlatform), "CreateNewLobby")]
|
||||
public static class DiscordPlatform_Patch
|
||||
{
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
@@ -21,5 +22,4 @@ namespace MMOKitchen
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
using Kitchen.Layouts.Modules;
|
||||
using System.IO;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(FeaturesFromTexture), "ActOn")]
|
||||
public class FeaturesFromTexture_Patch
|
||||
{
|
||||
public static void Prefix(NewFromTexture __instance)
|
||||
{
|
||||
__instance.SourceTexture = Main.LoadImage("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAMUExURQD/ACQA/+nKIQAAAOiZT8gAAAAEdFJOU////wBAKqn0AAAACXBIWXMAAA6/AAAOvwE4BVMkAAAAS0lEQVQoU52MUQ4AIAhCU+9/5yzLbFJb8YGOJxa56geXlpqBixBkTLRjtRH0QXR6vrapDWe9tCE2RcQ8zdu52eRYJ7iAJfAc64pFKggsBTc0VJH0AAAAAElFTkSuQmCC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(LayoutBuilder), "BuildWallBetween")]
|
||||
public class LayoutBuilder_Patch
|
||||
{
|
||||
public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using Kitchen.Layouts.Modules;
|
||||
using Kitchen;
|
||||
using System.Reflection;
|
||||
using Unity.Entities;
|
||||
using KitchenLib.Utils;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(NewFromTexture), "ActOn")]
|
||||
public class NewFromTexture_Patch
|
||||
{
|
||||
public static void Prefix(NewFromTexture __instance)
|
||||
{
|
||||
PlayerManager playerManager = World.DefaultGameObjectInjectionWorld.GetExistingSystem<PlayerManager>();
|
||||
FieldInfo finfo = typeof(PlayerManager).GetField("MaxPlayers", BindingFlags.Instance | BindingFlags.Public);
|
||||
finfo.SetValue(playerManager, 12);
|
||||
|
||||
__instance.SourceTexture = Main.LoadImage("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAhUExURe0cJIgAFTHf77eA6hbzSv9/J//yAIC66hY68//JDgAAANY41qIAAAALdFJOU/////////////8ASk8B8gAAAAlwSFlzAAAOvwAADr8BOAVTJAAAAF1JREFUKFOl0UkOgDAMQ9Gamdz/wMRuQCVIgOAtIuG/qih2qxA66d1A0KhE3/PoUgY08qSMSiNPm6M5jTxFnzkfnvLkIs87aOR5lReJeMqru2SNPD+zWbyhFb/TbAPTUQgZqLo2tAAAAABJRU5ErkJggg==");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerManager), "Initialise")]
|
||||
public class PlayerManager_Patch
|
||||
{
|
||||
static void Prefix(PlayerManager __instance)
|
||||
{
|
||||
FieldInfo maxPlayers = ReflectionUtils.GetField<PlayerManager>("MaxPlayers");
|
||||
maxPlayers.SetValue(__instance, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,42 @@
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using Steamworks;
|
||||
using HarmonyLib;
|
||||
using Kitchen.NetworkSupport;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using Steamworks;
|
||||
using Steamworks.Data;
|
||||
namespace MMOKitchen
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
|
||||
public class SteamPlatform_Patch
|
||||
{
|
||||
public static bool Prefix(SteamPlatform __instance, Action<bool, Lobby> callback)
|
||||
{
|
||||
if (__instance.IsReady)
|
||||
{
|
||||
SteamMatchmaking.CreateLobbyAsync(12).ContinueWith(delegate(Task<Lobby?> task)
|
||||
{
|
||||
if (task.IsCompleted && task.Result != null)
|
||||
{
|
||||
Lobby valueOrDefault = task.Result.GetValueOrDefault();
|
||||
__instance.CurrentInviteLobby = valueOrDefault;
|
||||
|
||||
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions");
|
||||
performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions });
|
||||
/*
|
||||
* This patch is used to change how many players can join the lobby using Steam.
|
||||
*/
|
||||
|
||||
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
|
||||
public class SteamPlatform_Patch
|
||||
{
|
||||
public static bool Prefix(SteamPlatform __instance, Action<bool, Lobby> callback)
|
||||
{
|
||||
if (__instance.IsReady)
|
||||
{
|
||||
SteamMatchmaking.CreateLobbyAsync(12).ContinueWith(delegate (Task<Lobby?> task)
|
||||
{
|
||||
if (task.IsCompleted && task.Result != null)
|
||||
{
|
||||
Lobby valueOrDefault = task.Result.GetValueOrDefault();
|
||||
__instance.CurrentInviteLobby = valueOrDefault;
|
||||
|
||||
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions");
|
||||
performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions });
|
||||
callback(true, valueOrDefault);
|
||||
}else
|
||||
{
|
||||
callback(false, default(Lobby));
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(false, default(Lobby));
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user