Compare commits

..

12 Commits

Author SHA1 Message Date
Lachlan Leone 136402dd26 Code Cleanup & Formula Adjustments 2026-03-08 21:33:59 +11:00
Lachlan Leone 2f6c445ab1 Update gitignore 2026-03-08 21:33:33 +11:00
Lachlan Leone 8ad55b0473 Remove debug messages 2026-03-08 21:33:28 +11:00
Lachlan Leone 81b980ca88 Small Logic Adjustments 2026-03-05 17:09:17 +11:00
Lachlan Leone d196cbcf9f 0.3.3 2025-09-25 22:28:35 +10:00
Lachlan Leone 3c7f88f427 Changelog 2024-10-09 16:41:50 +11:00
Lachlan Leone 4259b35697 v0.3.2 2024-10-09 16:41:33 +11:00
Lachlan Leone 9f4ef51d41 v0.3.1 2024-08-10 05:09:06 +10:00
Lachlan Leone 04e953c1e5 Merge branch 'master' of https://github.com/StarFluxMods/MMOKitchen 2024-08-10 05:03:05 +10:00
StarFluxGames a40845717a Merge pull request #8 from sstom0929/master
Fix a bug in the scale multiplier.
2024-08-10 05:02:52 +10:00
Lachlan Leone bb53c03b40 1.2.0 update 2024-08-10 05:00:57 +10:00
sstom0929 f14cb96b55 Fix a bug in the scale multiplier. 2024-07-29 14:00:22 +08:00
22 changed files with 325 additions and 84 deletions
+3 -1
View File
@@ -424,4 +424,6 @@ FodyWeavers.xsd
# Rider auto-generates .iml files, and contentModel.xml # Rider auto-generates .iml files, and contentModel.xml
**/.idea/**/*.iml **/.idea/**/*.iml
**/.idea/**/contentModel.xml **/.idea/**/contentModel.xml
**/.idea/**/modules.xml **/.idea/**/modules.xml
.idea
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+4
View File
@@ -0,0 +1,4 @@
# Release Notes v0.3.1
- Updated to support PlateUp 1.2.0.
- Fixed a problem with the Scale Multiplier. Thanks @sstom0929
+4
View File
@@ -0,0 +1,4 @@
# Release Notes v0.3.2
- Fixed a bug preventing some players from being teleported in the lobby when they don't have a bedroom.
- Fixed a bug preventing players from sharing profile editor beds.
+3
View File
@@ -0,0 +1,3 @@
# Release Notes v0.3.3
- *Hopefully* Fixed for PlateUp! 1.3.0
+6
View File
@@ -0,0 +1,6 @@
# Release Notes v0.4.0
- Updated difficulty formulas to be closer to the vanilla game.
- Split difficulty options into separate categories for better control.
- Fixed a bug causing the logs to be spammed with debug messages.
- General code cleanup.
+4
View File
@@ -0,0 +1,4 @@
[h1]Release Notes v0.3.1[/h1]
- Updated to support PlateUp 1.2.0.
- Fixed a problem with the Scale Multiplier. Thanks @sstom0929
+4
View File
@@ -0,0 +1,4 @@
[h1]Release Notes v0.3.2[/h1]
- Fixed a bug preventing some players from being teleported in the lobby when they don't have a bedroom.
- Fixed a bug preventing players from sharing profile editor beds.
+3
View File
@@ -0,0 +1,3 @@
[h1]Release Notes v0.3.3[/h1]
- *Hopefully* Fixed for PlateUp! 1.3.0
+6
View File
@@ -0,0 +1,6 @@
[h1]Release Notes v0.4.0[/h1]
- Updated difficulty formulas to be closer to the vanilla game.
- Split difficulty options into separate categories for better control.
- Fixed a bug causing the logs to be spammed with debug messages.
- General code cleanup.
+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>
+45 -14
View File
@@ -7,15 +7,20 @@ using UnityEngine;
namespace MMOKitchen.Menus namespace MMOKitchen.Menus
{ {
public class PreferenceMenu<T> : KLMenu<T> public class PreferenceMenu : KLMenu
{ {
public PreferenceMenu(Transform container, ModuleList module_list) : base(container, module_list) public PreferenceMenu(Transform container, ModuleList module_list) : base(container, module_list)
{ {
} }
private Option<int> requiredPercentage = new Option<int>(new List<int> { 25, 50, 75, 100 }, Mod.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Get(), new List<string> { "25%", "50%", "75%", "100%" }); private Option<int> requiredPercentage = new Option<int>(new List<int> { 25, 50, 75, 100 }, Mod.manager.GetPreference<PreferenceInt>(Mod.PREFERENCE_REQUIRED_CONSENT_PERCENTAGE).Get(), new List<string> { "25%", "50%", "75%", "100%" });
private Option<float> scaleMultiplier = new Option<float>(new List<float> { 0.1f, 0.2f, 0.3f, 0.4f, 0, 5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f }, Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Get(), new List<string> { "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0" }); //private Option<float> scaleMultiplier = new Option<float>(new List<float> { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f }, Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Get(), new List<string> { "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0" });
private Option<bool> scaleEnabled = new Option<bool>(new List<bool> { true, false }, Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Get(), new List<string> { "Enabled", "Disabled" }); private Option<bool> scaleEnabled = new Option<bool>(new List<bool> { true, false }, Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Get(), new List<string> { "Enabled", "Disabled" });
private Option<float> customerScaleAmount;
private Option<float> fireScaleAmount;
private Option<float> patienceScaleAmount;
public override void Setup(int player_id) public override void Setup(int player_id)
{ {
@@ -24,7 +29,8 @@ namespace MMOKitchen.Menus
AddSelect<int>(requiredPercentage); AddSelect<int>(requiredPercentage);
requiredPercentage.OnChanged += delegate (object _, int result) requiredPercentage.OnChanged += delegate (object _, int result)
{ {
Mod.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Set(result); Mod.manager.GetPreference<PreferenceInt>(Mod.PREFERENCE_REQUIRED_CONSENT_PERCENTAGE).Set(result);
Mod.manager.Save();
}; };
New<SpacerElement>(true); New<SpacerElement>(true);
@@ -34,23 +40,48 @@ namespace MMOKitchen.Menus
scaleEnabled.OnChanged += delegate (object _, bool result) scaleEnabled.OnChanged += delegate (object _, bool result)
{ {
Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Set(result); Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Set(result);
Mod.manager.Save();
}; };
AddScaleOption("Customer Scale Amount", ref customerScaleAmount, Mod.PREFERENCE_CUSTOMER_SCALE_AMOUNT);
AddScaleOption("Fire Scale Amount", ref fireScaleAmount, Mod.PREFERENCE_FIRE_SCALE_AMOUNT);
AddScaleOption("Patience Scale Amount", ref patienceScaleAmount, Mod.PREFERENCE_PATIENCE_SCALE_AMOUNT);
AddLabel("Scale Multiplier"); New<SpacerElement>();
AddSelect<float>(scaleMultiplier); New<SpacerElement>();
scaleMultiplier.OnChanged += delegate (object _, float result)
{
Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Set(result);
};
New<SpacerElement>(true);
New<SpacerElement>(true);
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i) AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i)
{ {
Mod.manager.Save();
this.RequestPreviousMenu(); this.RequestPreviousMenu();
}, 0, 1f, 0.2f); }, 0, 1f, 0.2f);
} }
private void AddScaleOption(string label, ref Option<float> option, string preferenceKey, float min = 0f, float max = 2f, float step = 0.1f)
{
if (option == null)
{
List<float> values = new List<float>();
List<string> displayValues = new List<string>();
for (float f = min; f < max + step; f += step)
{
values.Add((float)System.Math.Round(f, 2));
displayValues.Add(((float)System.Math.Round(f, 2)).ToString("0.00"));
}
option = new Option<float>(values, Mod.manager.GetPreference<PreferenceFloat>(preferenceKey).Value, displayValues);
}
New<SpacerElement>();
AddLabel(label);
AddSelect(option);
option.OnChanged += (_, result) =>
{
Mod.manager.GetPreference<PreferenceFloat>(preferenceKey).Set(result);
Mod.manager.Save();
};
}
} }
} }
+25 -22
View File
@@ -1,11 +1,12 @@
using KitchenLib; using KitchenLib;
using KitchenLib.Logging;
using KitchenMods; using KitchenMods;
using System.Reflection; using System.Reflection;
using Kitchen; using Kitchen;
using KitchenLib.Event;
using KitchenLib.Preferences; using KitchenLib.Preferences;
using KitchenLib.UI.PlateUp.PreferenceMenus;
using MMOKitchen.Menus; using MMOKitchen.Menus;
using UnityEngine;
using KitchenLogger = KitchenLib.Logging.KitchenLogger;
namespace MMOKitchen namespace MMOKitchen
{ {
@@ -13,9 +14,16 @@ 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.4.0";
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 const string PREFERENCE_REQUIRED_CONSENT_PERCENTAGE = "requiredConsentPercentage";
public const string PREFERENCE_SCALE_ABOVE_4_PLAYERS = "scaleAbove4Players";
public const string PREFERENCE_CUSTOMER_SCALE_AMOUNT = "PREFERENCE_CUSTOMER_SCALE_AMOUNT";
public const string PREFERENCE_FIRE_SCALE_AMOUNT = "PREFERENCE_FIRE_SCALE_AMOUNT";
public const string PREFERENCE_PATIENCE_SCALE_AMOUNT = "PREFERENCE_PATIENCE_SCALE_AMOUNT";
public static KitchenLogger Logger; public static KitchenLogger Logger;
public static PreferenceManager manager; public static PreferenceManager manager;
@@ -36,25 +44,20 @@ namespace MMOKitchen
protected override void OnPostActivate(KitchenMods.Mod mod) protected override void OnPostActivate(KitchenMods.Mod mod)
{ {
Logger = InitLogger(); Logger = InitLogger();
manager = new PreferenceManager("mmokitchen"); // Keeping the old GUID so we don't have to reset the preferences manager = new PreferenceManager("mmokitchen");
manager.RegisterPreference(new PreferenceInt("requiredConsentPercentage", 100)); manager.RegisterPreference(new PreferenceInt(PREFERENCE_REQUIRED_CONSENT_PERCENTAGE, 100));
manager.RegisterPreference(new PreferenceBool("scaleAbove4Players", false)); manager.RegisterPreference(new PreferenceBool(PREFERENCE_SCALE_ABOVE_4_PLAYERS, true));
manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f));
manager.RegisterPreference(new PreferenceFloat(PREFERENCE_CUSTOMER_SCALE_AMOUNT, 1f));
manager.RegisterPreference(new PreferenceFloat(PREFERENCE_FIRE_SCALE_AMOUNT, 1f));
manager.RegisterPreference(new PreferenceFloat(PREFERENCE_PATIENCE_SCALE_AMOUNT, 1f));
manager.Load(); manager.Load();
manager.Save();
ModsPreferencesMenu<PauseMenuAction>.RegisterMenu(MOD_NAME, typeof(PreferenceMenu<PauseMenuAction>), typeof(PauseMenuAction));
MainMenuPreferencesesMenu.RegisterMenu(MOD_NAME, typeof(PreferenceMenu));
Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) => PauseMenuPreferencesesMenu.RegisterMenu(MOD_NAME, typeof(PreferenceMenu));
{ BasePreferencesMenu.RegisterUsableMenu(typeof(PreferenceMenu));
args.Menus.Add(typeof(PreferenceMenu<PauseMenuAction>), new PreferenceMenu<PauseMenuAction>(args.Container, args.Module_list));
};
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));
};
} }
} }
} }
+1 -1
View File
@@ -37,7 +37,7 @@ namespace MMOKitchen.Patches
float progressSpeed = (float)getProgressSpeed.Invoke(__instance, new object[] { }); float progressSpeed = (float)getProgressSpeed.Invoke(__instance, new object[] { });
if ((((float)counter / (float)x.Count) * 100) >= Mod.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Value) if ((((float)counter / (float)x.Count) * 100) >= Mod.manager.GetPreference<PreferenceInt>(Mod.PREFERENCE_REQUIRED_CONSENT_PERCENTAGE).Value)
progressSpeed = 1f; progressSpeed = 1f;
if (progressSpeed <= 0f) if (progressSpeed <= 0f)
+32
View File
@@ -0,0 +1,32 @@
using System.Reflection;
using HarmonyLib;
using Kitchen;
using KitchenLib.Utils;
using MMOKitchen.Systems;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
namespace MMOKitchen.Patches
{
[HarmonyPatch(typeof(CreateBedrooms), "OnUpdate")]
public class CreateBedroomsPatch
{
static void Postfix(CreateBedrooms __instance)
{
FieldInfo _Players = ReflectionUtils.GetField<CreateBedrooms>("Players");
EntityQuery Players = (EntityQuery)_Players.GetValue(__instance);
NativeArray<Entity> players = Players.ToEntityArray(Allocator.Temp);
foreach (Entity player in players)
{
if (PatchHelpers.instance._GetComponent<CPlayer>(player).Index > 3)
{
PatchHelpers.instance._SetComponentData(player, new CPosition(LobbyPositionAnchors.Office + new Vector3(0,0,-2)));
}
}
players.Dispose();
}
}
}
+28 -15
View File
@@ -8,30 +8,43 @@ namespace MMOKitchen.Patches
public class DifficultyHelpersPatch public class DifficultyHelpersPatch
{ {
[HarmonyPatch("CustomerPlayersRateModifier")] [HarmonyPatch("CustomerPlayersRateModifier")]
[HarmonyPostfix] [HarmonyPrefix]
static void CustomerPlayersRateModifier_Postfix(ref float __result, int player_count) static bool CustomerPlayersRateModifier_Prefix(ref float __result, int player_count)
{ {
if (Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value) if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
if (player_count > 4) {
__result = 1 + (player_count * Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value); __result = (float)(1.5 + 0.25 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_CUSTOMER_SCALE_AMOUNT).Value);
return false;
}
Mod.Logger.LogInfo("5");
return true;
} }
[HarmonyPatch("FireSpreadModifier")] [HarmonyPatch("FireSpreadModifier")]
[HarmonyPostfix] [HarmonyPrefix]
static void FireSpreadModifier_Postfix(ref float __result, int player_count) static bool FireSpreadModifier_Prefix(ref float __result, int player_count)
{ {
if (Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value) if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
if (player_count > 4) {
__result = 0.75f + (player_count * Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value); __result = (float)(1.15 + 0.05 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_FIRE_SCALE_AMOUNT).Value);
return false;
}
return true;
} }
[HarmonyPatch("PatiencePlayerCountModifier")] [HarmonyPatch("PatiencePlayerCountModifier")]
[HarmonyPostfix] [HarmonyPrefix]
static void PatiencePlayerCountModifier_Postfix(ref float __result, int player_count) static bool PatiencePlayerCountModifier_Prefix(ref float __result, int player_count)
{ {
if (Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value) if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
if (player_count > 4) {
__result = 0.75f + (player_count * Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value); __result = (float)(1.5 + 0.25 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_PATIENCE_SCALE_AMOUNT).Value);
return false;
}
return true;
} }
} }
} }
+23
View File
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Reflection.Emit;
using HarmonyLib;
using Kitchen;
namespace MMOKitchen.Patches
{
[HarmonyPatch(typeof(Session), "GetInvite")]
public class SessionPatch
{
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
CodeMatcher matcher = new(instructions);
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldloca_S), new CodeMatch(OpCodes.Ldc_I4_3), new CodeMatch(OpCodes.Ldc_I4_4))
.Advance(2)
.Set(OpCodes.Ldc_I4, Mod.MaxPlayers);
return matcher.InstructionEnumeration();
}
}
}
+19 -27
View File
@@ -1,42 +1,34 @@
using HarmonyLib; using HarmonyLib;
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;
using UnityEngine;
using SteamNetworkService = Kitchen.NetworkSupport.SteamNetworkService;
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(SteamNetworkService))]
[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(SteamNetworkService), t => t.Name.Contains("<CreateNewLobby>d__31"));
{ return AccessTools.FirstMethod(type, method => method.Name.Contains("MoveNext"));
SteamMatchmaking.CreateLobbyAsync(Mod.MaxPlayers).ContinueWith(delegate (Task<Lobby?> task) }
{
if (task.IsCompleted && task.Result != null) [HarmonyTranspiler]
{ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
Lobby valueOrDefault = task.Result.GetValueOrDefault(); {
__instance.CurrentInviteLobby = valueOrDefault; CodeMatcher matcher = new(instructions);
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions"); matcher.MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_4), new CodeMatch(OpCodes.Call), new CodeMatch(OpCodes.Callvirt), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldloca_S), new CodeMatch(OpCodes.Call), new CodeMatch(OpCodes.Brtrue))
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;
} }
} }
} }
+36
View File
@@ -0,0 +1,36 @@
using Kitchen;
using KitchenLib.References;
using KitchenMods;
namespace MMOKitchen.Systems
{
public class GlobalCosmeticEditors : InteractionSystem, IModSystem
{
protected override bool AllowActOrGrab => true;
protected override bool ShouldAct(ref InteractionData data)
{
if (!Require(data.Target, out Editor))
{
return false;
}
bool flag = data.Attempt.Type == InteractionType.Grab;
bool flag2 = base.ShouldAct(ref data);
return Editor.UseGrab == flag && flag2;
}
protected override bool IsPossible(ref InteractionData data)
{
return Require(data.Target, out Editor) && Require(data.Target, out CAppliance cAppliance) && cAppliance.ID == ApplianceReferences.BedroomOutfitSelector;
}
protected override void Perform(ref InteractionData data)
{
Editor.IsTriggered = true;
Editor.TriggerEntity = data.Interactor;
SetComponent(data.Target, Editor);
}
private CTriggerPlayerSpecificUI Editor;
}
}
+39
View File
@@ -0,0 +1,39 @@
using Kitchen;
using KitchenMods;
using Unity.Entities;
using UnityEngine;
namespace MMOKitchen.Systems
{
public class GlobalProfileEditors : InteractionSystem, IModSystem
{
protected override bool IsPossible(ref InteractionData data)
{
return Has<CPlayer>(data.Interactor) && Has<ManageProfileEditors.COpensProfileEditor>(data.Target) && Has<CPosition>(data.Target) && Require(data.Target, out COwnedByPlayer cOwnedByPlayer) && cOwnedByPlayer.Player != data.Interactor;
}
protected override void Perform(ref InteractionData data)
{
if (!Require(data.Target, out CPosition cPosition)) return;
if (!Require(data.Interactor, out CPlayer cPlayer)) return;
Entity entity = EntityManager.CreateEntity();
EntityManager.AddComponentData(entity, new CPosition(cPosition + new Vector3(-2f, 1f, 0f)));
EntityManager.AddComponentData(entity, new CRequiresView
{
Type = ViewType.ProfileEditor,
ViewMode = ViewMode.WorldToScreen
});
EntityManager.AddComponentData(entity, new ManageProfileEditors.CProfileEditor
{
Trigger = data.Target,
PlayerID = cPlayer.ID,
Player = data.Interactor
});
EntityManager.AddComponentData(data.Target, new ManageProfileEditors.CHasProfileEditor
{
Editor = entity
});
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using Kitchen;
using KitchenMods;
using Unity.Entities;
namespace MMOKitchen.Systems
{
public class PatchHelpers : GameSystemBase, IModSystem
{
public static PatchHelpers instance;
public T _GetComponent<T>(Entity entity) where T : struct, IComponentData
{
return GetComponent<T>(entity);
}
public void _SetComponentData<T>(Entity entity, T componentData) where T : struct, IComponentData
{
EntityManager.SetComponentData<T>(entity, componentData);
}
protected override void Initialise()
{
instance = this;
}
protected override void OnUpdate()
{
}
}
}
+2 -3
View File
@@ -1,9 +1,8 @@
using Kitchen; using Kitchen;
using KitchenMods;
namespace MMOKitchen.Systems namespace MMOKitchen.Systems
{ {
public class ProfileEditorOverride : InteractionSystem, IModSystem public class ProfileEditorOverride : InteractionSystem
{ {
protected override bool IsPossible(ref InteractionData data) protected override bool IsPossible(ref InteractionData data)
{ {
@@ -17,6 +16,6 @@ namespace MMOKitchen.Systems
SetComponent(data.Target, Editor); SetComponent(data.Target, Editor);
} }
private CTriggerProfileEditor Editor; private CTriggerPlayerSpecificUI Editor;
} }
} }