BepInEx Support

This commit is contained in:
Lachlan Leone
2022-11-05 14:52:31 +11:00
parent 1fc7fa477d
commit eb1713a569
8 changed files with 40 additions and 30 deletions
+17 -8
View File
@@ -1,11 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'MelonLoader|AnyCPU'">
<TargetFramework>net4.7.1</TargetFramework> <TargetFramework>net4.7.1</TargetFramework>
<DefineConstants>MelonLoader</DefineConstants>
<OutputPath>bin\MelonLoader\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'BepInEx|AnyCPU'">
<TargetFramework>net4.7.1</TargetFramework>
<DefineConstants>BepInEx</DefineConstants>
<OutputPath>bin\BepInEx\</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="$(os)=='Windows_NT'"> <PropertyGroup Condition="$(os)=='Windows_NT'">
<PlateUpGameFolder>F:\SteamLibrary\steamapps\common\PlateUp\PlateUp</PlateUpGameFolder> <PlateUpGameFolder>..\..\..\..\Libraries</PlateUpGameFolder>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="$(os)=='UNIX'"> <PropertyGroup Condition="$(os)=='UNIX'">
@@ -25,6 +33,9 @@
<Reference Include="MelonLoader"> <Reference Include="MelonLoader">
<HintPath>$(PlateUpGameFolder)\MelonLoader\MelonLoader.dll</HintPath> <HintPath>$(PlateUpGameFolder)\MelonLoader\MelonLoader.dll</HintPath>
</Reference> </Reference>
<Reference Include="BepInEx">
<HintPath>$(PlateUpGameFolder)\BepInEx\core\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Kitchen"> <Reference Include="Kitchen">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.Common.dll</HintPath> <HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.Common.dll</HintPath>
</Reference> </Reference>
@@ -74,12 +85,10 @@
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath> <HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
</Reference> </Reference>
<Reference Include="KitchenLib"> <Reference Include="KitchenLib">
<HintPath>$(PlateUpGameFolder)\Mods\KitchenLib.dll</HintPath> <HintPath>$(PlateUpGameFolder)\Mods\KitchenLib-MelonLoader.dll</HintPath>
</Reference>
<Reference Include="KitchenLib">
<HintPath>$(PlateUpGameFolder)\BepInEx\plugins\KitchenLib-BepInEx.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<Target Name="CopyToPlateUp" AfterTargets="Build">
<Message Text="Copying MMOKitchen to PlateUp Mods folder" Importance="High" />
<Copy SourceFiles="$(OutputPath)\MMOKitchen.dll" DestinationFolder="$(PlateUpGameFolder)\Mods" ContinueOnError="false" />
</Target>
</Project> </Project>
+22 -4
View File
@@ -1,11 +1,29 @@
using KitchenLib; using KitchenLib;
using UnityEngine; using System.Reflection;
using System.IO; #if BepInEx
using BepInEx;
#endif
#if MelonLoader
using MelonLoader;
#endif
#if MelonLoader
[assembly: MelonInfo(typeof(MMOKitchen.Mod), "MMO Kitchen", "0.1.2", "StarFluxGames")]
[assembly: MelonGame("It's Happening", "PlateUp")]
#endif
namespace MMOKitchen namespace MMOKitchen
{ {
#if BepInEx
[BepInProcess("PlateUp.exe")]
[BepInPlugin("starfluxgames.mmokitchen", "MMO Kitchen", "0.1.2")]
#endif
public class Mod : BaseMod public class Mod : BaseMod
{ {
public Mod() : base("politecustomers", "1.1.0") {} #if MelonLoader
public Mod() : base("mmokitchen", "1.1.0") { }
#endif
#if BepInEx
public Mod() : base("1.1.0", Assembly.GetExecutingAssembly()) {}
#endif
} }
} }
@@ -50,7 +50,6 @@ namespace MMOKitchen
placeSpawnMarker.Invoke(__instance, new object[] { i, array[i] + new Vector3(-1f, 0f, 0f) }); placeSpawnMarker.Invoke(__instance, new object[] { i, array[i] + new Vector3(-1f, 0f, 0f) });
foreach (Entity entity2 in nativeArray) foreach (Entity entity2 in nativeArray)
{ {
//bool flag = i == base.GetComponent<CPlayer>(entity2).Index;
bool flag = i == ((CPlayer)getComponent.Invoke(__instance, new object[] { entity2 })).Index; bool flag = i == ((CPlayer)getComponent.Invoke(__instance, new object[] { entity2 })).Index;
if (flag) if (flag)
{ {
-1
View File
@@ -23,7 +23,6 @@ namespace MMOKitchen
garageDecorations.SetActive(false); garageDecorations.SetActive(false);
create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.GarageDecorations), new Vector3(-8f, 0f, -2f), Vector3.forward}); create.Invoke(__instance, new object[]{GameData.Main.Get<Appliance>(AssetReference.GarageDecorations), new Vector3(-8f, 0f, -2f), Vector3.forward});
//Mod.Log(GameData.Main.Get<Appliance>(AssetReference.GarageDecorations).Prefab.name);
Entity entity = default(Entity); 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}); 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); EntityUtils.GetEntityManager().AddComponent<CItemPedestal>(entity);
@@ -9,7 +9,6 @@ namespace MMOKitchen
{ {
public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2) public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2)
{ {
//Mod.Log(tile1.ToString() + "," + tile2.ToString());
if ((tile1 == new Vector2(-11, -5) && tile2 == new Vector2(-10, -5)) 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, -6) && tile2 == new Vector2(-10, -6))
|| (tile1 == new Vector2(-11, -7) && tile2 == new Vector2(-10, -7)) || (tile1 == new Vector2(-11, -7) && tile2 == new Vector2(-10, -7))
@@ -15,7 +15,6 @@ namespace MMOKitchen
{ {
PlayerManager playerManager = World.DefaultGameObjectInjectionWorld.GetExistingSystem<PlayerManager>(); PlayerManager playerManager = World.DefaultGameObjectInjectionWorld.GetExistingSystem<PlayerManager>();
FieldInfo finfo = typeof(PlayerManager).GetField("MaxPlayers", BindingFlags.Instance | BindingFlags.Public); FieldInfo finfo = typeof(PlayerManager).GetField("MaxPlayers", BindingFlags.Instance | BindingFlags.Public);
if (finfo == null) Mod.Log("finfo is null");
finfo.SetValue(playerManager, 12); finfo.SetValue(playerManager, 12);
__instance.SourceTexture = ResourceUtils.LoadTextureFromFile(Path.Combine(Application.streamingAssetsPath, "NewFromTexture.png")); __instance.SourceTexture = ResourceUtils.LoadTextureFromFile(Path.Combine(Application.streamingAssetsPath, "NewFromTexture.png"));
+1 -10
View File
@@ -1,18 +1,9 @@
using HarmonyLib; using HarmonyLib;
using UnityEngine;
using Kitchen.Layouts.Modules;
using Kitchen;
using System.Reflection; using System.Reflection;
using Unity.Entities;
using KitchenLib.Utils;
using System.IO;
using Steamworks; using Steamworks;
using Kitchen.NetworkSupport; using Kitchen.NetworkSupport;
using System.Threading.Tasks; using System.Threading.Tasks;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using Kitchen.Transports;
using Steamworks.Data; using Steamworks.Data;
namespace MMOKitchen namespace MMOKitchen
{ {
@@ -29,7 +20,7 @@ namespace MMOKitchen
{ {
Lobby valueOrDefault = task.Result.GetValueOrDefault(); Lobby valueOrDefault = task.Result.GetValueOrDefault();
__instance.CurrentInviteLobby = valueOrDefault; __instance.CurrentInviteLobby = valueOrDefault;
//Reflection Stuff
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);
-4
View File
@@ -1,4 +0,0 @@
using MelonLoader;
[assembly: MelonInfo(typeof(MMOKitchen.Mod), "MMO Kitchen", "0.1.1", "StarFluxGames")]
[assembly: MelonGame("It's Happening", "PlateUp")]