From c15ed3b21d6f5501ba13a39d74e0d919b2975ad3 Mon Sep 17 00:00:00 2001 From: Lachlan Leone Date: Wed, 2 Nov 2022 00:00:11 +1100 Subject: [PATCH] v0.1.1 Fixed Steam Lobby bug, Fixed players unable to access main room --- MMOKitchen/MMOKitchen.csproj | 3 ++ MMOKitchen/Patches/CreateBedrooms_Patch.cs | 16 ++++---- MMOKitchen/Patches/CreateGarage_Patch.cs | 2 +- MMOKitchen/Patches/LayoutBuilder_Patch.cs | 6 ++- MMOKitchen/Patches/SteamPlatform_Patch.cs | 45 ++++++++++++++++++++++ MMOKitchen/Properties/AssemblyInfo.cs | 2 +- 6 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 MMOKitchen/Patches/SteamPlatform_Patch.cs diff --git a/MMOKitchen/MMOKitchen.csproj b/MMOKitchen/MMOKitchen.csproj index 958c48c..a114674 100644 --- a/MMOKitchen/MMOKitchen.csproj +++ b/MMOKitchen/MMOKitchen.csproj @@ -70,6 +70,9 @@ $(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.AudioModule.dll + + $(PlateUpGameFolder)\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll + $(PlateUpGameFolder)\Mods\KitchenLib.dll diff --git a/MMOKitchen/Patches/CreateBedrooms_Patch.cs b/MMOKitchen/Patches/CreateBedrooms_Patch.cs index 9409608..1b601ed 100644 --- a/MMOKitchen/Patches/CreateBedrooms_Patch.cs +++ b/MMOKitchen/Patches/CreateBedrooms_Patch.cs @@ -25,14 +25,14 @@ namespace MMOKitchen 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) + new Vector3(13f, 0f, 5f), + new Vector3(13f, 0f, 2f), + new Vector3(13f, 0f, -3f), + new Vector3(13f, 0f, -6f), + new Vector3(-11f, 0f, 5f), + new Vector3(-11f, 0f, 2f), + new Vector3(-11f, 0f, -3f), + new Vector3(-11f, 0f, -6f) }; for (int i = 0; i < 12; i++) { diff --git a/MMOKitchen/Patches/CreateGarage_Patch.cs b/MMOKitchen/Patches/CreateGarage_Patch.cs index 93c0bfb..334ce98 100644 --- a/MMOKitchen/Patches/CreateGarage_Patch.cs +++ b/MMOKitchen/Patches/CreateGarage_Patch.cs @@ -23,7 +23,7 @@ namespace MMOKitchen garageDecorations.SetActive(false); create.Invoke(__instance, new object[]{GameData.Main.Get(AssetReference.GarageDecorations), new Vector3(-8f, 0f, -2f), Vector3.forward}); - Mod.Log(GameData.Main.Get(AssetReference.GarageDecorations).Prefab.name); + //Mod.Log(GameData.Main.Get(AssetReference.GarageDecorations).Prefab.name); Entity entity = default(Entity); entity = (Entity)create.Invoke(__instance, new object[]{GameData.Main.Get(AssetReference.LoadoutPedestal), new Vector3(-8.5f, 0f, -4f), Vector3.right}); EntityUtils.GetEntityManager().AddComponent(entity); diff --git a/MMOKitchen/Patches/LayoutBuilder_Patch.cs b/MMOKitchen/Patches/LayoutBuilder_Patch.cs index 27124fe..d857181 100644 --- a/MMOKitchen/Patches/LayoutBuilder_Patch.cs +++ b/MMOKitchen/Patches/LayoutBuilder_Patch.cs @@ -9,7 +9,11 @@ namespace MMOKitchen { public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2) { - if (tile1 == new Vector2(-11, -5) || tile1 == new Vector2(-11, -6)) + //Mod.Log(tile1.ToString() + "," + tile2.ToString()); + 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; } diff --git a/MMOKitchen/Patches/SteamPlatform_Patch.cs b/MMOKitchen/Patches/SteamPlatform_Patch.cs new file mode 100644 index 0000000..2d1899b --- /dev/null +++ b/MMOKitchen/Patches/SteamPlatform_Patch.cs @@ -0,0 +1,45 @@ +using HarmonyLib; +using UnityEngine; +using Kitchen.Layouts.Modules; +using Kitchen; +using System.Reflection; +using Unity.Entities; +using KitchenLib.Utils; +using System.IO; +using Steamworks; +using Kitchen.NetworkSupport; +using System.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.Linq; +using Kitchen.Transports; +using Steamworks.Data; +namespace MMOKitchen +{ + [HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")] + public class SteamPlatform_Patch + { + public static bool Prefix(SteamPlatform __instance, Action callback) + { + if (__instance.IsReady) + { + SteamMatchmaking.CreateLobbyAsync(12).ContinueWith(delegate(Task task) + { + if (task.IsCompleted && task.Result != null) + { + Lobby valueOrDefault = task.Result.GetValueOrDefault(); + __instance.CurrentInviteLobby = valueOrDefault; + //Reflection Stuff + MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions"); + performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions }); + callback(true, valueOrDefault); + }else + { + callback(false, default(Lobby)); + } + }); + } + return false; + } + } +} \ No newline at end of file diff --git a/MMOKitchen/Properties/AssemblyInfo.cs b/MMOKitchen/Properties/AssemblyInfo.cs index 66aa71a..a6abecc 100644 --- a/MMOKitchen/Properties/AssemblyInfo.cs +++ b/MMOKitchen/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ using MelonLoader; -[assembly: MelonInfo(typeof(MMOKitchen.Mod), "MMO Kitchen", "0.1.0", "StarFluxGames")] +[assembly: MelonInfo(typeof(MMOKitchen.Mod), "MMO Kitchen", "0.1.1", "StarFluxGames")] [assembly: MelonGame("It's Happening", "PlateUp")] \ No newline at end of file