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>
<PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.10.21" />
<PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.11.5" />
</ItemGroup>
<ItemGroup>
+9 -11
View File
@@ -6,6 +6,7 @@ using Kitchen;
using KitchenLib.Event;
using KitchenLib.Preferences;
using MMOKitchen.Menus;
using KitchenLogger = KitchenLib.Logging.KitchenLogger;
namespace MMOKitchen
{
@@ -13,9 +14,9 @@ namespace MMOKitchen
{
public const string MOD_GUID = "com.starfluxgames.mmokitchen";
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_GAMEVERSION = ">=1.1.9";
public const string MOD_GAMEVERSION = ">=1.2.0";
public static KitchenLogger Logger;
public static PreferenceManager manager;
@@ -42,18 +43,15 @@ namespace MMOKitchen
manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f));
manager.Load();
ModsPreferencesMenu<PauseMenuAction>.RegisterMenu(MOD_NAME, typeof(PreferenceMenu<PauseMenuAction>), typeof(PauseMenuAction));
Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) =>
ModsPreferencesMenu<MenuAction>.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu<MenuAction>), typeof(MenuAction));
ModsPreferencesMenu<MenuAction>.RegisterMenu("MMO Kitchen", typeof(PreferenceMenu<MenuAction>), typeof(MenuAction));
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) });
};
ModsPreferencesMenu<MainMenuAction>.RegisterMenu(MOD_NAME, typeof(PreferenceMenu<MainMenuAction>), typeof(MainMenuAction));
Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) =>
Events.PlayerPauseView_SetupMenusEvent += (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) });
};
}
}
+15 -24
View File
@@ -1,42 +1,33 @@
using HarmonyLib;
using Kitchen.NetworkSupport;
using Steamworks;
using Steamworks.Data;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using System.Reflection.Emit;
namespace MMOKitchen.Patches
{
/*
* This patch is used to change how many players can join the lobby using Steam.
*/
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
[HarmonyPatch(typeof(SteamPlatform))]
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"));
}
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
SteamMatchmaking.CreateLobbyAsync(Mod.MaxPlayers).ContinueWith(delegate (Task<Lobby?> task)
{
if (task.IsCompleted && task.Result != null)
{
Lobby valueOrDefault = task.Result.GetValueOrDefault();
__instance.CurrentInviteLobby = valueOrDefault;
CodeMatcher matcher = new(instructions);
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions");
performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions });
callback(true, valueOrDefault);
}
else
{
callback(false, default(Lobby));
}
});
}
return false;
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(OpCodes.Bne_Un), new CodeMatch(OpCodes.Ldc_I4_4))
.Advance(2)
.Set(OpCodes.Ldc_I4, Mod.MaxPlayers);
return matcher.InstructionEnumeration();
}
}
}
+1 -1
View File
@@ -17,6 +17,6 @@ namespace MMOKitchen.Systems
SetComponent(data.Target, Editor);
}
private CTriggerProfileEditor Editor;
private CTriggerPlayerSpecificUI Editor;
}
}