This commit is contained in:
Lachlan Leone
2023-03-13 18:31:52 +11:00
parent 15cf2cfcbf
commit cc0ced82f9
17 changed files with 235 additions and 443 deletions
+7
View File
@@ -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.
+8 -65
View File
@@ -2,80 +2,23 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<Configurations>BepInEx;Workshop</Configurations> <LangVersion>latest</LangVersion>
<AssemblyName>$(MSBuildProjectName)-$(Configuration)</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="0Harmony"> <PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.6.16" />
<HintPath>..\..\..\..\Libraries\0Harmony.dll</HintPath> </ItemGroup>
</Reference>
<ItemGroup>
<Reference Include="Discord"> <Reference Include="Discord">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Discord.dll</HintPath> <HintPath>H:\SteamLibrary\steamapps\common\PlateUp\PlateUp\PlateUp_Data\Managed\Discord.dll</HintPath>
</Reference> </Reference>
<Reference Include="Facepunch.Steamworks.Win64"> <Reference Include="Facepunch.Steamworks.Win64">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath> <HintPath>H:\SteamLibrary\steamapps\common\PlateUp\PlateUp\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
</Reference> </Reference>
<Reference Include="Kitchen.Common"> <Reference Include="KitchenLib-Workshop">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Common.dll</HintPath>
</Reference>
<Reference Include="Kitchen.FranchiseBuilderMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.FranchiseBuilderMode.dll</HintPath>
</Reference>
<Reference Include="Kitchen.FranchiseMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.FranchiseMode.dll</HintPath>
</Reference>
<Reference Include="Kitchen.GameData">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.GameData.dll</HintPath>
</Reference>
<Reference Include="Kitchen.Layouts">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Layouts.dll</HintPath>
</Reference>
<Reference Include="Kitchen.Networking">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Networking.dll</HintPath>
</Reference>
<Reference Include="Kitchen.Persistence">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.Persistence.dll</HintPath>
</Reference>
<Reference Include="Kitchen.PostgameMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.PostgameMode.dll</HintPath>
</Reference>
<Reference Include="Kitchen.ResearchMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.ResearchMode.dll</HintPath>
</Reference>
<Reference Include="Kitchen.RestaurantMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.RestaurantMode.dll</HintPath>
</Reference>
<Reference Include="Kitchen.TutorialMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Kitchen.TutorialMode.dll</HintPath>
</Reference>
<Reference Include="KitchenLib-Workshop" Condition="'$(Configuration)'=='Workshop'">
<HintPath>..\..\..\..\Libraries\KitchenLib\KitchenLib-Workshop.dll</HintPath> <HintPath>..\..\..\..\Libraries\KitchenLib\KitchenLib-Workshop.dll</HintPath>
</Reference> </Reference>
<Reference Include="KitchenLib-BepInEx" Condition="'$(Configuration)'=='BepInEx'">
<HintPath>..\..\..\..\Libraries\KitchenLib\KitchenLib-BepInEx.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\..\Libraries\BepInEx\core\BepInEx.dll</HintPath>
</Reference>
<Reference Include="KitchenMode">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\KitchenMode.dll</HintPath>
</Reference>
<Reference Include="KitchenMods">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\KitchenMods.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Sirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="Unity.Entities">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Unity.Entities.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
</Project> </Project>
+35 -62
View File
@@ -1,90 +1,63 @@
using KitchenLib; using Kitchen;
using System.Reflection; using KitchenLib;
using KitchenLib.Utils;
using UnityEngine;
using System;
using Kitchen;
using KitchenLib.Event; using KitchenLib.Event;
using MMOKitchen.Menus; using KitchenLib.Preferences;
#if BEPINEX
using BepInEx;
#endif
#if WORKSHOP
using KitchenMods; 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 class Main : BaseMod
{ {
public const string MOD_ID = "mmokitchen"; public const string MOD_ID = "mmokitchen";
public const string MOD_NAME = "MMO Kitchen"; public const string MOD_NAME = "MMO Kitchen";
public const string MOD_AUTHOR = "StarFluxGames"; public const string MOD_AUTHOR = "StarFluxGames";
public const string MOD_VERSION = "0.1.6"; public const string MOD_VERSION = "0.1.7";
public const string MOD_COMPATIBLE_VERSIONS = "1.1.2"; public const string MOD_COMPATIBLE_VERSIONS = "=<1.1.4";
public const string CONSENT_REQUIRED_ID = "requiredConsent"; public static PreferenceManager manager;
public int RequiredConsentPercentage;
public Main() : base(MOD_ID, MOD_NAME, MOD_AUTHOR, MOD_VERSION, MOD_COMPATIBLE_VERSIONS, Assembly.GetExecutingAssembly()) { } 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) protected override void OnPostActivate(Mod mod)
#endif
{ {
KitchenLib.IntPreference requiredConsent = PreferenceUtils.Register<KitchenLib.IntPreference>(MOD_ID, CONSENT_REQUIRED_ID, "Required Consent Percentage"); manager = new PreferenceManager(MOD_ID);
requiredConsent.Value = 50; manager.RegisterPreference(new PreferenceInt("requiredConsentPercentage", 100));
PreferenceUtils.Load(); manager.Load();
RequiredConsentPercentage = PreferenceUtils.Get<KitchenLib.IntPreference>(MOD_ID, CONSENT_REQUIRED_ID).Value;
SetupPreferences();
}
public static Texture2D LoadImage(string base64) ModsPreferencesMenu<PauseMenuAction>.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu<PauseMenuAction>), typeof(PauseMenuAction));
Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) =>
{ {
byte[] bytes = Convert.FromBase64String(base64); args.Menus.Add(typeof(PreferenceMenu<PauseMenuAction>), new PreferenceMenu<PauseMenuAction>(args.Container, args.Module_list));
Texture2D image = ResourceUtils.LoadTextureRaw(bytes);
return image;
}
private void SetupPreferences()
{
Events.PreferenceMenu_MainMenu_SetupEvent += (s, args) =>
{
Type type = args.instance.GetType().GetGenericArguments()[0];
args.mInfo.Invoke(args.instance, new object[] { MOD_NAME, typeof(MMOKitchenPreferences<>).MakeGenericType(type), false });
}; };
ModsPreferencesMenu<MainMenuAction>.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu<MainMenuAction>), typeof(MainMenuAction));
Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) => Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) =>
{ {
args.Menus.Add(typeof(MMOKitchenPreferences<MainMenuAction>), new MMOKitchenPreferences<MainMenuAction>(args.Container, args.Module_list)); args.Menus.Add(typeof(PreferenceMenu<MainMenuAction>), new PreferenceMenu<MainMenuAction>(args.Container, args.Module_list));
}; };
}
//Setting Up For Pause Menu [MethodImpl(MethodImplOptions.AggressiveInlining)]
Events.PreferenceMenu_PauseMenu_SetupEvent += (s, args) => internal static void LogInfo(string message)
{ {
Type type = args.instance.GetType().GetGenericArguments()[0]; Debug.Log($"[{MOD_NAME}] " + message);
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<PauseMenuAction>), new MMOKitchenPreferences<PauseMenuAction>(args.Container, args.Module_list));
};
Events.PreferencesSaveEvent += (s, args) => [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogWarning(string message)
{ {
int consentPercentage = PreferenceUtils.Get<KitchenLib.IntPreference>(MOD_ID, CONSENT_REQUIRED_ID).Value; Debug.LogWarning($"[{MOD_NAME}] " + message);
RequiredConsentPercentage = consentPercentage; }
};
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void LogError(string message)
{
Debug.LogError($"[{MOD_NAME}] " + message);
} }
} }
} }
-50
View File
@@ -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<T> : KLMenu<T>
{
public MMOKitchenPreferences(Transform container, ModuleList module_list) : base(container, module_list)
{
}
public override void Setup(int player_id)
{
this.Percentage = new Option<int>(
new List<int>
{
25, 50, 75, 100
},
PreferenceUtils.Get<KitchenLib.IntPreference>(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value,
new List<string>
{
"25%", "50%", "75%", "100%"
});
AddLabel("Required Consent Percentage");
Add<int>(this.Percentage).OnChanged += delegate (object _, int f)
{
PreferenceUtils.Get<KitchenLib.IntPreference>(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value = f;
};
New<SpacerElement>();
New<SpacerElement>();
AddButton("Apply", delegate
{
PreferenceUtils.Save();
});
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate
{
RequestPreviousMenu();
});
}
private Option<int> Percentage;
}
}
+36
View File
@@ -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<T> : KLMenu<T>
{
public PreferenceMenu(Transform container, ModuleList module_list) : base(container, module_list)
{
}
public override void Setup(int player_id)
{
AddLabel("Required Consent Percentage");
AddSelect<int>(requiredPercentage);
requiredPercentage.OnChanged += delegate (object _, int result)
{
Main.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Set(result);
};
New<SpacerElement>(true);
New<SpacerElement>(true);
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i)
{
Main.manager.Save();
this.RequestPreviousMenu();
}, 0, 1f, 0.2f);
}
private Option<int> requiredPercentage = new Option<int>(new List<int> { 25, 50, 75, 100 }, Main.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Get(), new List<string> { "25%", "50%", "75%", "100%" });
}
}
+9 -6
View File
@@ -1,16 +1,13 @@
using HarmonyLib; using HarmonyLib;
using Kitchen; using Kitchen;
using Kitchen.Modules; using Kitchen.Modules;
using KitchenLib.Preferences;
using KitchenLib.Utils; using KitchenLib.Utils;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace MMOKitchen.Patches namespace MMOKitchenReborn.Patches
{ {
[HarmonyPatch(typeof(ConsentElement), "Update")] [HarmonyPatch(typeof(ConsentElement), "Update")]
public class ConsentElement_Patch public class ConsentElement_Patch
@@ -18,6 +15,12 @@ namespace MMOKitchen.Patches
public static bool Prefix(ConsentElement __instance) 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 updateBar = ReflectionUtils.GetMethod<ConsentElement>("UpdateBar");
MethodInfo getProgressSpeed = ReflectionUtils.GetMethod<ConsentElement>("GetProgressSpeed"); MethodInfo getProgressSpeed = ReflectionUtils.GetMethod<ConsentElement>("GetProgressSpeed");
FieldInfo progress = ReflectionUtils.GetField<ConsentElement>("Progress"); FieldInfo progress = ReflectionUtils.GetField<ConsentElement>("Progress");
@@ -34,7 +37,7 @@ namespace MMOKitchen.Patches
float progressSpeed = (float)getProgressSpeed.Invoke(__instance, new object[] { }); 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; progressSpeed = 1f;
if (progressSpeed <= 0f) if (progressSpeed <= 0f)
@@ -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;
}
}
}
-61
View File
@@ -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);
}
}
}
@@ -1,14 +1,15 @@
using HarmonyLib; using HarmonyLib;
using Discord;
using Kitchen.NetworkSupport; using Kitchen.NetworkSupport;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection.Emit; using System.Reflection.Emit;
namespace MMOKitchen namespace MMOKitchenReborn.Patches
{ {
/*
* This patch is used to change how many players can join the lobby using Discord.
*/
[HarmonyPatch(typeof(DiscordPlatform))] [HarmonyPatch(typeof(DiscordPlatform), "CreateNewLobby")]
[HarmonyPatch("CreateNewLobby")]
public static class DiscordPlatform_Patch public static class DiscordPlatform_Patch
{ {
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -21,5 +22,4 @@ namespace MMOKitchen
return codes; 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");
}
}
}
-29
View File
@@ -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==");
}
}
}
+17
View File
@@ -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);
}
}
}
+14 -9
View File
@@ -1,12 +1,17 @@
using HarmonyLib; using HarmonyLib;
using System.Reflection;
using Steamworks;
using Kitchen.NetworkSupport; using Kitchen.NetworkSupport;
using System.Threading.Tasks; using Steamworks;
using System;
using Steamworks.Data; using Steamworks.Data;
namespace MMOKitchen using System;
using System.Reflection;
using System.Threading.Tasks;
namespace MMOKitchenReborn.Patches
{ {
/*
* This patch is used to change how many players can join the lobby using Steam.
*/
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")] [HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
public class SteamPlatform_Patch public class SteamPlatform_Patch
{ {
@@ -14,7 +19,7 @@ namespace MMOKitchen
{ {
if (__instance.IsReady) if (__instance.IsReady)
{ {
SteamMatchmaking.CreateLobbyAsync(12).ContinueWith(delegate(Task<Lobby?> task) SteamMatchmaking.CreateLobbyAsync(12).ContinueWith(delegate (Task<Lobby?> task)
{ {
if (task.IsCompleted && task.Result != null) if (task.IsCompleted && task.Result != null)
{ {
@@ -24,7 +29,8 @@ namespace MMOKitchen
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions"); MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions");
performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions }); performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions });
callback(true, valueOrDefault); callback(true, valueOrDefault);
}else }
else
{ {
callback(false, default(Lobby)); callback(false, default(Lobby));
} }
@@ -33,5 +39,4 @@ namespace MMOKitchen
return false; return false;
} }
} }
} }
@@ -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<Entity> nativeArray = query.ToEntityArray(Allocator.Temp);
for (int i = 0; i < nativeArray.Length; i++)
{
EntityManager.RemoveComponent<COwnedByPlayer>(nativeArray[i]);
}
}
private EntityQuery query;
}
}