1.2.0 update

This commit is contained in:
Lachlan Leone
2024-08-10 05:00:57 +10:00
parent 35d3fec3de
commit bb53c03b40
4 changed files with 30 additions and 41 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.10.21" /> <PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.11.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+10 -12
View File
@@ -6,6 +6,7 @@ using Kitchen;
using KitchenLib.Event; using KitchenLib.Event;
using KitchenLib.Preferences; using KitchenLib.Preferences;
using MMOKitchen.Menus; using MMOKitchen.Menus;
using KitchenLogger = KitchenLib.Logging.KitchenLogger;
namespace MMOKitchen namespace MMOKitchen
{ {
@@ -13,9 +14,9 @@ namespace MMOKitchen
{ {
public const string MOD_GUID = "com.starfluxgames.mmokitchen"; public const string MOD_GUID = "com.starfluxgames.mmokitchen";
public const string MOD_NAME = "MMO Kitchen"; public const string MOD_NAME = "MMO Kitchen";
public const string MOD_VERSION = "0.3.0"; public const string MOD_VERSION = "0.3.1";
public const string MOD_AUTHOR = "StarFluxGames"; public const string MOD_AUTHOR = "StarFluxGames";
public const string MOD_GAMEVERSION = ">=1.1.9"; public const string MOD_GAMEVERSION = ">=1.2.0";
public static KitchenLogger Logger; public static KitchenLogger Logger;
public static PreferenceManager manager; public static PreferenceManager manager;
@@ -41,19 +42,16 @@ namespace MMOKitchen
manager.RegisterPreference(new PreferenceBool("scaleAbove4Players", false)); manager.RegisterPreference(new PreferenceBool("scaleAbove4Players", false));
manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f)); manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f));
manager.Load(); manager.Load();
ModsPreferencesMenu<PauseMenuAction>.RegisterMenu(MOD_NAME, typeof(PreferenceMenu<PauseMenuAction>), typeof(PauseMenuAction)); ModsPreferencesMenu<MenuAction>.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu<MenuAction>), typeof(MenuAction));
ModsPreferencesMenu<MenuAction>.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu<MenuAction>), typeof(MenuAction));
Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) => Events.MainMenuView_SetupMenusEvent += (s, args) =>
{ {
args.Menus.Add(typeof(PreferenceMenu<PauseMenuAction>), new PreferenceMenu<PauseMenuAction>(args.Container, args.Module_list)); args.addMenu.Invoke(args.instance, new object[] { typeof(PreferenceMenu<MenuAction>), new PreferenceMenu<MenuAction>(args.instance.ButtonContainer, args.module_list) });
}; };
Events.PlayerPauseView_SetupMenusEvent += (s, args) =>
ModsPreferencesMenu<MainMenuAction>.RegisterMenu(MOD_NAME, typeof(PreferenceMenu<MainMenuAction>), typeof(MainMenuAction));
Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) =>
{ {
args.Menus.Add(typeof(PreferenceMenu<MainMenuAction>), new PreferenceMenu<MainMenuAction>(args.Container, args.Module_list)); args.addMenu.Invoke(args.instance, new object[] { typeof(PreferenceMenu<MenuAction>), new PreferenceMenu<MenuAction>(args.instance.ButtonContainer, args.module_list) });
}; };
} }
} }
+18 -27
View File
@@ -1,42 +1,33 @@
using HarmonyLib; using HarmonyLib;
using Kitchen.NetworkSupport; using Kitchen.NetworkSupport;
using Steamworks;
using Steamworks.Data;
using System; using System;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Reflection.Emit;
namespace MMOKitchen.Patches namespace MMOKitchen.Patches
{ {
/* /*
* This patch is used to change how many players can join the lobby using Steam. * This patch is used to change how many players can join the lobby using Steam.
*/ */
[HarmonyPatch(typeof(SteamPlatform))]
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
public class SteamPlatformPatch public class SteamPlatformPatch
{ {
public static bool Prefix(SteamPlatform __instance, Action<bool, Lobby> callback) private static MethodBase TargetMethod()
{ {
if (__instance.IsReady) Type type = AccessTools.FirstInner(typeof(SteamPlatform), t => t.Name.Contains("<CreateNewLobby>d__26"));
{ return AccessTools.FirstMethod(type, method => method.Name.Contains("MoveNext"));
SteamMatchmaking.CreateLobbyAsync(Mod.MaxPlayers).ContinueWith(delegate (Task<Lobby?> task) }
{ [HarmonyTranspiler]
if (task.IsCompleted && task.Result != null) private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{ {
Lobby valueOrDefault = task.Result.GetValueOrDefault(); CodeMatcher matcher = new(instructions);
__instance.CurrentInviteLobby = valueOrDefault;
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(OpCodes.Bne_Un), new CodeMatch(OpCodes.Ldc_I4_4))
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions"); .Advance(2)
performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions }); .Set(OpCodes.Ldc_I4, Mod.MaxPlayers);
callback(true, valueOrDefault);
} return matcher.InstructionEnumeration();
else
{
callback(false, default(Lobby));
}
});
}
return false;
} }
} }
} }
+1 -1
View File
@@ -17,6 +17,6 @@ namespace MMOKitchen.Systems
SetComponent(data.Target, Editor); SetComponent(data.Target, Editor);
} }
private CTriggerProfileEditor Editor; private CTriggerPlayerSpecificUI Editor;
} }
} }