diff --git a/MMOKitchen/Changelog.MD b/MMOKitchen/Changelogs/v0.1.6.MD similarity index 100% rename from MMOKitchen/Changelog.MD rename to MMOKitchen/Changelogs/v0.1.6.MD diff --git a/MMOKitchen/Changelogs/v0.1.7.MD b/MMOKitchen/Changelogs/v0.1.7.MD new file mode 100644 index 0000000..c9f6e16 --- /dev/null +++ b/MMOKitchen/Changelogs/v0.1.7.MD @@ -0,0 +1,7 @@ +# Release Notes v0.1.7 + +- Lobby is nolonger larger than normal. +- Players can now interact with eachother's Outfit/Cosmetic/Color selectors. +- Democratic Voting is now host dependent. +- Difficulty now scales above 4 players. +- Possible fix for more than 4 local players. \ No newline at end of file diff --git a/MMOKitchen/MMOKitchen.csproj b/MMOKitchen/MMOKitchen.csproj index a2329a8..1701095 100644 --- a/MMOKitchen/MMOKitchen.csproj +++ b/MMOKitchen/MMOKitchen.csproj @@ -1,81 +1,24 @@  - - net472 - BepInEx;Workshop - $(MSBuildProjectName)-$(Configuration) - + + net472 + latest + - - - ..\..\..\..\Libraries\0Harmony.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Discord.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Common.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.FranchiseBuilderMode.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.FranchiseMode.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.GameData.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Layouts.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Networking.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Persistence.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.PostgameMode.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.ResearchMode.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.RestaurantMode.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.TutorialMode.dll - - - ..\..\..\..\Libraries\KitchenLib\KitchenLib-Workshop.dll - - - ..\..\..\..\Libraries\KitchenLib\KitchenLib-BepInEx.dll - - - ..\..\..\..\Libraries\BepInEx\core\BepInEx.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\KitchenMode.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\KitchenMods.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Sirenix.Serialization.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\Unity.Entities.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\UnityEngine.dll - - - ..\..\..\..\Libraries\PlateUp_Data\Managed\UnityEngine.CoreModule.dll - - + + + + + + + H:\SteamLibrary\steamapps\common\PlateUp\PlateUp\PlateUp_Data\Managed\Discord.dll + + + H:\SteamLibrary\steamapps\common\PlateUp\PlateUp\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll + + + ..\..\..\..\Libraries\KitchenLib\KitchenLib-Workshop.dll + + diff --git a/MMOKitchen/Main.cs b/MMOKitchen/Main.cs index 20ab262..5dd0581 100644 --- a/MMOKitchen/Main.cs +++ b/MMOKitchen/Main.cs @@ -1,90 +1,63 @@ -using KitchenLib; -using System.Reflection; -using KitchenLib.Utils; -using UnityEngine; -using System; -using Kitchen; +using Kitchen; +using KitchenLib; using KitchenLib.Event; -using MMOKitchen.Menus; - -#if BEPINEX -using BepInEx; -#endif -#if WORKSHOP +using KitchenLib.Preferences; using KitchenMods; -#endif +using MMOKitchenReborn.Menus; +using System.Reflection; +using System.Runtime.CompilerServices; +using UnityEngine; -namespace MMOKitchen +namespace MMOKitchenReborn { -#if BEPINEX - [BepInProcess("PlateUp.exe")] - [BepInPlugin(MOD_ID, MOD_NAME, MOD_VERSION)] -#endif public class Main : BaseMod { public const string MOD_ID = "mmokitchen"; public const string MOD_NAME = "MMO Kitchen"; public const string MOD_AUTHOR = "StarFluxGames"; - public const string MOD_VERSION = "0.1.6"; - public const string MOD_COMPATIBLE_VERSIONS = "1.1.2"; + public const string MOD_VERSION = "0.1.7"; + public const string MOD_COMPATIBLE_VERSIONS = "=<1.1.4"; - public const string CONSENT_REQUIRED_ID = "requiredConsent"; - - public int RequiredConsentPercentage; + public static PreferenceManager manager; public Main() : base(MOD_ID, MOD_NAME, MOD_AUTHOR, MOD_VERSION, MOD_COMPATIBLE_VERSIONS, Assembly.GetExecutingAssembly()) { } -#if BEPINEX - protected override void OnInitialise() -#endif -#if WORKSHOP protected override void OnPostActivate(Mod mod) -#endif { - KitchenLib.IntPreference requiredConsent = PreferenceUtils.Register(MOD_ID, CONSENT_REQUIRED_ID, "Required Consent Percentage"); - requiredConsent.Value = 50; - PreferenceUtils.Load(); - RequiredConsentPercentage = PreferenceUtils.Get(MOD_ID, CONSENT_REQUIRED_ID).Value; - SetupPreferences(); - } + manager = new PreferenceManager(MOD_ID); + manager.RegisterPreference(new PreferenceInt("requiredConsentPercentage", 100)); + manager.Load(); - public static Texture2D LoadImage(string base64) - { - byte[] bytes = Convert.FromBase64String(base64); + ModsPreferencesMenu.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu), typeof(PauseMenuAction)); - Texture2D image = ResourceUtils.LoadTextureRaw(bytes); - - return image; - } - - private void SetupPreferences() - { - Events.PreferenceMenu_MainMenu_SetupEvent += (s, args) => + Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) => { - Type type = args.instance.GetType().GetGenericArguments()[0]; - args.mInfo.Invoke(args.instance, new object[] { MOD_NAME, typeof(MMOKitchenPreferences<>).MakeGenericType(type), false }); + args.Menus.Add(typeof(PreferenceMenu), new PreferenceMenu(args.Container, args.Module_list)); }; + ModsPreferencesMenu.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu), typeof(MainMenuAction)); + Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) => { - args.Menus.Add(typeof(MMOKitchenPreferences), new MMOKitchenPreferences(args.Container, args.Module_list)); + args.Menus.Add(typeof(PreferenceMenu), new PreferenceMenu(args.Container, args.Module_list)); }; + } - //Setting Up For Pause Menu - Events.PreferenceMenu_PauseMenu_SetupEvent += (s, args) => - { - Type type = args.instance.GetType().GetGenericArguments()[0]; - args.mInfo.Invoke(args.instance, new object[] { MOD_NAME, typeof(MMOKitchenPreferences<>).MakeGenericType(type), false }); - }; - Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) => - { - args.Menus.Add(typeof(MMOKitchenPreferences), new MMOKitchenPreferences(args.Container, args.Module_list)); - }; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void LogInfo(string message) + { + Debug.Log($"[{MOD_NAME}] " + message); + } - Events.PreferencesSaveEvent += (s, args) => - { - int consentPercentage = PreferenceUtils.Get(MOD_ID, CONSENT_REQUIRED_ID).Value; - RequiredConsentPercentage = consentPercentage; - }; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void LogWarning(string message) + { + Debug.LogWarning($"[{MOD_NAME}] " + message); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static void LogError(string message) + { + Debug.LogError($"[{MOD_NAME}] " + message); } } } \ No newline at end of file diff --git a/MMOKitchen/Menus/MMOKitchenPreferences.cs b/MMOKitchen/Menus/MMOKitchenPreferences.cs deleted file mode 100644 index d7d5cb3..0000000 --- a/MMOKitchen/Menus/MMOKitchenPreferences.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Kitchen.Modules; -using Kitchen; -using KitchenLib.Utils; -using KitchenLib; -using System.Collections.Generic; -using UnityEngine; - -namespace MMOKitchen.Menus -{ - public class MMOKitchenPreferences : KLMenu - { - public MMOKitchenPreferences(Transform container, ModuleList module_list) : base(container, module_list) - { - } - public override void Setup(int player_id) - { - this.Percentage = new Option( - new List - { - 25, 50, 75, 100 - }, - PreferenceUtils.Get(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value, - new List - { - "25%", "50%", "75%", "100%" - }); - - AddLabel("Required Consent Percentage"); - Add(this.Percentage).OnChanged += delegate (object _, int f) - { - PreferenceUtils.Get(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value = f; - }; - - New(); - New(); - - AddButton("Apply", delegate - { - PreferenceUtils.Save(); - }); - - AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate - { - RequestPreviousMenu(); - }); - } - - private Option Percentage; - } -} diff --git a/MMOKitchen/Menus/PreferenceMenu.cs b/MMOKitchen/Menus/PreferenceMenu.cs new file mode 100644 index 0000000..f30dfa2 --- /dev/null +++ b/MMOKitchen/Menus/PreferenceMenu.cs @@ -0,0 +1,36 @@ +using Kitchen; +using Kitchen.Modules; +using KitchenLib; +using KitchenLib.Preferences; +using System.Collections.Generic; +using UnityEngine; + +namespace MMOKitchenReborn.Menus +{ + public class PreferenceMenu : KLMenu + { + public PreferenceMenu(Transform container, ModuleList module_list) : base(container, module_list) + { + } + + public override void Setup(int player_id) + { + AddLabel("Required Consent Percentage"); + AddSelect(requiredPercentage); + requiredPercentage.OnChanged += delegate (object _, int result) + { + Main.manager.GetPreference("requiredConsentPercentage").Set(result); + }; + + New(true); + New(true); + + AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i) + { + Main.manager.Save(); + this.RequestPreviousMenu(); + }, 0, 1f, 0.2f); + } + private Option requiredPercentage = new Option(new List { 25, 50, 75, 100 }, Main.manager.GetPreference("requiredConsentPercentage").Get(), new List { "25%", "50%", "75%", "100%" }); + } +} diff --git a/MMOKitchen/Patches/ConsentElement_Patch.cs b/MMOKitchen/Patches/ConsentElement_Patch.cs index 29c92f2..a214348 100644 --- a/MMOKitchen/Patches/ConsentElement_Patch.cs +++ b/MMOKitchen/Patches/ConsentElement_Patch.cs @@ -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(); + if (pm == null) + { + return true; + } + MethodInfo updateBar = ReflectionUtils.GetMethod("UpdateBar"); MethodInfo getProgressSpeed = ReflectionUtils.GetMethod("GetProgressSpeed"); FieldInfo progress = ReflectionUtils.GetField("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(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value) + if ((((float)counter / (float)x.Count) * 100) >= Main.manager.GetPreference("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[] { }); diff --git a/MMOKitchen/Patches/CreateBedrooms_Patch.cs b/MMOKitchen/Patches/CreateBedrooms_Patch.cs deleted file mode 100644 index 20d9acc..0000000 --- a/MMOKitchen/Patches/CreateBedrooms_Patch.cs +++ /dev/null @@ -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("CreateAssigned"); - MethodInfo placeSpawnMarker = ReflectionUtils.GetMethod("PlaceSpawnMarker"); - MethodInfo getComponent = ReflectionUtils.GetMethod("GetComponent").MakeGenericMethod(typeof(CPlayer)); - FieldInfo players = ReflectionUtils.GetField("Players"); - NativeArray 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(AssetReference.Bed), array[i] + new Vector3(0f, 0f, 0f), Vector3.forward }); - Entity entity = (Entity)createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get(AssetReference.InteractionProxy), array[i] + new Vector3(0f, 0f, 0f), Vector3.forward }); - EntityUtils.GetEntityManager().AddComponentData(entity, new CInteractionProxy - { - Target = target, - IsActive = true - }); - createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get(AssetReference.OutfitStation), array[i] + new Vector3(-2f, 0f, 1f), Vector3.forward }); - createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get(AssetReference.CosmeticStation), array[i] + new Vector3(-2f, 0f, -1f), Vector3.forward }); - createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get(AssetReference.ColourStation), array[i] + new Vector3(-3f, 0f, 1f), Vector3.forward }); - createAssigned.Invoke(__instance, new object[] { i, GameData.Main.Get(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(entity2, new CPosition(array[i] + new Vector3(-1f, 0f, 0f))); - break; - } - } - } - nativeArray.Dispose(); - return false; - } - } - -} \ No newline at end of file diff --git a/MMOKitchen/Patches/CreateGarage_Patch.cs b/MMOKitchen/Patches/CreateGarage_Patch.cs deleted file mode 100644 index a3b042c..0000000 --- a/MMOKitchen/Patches/CreateGarage_Patch.cs +++ /dev/null @@ -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("Crates"); - - GameObject garageDecorations = GameObjectUtils.GetChildObject(GameData.Main.Get(AssetReference.GarageDecorations).Prefab, "LoadoutDoor"); - GameObject doorLight = GameObjectUtils.GetChildObject(GameData.Main.Get(AssetReference.GarageDecorations).Prefab, "Door Light"); - doorLight.SetActive(false); - garageDecorations.SetActive(false); - create.Invoke(__instance, new object[]{GameData.Main.Get(AssetReference.GarageDecorations), new Vector3(-8f, 0f, -2f), Vector3.forward}); - - 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); - entity = (Entity)create.Invoke(__instance, new object[]{GameData.Main.Get(AssetReference.LoadoutPedestal), new Vector3(-9.5f, 0f, -4f), Vector3.right}); - EntityUtils.GetEntityManager().AddComponent(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(AssetReference.GarageShelf), new Vector3((float)(-5 - i), 0f, (float)(1 - j)), facing}); - EntityUtils.GetEntityManager().AddComponentData(entity2, new CPersistentItemStorageLocation - { - Type = PersistentStorageType.Crate - }); - bool flag2 = j % 2 == 1; - if (flag2) - { - create.Invoke(__instance, new object[]{GameData.Main.Get(AssetReference.GarageDivider), new Vector3((float)(-5 - i), 0f, (float)(1 - j)), Vector3.forward}); - } - } - } - } - } - return false; - } - } - -} \ No newline at end of file diff --git a/MMOKitchen/Patches/DifficultyHelpers_Patch.cs b/MMOKitchen/Patches/DifficultyHelpers_Patch.cs new file mode 100644 index 0000000..b3f12cf --- /dev/null +++ b/MMOKitchen/Patches/DifficultyHelpers_Patch.cs @@ -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); + } + } +} diff --git a/MMOKitchen/Patches/LobbyTransaction_Patch.cs b/MMOKitchen/Patches/DiscordPlatform_Patch.cs similarity index 67% rename from MMOKitchen/Patches/LobbyTransaction_Patch.cs rename to MMOKitchen/Patches/DiscordPlatform_Patch.cs index bfc70e6..9be2e3d 100644 --- a/MMOKitchen/Patches/LobbyTransaction_Patch.cs +++ b/MMOKitchen/Patches/DiscordPlatform_Patch.cs @@ -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 Transpiler(IEnumerable instructions) @@ -21,5 +22,4 @@ namespace MMOKitchen return codes; } } - -} \ No newline at end of file +} diff --git a/MMOKitchen/Patches/FeaturesFromTexture_Patch.cs b/MMOKitchen/Patches/FeaturesFromTexture_Patch.cs deleted file mode 100644 index 0fa0693..0000000 --- a/MMOKitchen/Patches/FeaturesFromTexture_Patch.cs +++ /dev/null @@ -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"); - } - } - -} \ No newline at end of file diff --git a/MMOKitchen/Patches/LayoutBuilder_Patch.cs b/MMOKitchen/Patches/LayoutBuilder_Patch.cs deleted file mode 100644 index 35ced92..0000000 --- a/MMOKitchen/Patches/LayoutBuilder_Patch.cs +++ /dev/null @@ -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; - } - } - -} \ No newline at end of file diff --git a/MMOKitchen/Patches/NewFromTexture_Patch.cs b/MMOKitchen/Patches/NewFromTexture_Patch.cs deleted file mode 100644 index fba8ef9..0000000 --- a/MMOKitchen/Patches/NewFromTexture_Patch.cs +++ /dev/null @@ -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(); - 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=="); - } - } - -} \ No newline at end of file diff --git a/MMOKitchen/Patches/PlayerManager_Patch.cs b/MMOKitchen/Patches/PlayerManager_Patch.cs new file mode 100644 index 0000000..fe130ff --- /dev/null +++ b/MMOKitchen/Patches/PlayerManager_Patch.cs @@ -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("MaxPlayers"); + maxPlayers.SetValue(__instance, 12); + } + } +} diff --git a/MMOKitchen/Patches/SteamPlatform_Patch.cs b/MMOKitchen/Patches/SteamPlatform_Patch.cs index c4effec..5874346 100644 --- a/MMOKitchen/Patches/SteamPlatform_Patch.cs +++ b/MMOKitchen/Patches/SteamPlatform_Patch.cs @@ -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 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; - - 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 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; + + 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 + } + else + { + callback(false, default(Lobby)); + } + }); + } + return false; + } + } +} diff --git a/MMOKitchen/Systems/MakeOwnedAppliancesPublic.cs b/MMOKitchen/Systems/MakeOwnedAppliancesPublic.cs new file mode 100644 index 0000000..cd93861 --- /dev/null +++ b/MMOKitchen/Systems/MakeOwnedAppliancesPublic.cs @@ -0,0 +1,33 @@ +using Kitchen; +using Unity.Collections; +using Unity.Entities; + +namespace MMOKitchenReborn.Systems +{ + public class MakeOwnedAppliancesPublic : GenericSystemBase + { + protected override void Initialise() + { + base.Initialise(); + this.query = GetEntityQuery(new EntityQueryDesc + { + All = new ComponentType[] + { + typeof(COwnedByPlayer) + } + }); + } + + protected override void OnUpdate() + { + NativeArray nativeArray = query.ToEntityArray(Allocator.Temp); + + for (int i = 0; i < nativeArray.Length; i++) + { + EntityManager.RemoveComponent(nativeArray[i]); + } + } + + private EntityQuery query; + } +}