This commit is contained in:
Lachlan Leone
2022-11-01 06:18:35 +11:00
parent 70377f5ad8
commit 2cf179704d
10 changed files with 307 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
bin/
obj/
.vs/
.DS_Store
+22
View File
@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MMOKitchen", "MMOKitchen\MMOKitchen.csproj", "{03768998-4709-4988-B37F-ECC5D44DF280}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03768998-4709-4988-B37F-ECC5D44DF280}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03768998-4709-4988-B37F-ECC5D44DF280}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03768998-4709-4988-B37F-ECC5D44DF280}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03768998-4709-4988-B37F-ECC5D44DF280}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
+82
View File
@@ -0,0 +1,82 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net4.7.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="$(os)=='Windows_NT'">
<PlateUpGameFolder>F:\SteamLibrary\steamapps\common\PlateUp\PlateUp</PlateUpGameFolder>
</PropertyGroup>
<PropertyGroup Condition="$(os)=='UNIX'">
<PlateUpGameFolder>/Users/lachlanleone/Desktop/PlateUp</PlateUpGameFolder>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(PlateUpGameFolder)\MelonLoader\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Kitchen.RestaurantMode">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.RestaurantMode.dll</HintPath>
</Reference>
<Reference Include="KitchenMode">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\KitchenMode.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>$(PlateUpGameFolder)\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="Kitchen">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.Common.dll</HintPath>
</Reference>
<Reference Include="Kitchen">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.Networking.dll</HintPath>
</Reference>
<Reference Include="Kitchen.GameData">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.GameData.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Sirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="Kitchen.FranchiseMode">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.FranchiseMode.dll</HintPath>
</Reference>
<Reference Include="Kitchen">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Kitchen.Layouts.dll</HintPath>
</Reference>
<Reference Include="Unity.Entities">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\Unity.Entities.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputModule">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.InputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>$(PlateUpGameFolder)\PlateUp_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="KitchenLib">
<HintPath>$(PlateUpGameFolder)\Mods\KitchenLib.dll</HintPath>
</Reference>
</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>
+11
View File
@@ -0,0 +1,11 @@
using KitchenLib;
using UnityEngine;
using System.IO;
namespace MMOKitchen
{
public class Mod : BaseMod
{
public Mod() : base("politecustomers", "1.1.0") {}
}
}
@@ -0,0 +1,66 @@
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 == base.GetComponent<CPlayer>(entity2).Index;
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;
}
}
}
+59
View File
@@ -0,0 +1,59 @@
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});
Mod.Log(GameData.Main.Get<Appliance>(AssetReference.GarageDecorations).Prefab.name);
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});
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,18 @@
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 = ResourceUtils.LoadTextureFromFile(Path.Combine(Application.streamingAssetsPath, "FeaturesFromTexture.png"));
}
}
}
+17
View File
@@ -0,0 +1,17 @@
using HarmonyLib;
using Kitchen;
using UnityEngine;
namespace MMOKitchen
{
[HarmonyPatch(typeof(LayoutBuilder), "BuildWallBetween")]
public class LayoutBuilder_Patch
{
public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2)
{
if (tile1 == new Vector2(-11, -5) || tile1 == new Vector2(-11, -6))
return false;
return true;
}
}
}
@@ -0,0 +1,24 @@
using HarmonyLib;
using UnityEngine;
using Kitchen.Layouts.Modules;
using Kitchen;
using System.Reflection;
using Unity.Entities;
using KitchenLib.Utils;
using System.IO;
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);
if (finfo == null) Mod.Log("finfo is null");
finfo.SetValue(playerManager, 12);
__instance.SourceTexture = ResourceUtils.LoadTextureFromFile(Path.Combine(Application.streamingAssetsPath, "NewFromTexture.png"));
}
}
}
+4
View File
@@ -0,0 +1,4 @@
using MelonLoader;
[assembly: MelonInfo(typeof(MMOKitchen.Mod), "MMO Kitchen", "0.1.0", "StarFluxGames")]
[assembly: MelonGame("It's Happening", "PlateUp")]