v0.1.0
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user