Compare commits
13 Commits
35d3fec3de
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ef34176935 | |||
| 136402dd26 | |||
| 2f6c445ab1 | |||
| 8ad55b0473 | |||
| 81b980ca88 | |||
| d196cbcf9f | |||
| 3c7f88f427 | |||
| 4259b35697 | |||
| 9f4ef51d41 | |||
| 04e953c1e5 | |||
| a40845717a | |||
| bb53c03b40 | |||
| f14cb96b55 |
@@ -0,0 +1,25 @@
|
||||
### What happened?
|
||||
Briefly describe the issue.
|
||||
|
||||
---
|
||||
|
||||
### How to reproduce
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
---
|
||||
|
||||
### What did you expect?
|
||||
What should have happened?
|
||||
|
||||
---
|
||||
|
||||
### Game & Mod Version
|
||||
- Game Version:
|
||||
- Mod Version:
|
||||
|
||||
---
|
||||
|
||||
### Extra info (optional)
|
||||
Logs, screenshots, or anything else helpful.
|
||||
@@ -0,0 +1,17 @@
|
||||
### What do you want?
|
||||
Briefly describe the feature.
|
||||
|
||||
---
|
||||
|
||||
### How should it work?
|
||||
Explain how the feature would behave in-game.
|
||||
|
||||
---
|
||||
|
||||
### Why is this useful?
|
||||
What problem does this solve or what does it improve?
|
||||
|
||||
---
|
||||
|
||||
### Extra info (optional)
|
||||
Screenshots, examples, or additional context.
|
||||
+3
-1
@@ -424,4 +424,6 @@ FodyWeavers.xsd
|
||||
# Rider auto-generates .iml files, and contentModel.xml
|
||||
**/.idea/**/*.iml
|
||||
**/.idea/**/contentModel.xml
|
||||
**/.idea/**/modules.xml
|
||||
**/.idea/**/modules.xml
|
||||
|
||||
.idea
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -0,0 +1,3 @@
|
||||
# Release Notes v0.3.3
|
||||
|
||||
- *Hopefully* Fixed for PlateUp! 1.3.0
|
||||
@@ -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.
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -0,0 +1,3 @@
|
||||
[h1]Release Notes v0.3.3[/h1]
|
||||
|
||||
- *Hopefully* Fixed for PlateUp! 1.3.0
|
||||
@@ -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
@@ -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>
|
||||
|
||||
+45
-14
@@ -7,15 +7,20 @@ using UnityEngine;
|
||||
|
||||
namespace MMOKitchen.Menus
|
||||
{
|
||||
public class PreferenceMenu<T> : KLMenu<T>
|
||||
public class PreferenceMenu : KLMenu
|
||||
{
|
||||
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<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<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<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)
|
||||
{
|
||||
@@ -24,7 +29,8 @@ namespace MMOKitchen.Menus
|
||||
AddSelect<int>(requiredPercentage);
|
||||
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);
|
||||
@@ -34,23 +40,48 @@ namespace MMOKitchen.Menus
|
||||
scaleEnabled.OnChanged += delegate (object _, bool 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");
|
||||
AddSelect<float>(scaleMultiplier);
|
||||
scaleMultiplier.OnChanged += delegate (object _, float result)
|
||||
{
|
||||
Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Set(result);
|
||||
};
|
||||
|
||||
New<SpacerElement>(true);
|
||||
New<SpacerElement>(true);
|
||||
New<SpacerElement>();
|
||||
New<SpacerElement>();
|
||||
|
||||
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i)
|
||||
{
|
||||
Mod.manager.Save();
|
||||
this.RequestPreviousMenu();
|
||||
}, 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();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using KitchenLib;
|
||||
using KitchenLib.Logging;
|
||||
using KitchenMods;
|
||||
using System.Reflection;
|
||||
using Kitchen;
|
||||
using KitchenLib.Event;
|
||||
using KitchenLib.Preferences;
|
||||
using KitchenLib.UI.PlateUp.PreferenceMenus;
|
||||
using MMOKitchen.Menus;
|
||||
using UnityEngine;
|
||||
using KitchenLogger = KitchenLib.Logging.KitchenLogger;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
@@ -13,9 +14,16 @@ 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.4.0";
|
||||
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 PreferenceManager manager;
|
||||
@@ -36,25 +44,20 @@ namespace MMOKitchen
|
||||
protected override void OnPostActivate(KitchenMods.Mod mod)
|
||||
{
|
||||
Logger = InitLogger();
|
||||
manager = new PreferenceManager("mmokitchen"); // Keeping the old GUID so we don't have to reset the preferences
|
||||
manager.RegisterPreference(new PreferenceInt("requiredConsentPercentage", 100));
|
||||
manager.RegisterPreference(new PreferenceBool("scaleAbove4Players", false));
|
||||
manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f));
|
||||
manager = new PreferenceManager("mmokitchen");
|
||||
manager.RegisterPreference(new PreferenceInt(PREFERENCE_REQUIRED_CONSENT_PERCENTAGE, 100));
|
||||
manager.RegisterPreference(new PreferenceBool(PREFERENCE_SCALE_ABOVE_4_PLAYERS, true));
|
||||
|
||||
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();
|
||||
|
||||
ModsPreferencesMenu<PauseMenuAction>.RegisterMenu(MOD_NAME, typeof(PreferenceMenu<PauseMenuAction>), typeof(PauseMenuAction));
|
||||
|
||||
Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) =>
|
||||
{
|
||||
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));
|
||||
};
|
||||
manager.Save();
|
||||
|
||||
MainMenuPreferencesesMenu.RegisterMenu(MOD_NAME, typeof(PreferenceMenu));
|
||||
PauseMenuPreferencesesMenu.RegisterMenu(MOD_NAME, typeof(PreferenceMenu));
|
||||
BasePreferencesMenu.RegisterUsableMenu(typeof(PreferenceMenu));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace MMOKitchen.Patches
|
||||
|
||||
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;
|
||||
|
||||
if (progressSpeed <= 0f)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,30 +8,43 @@ namespace MMOKitchen.Patches
|
||||
public class DifficultyHelpersPatch
|
||||
{
|
||||
[HarmonyPatch("CustomerPlayersRateModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void CustomerPlayersRateModifier_Postfix(ref float __result, int player_count)
|
||||
[HarmonyPrefix]
|
||||
static bool CustomerPlayersRateModifier_Prefix(ref float __result, int player_count)
|
||||
{
|
||||
if (Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value)
|
||||
if (player_count > 4)
|
||||
__result = 1 + (player_count * Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value);
|
||||
if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).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")]
|
||||
[HarmonyPostfix]
|
||||
static void FireSpreadModifier_Postfix(ref float __result, int player_count)
|
||||
[HarmonyPrefix]
|
||||
static bool FireSpreadModifier_Prefix(ref float __result, int player_count)
|
||||
{
|
||||
if (Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value)
|
||||
if (player_count > 4)
|
||||
__result = 0.75f + (player_count * Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value);
|
||||
if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).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")]
|
||||
[HarmonyPostfix]
|
||||
static void PatiencePlayerCountModifier_Postfix(ref float __result, int player_count)
|
||||
[HarmonyPrefix]
|
||||
static bool PatiencePlayerCountModifier_Prefix(ref float __result, int player_count)
|
||||
{
|
||||
if (Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value)
|
||||
if (player_count > 4)
|
||||
__result = 0.75f + (player_count * Mod.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value);
|
||||
if (player_count > 4 && Mod.manager.GetPreference<PreferenceBool>(Mod.PREFERENCE_SCALE_ABOVE_4_PLAYERS).Value)
|
||||
{
|
||||
__result = (float)(1.5 + 0.25 * (player_count - 4) * Mod.manager.GetPreference<PreferenceFloat>(Mod.PREFERENCE_PATIENCE_SCALE_AMOUNT).Value);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,34 @@
|
||||
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;
|
||||
using UnityEngine;
|
||||
using SteamNetworkService = Kitchen.NetworkSupport.SteamNetworkService;
|
||||
|
||||
namespace MMOKitchen.Patches
|
||||
{
|
||||
/*
|
||||
* This patch is used to change how many players can join the lobby using Steam.
|
||||
*/
|
||||
|
||||
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
|
||||
[HarmonyPatch(typeof(SteamNetworkService))]
|
||||
public class SteamPlatformPatch
|
||||
{
|
||||
public static bool Prefix(SteamPlatform __instance, Action<bool, Lobby> callback)
|
||||
private static MethodBase TargetMethod()
|
||||
{
|
||||
if (__instance.IsReady)
|
||||
{
|
||||
SteamMatchmaking.CreateLobbyAsync(Mod.MaxPlayers).ContinueWith(delegate (Task<Lobby?> task)
|
||||
{
|
||||
if (task.IsCompleted && task.Result != null)
|
||||
{
|
||||
Lobby valueOrDefault = task.Result.GetValueOrDefault();
|
||||
__instance.CurrentInviteLobby = valueOrDefault;
|
||||
|
||||
MethodInfo performSetPermissions = AccessTools.Method(typeof(SteamPlatform), "PerformSetPermissions");
|
||||
performSetPermissions.Invoke(__instance, new object[] { __instance.Permissions });
|
||||
callback(true, valueOrDefault);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(false, default(Lobby));
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
Type type = AccessTools.FirstInner(typeof(SteamNetworkService), t => t.Name.Contains("<CreateNewLobby>d__31"));
|
||||
return AccessTools.FirstMethod(type, method => method.Name.Contains("MoveNext"));
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
CodeMatcher matcher = new(instructions);
|
||||
|
||||
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))
|
||||
.Set(OpCodes.Ldc_I4, Mod.MaxPlayers);
|
||||
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using Kitchen;
|
||||
using KitchenMods;
|
||||
|
||||
namespace MMOKitchen.Systems
|
||||
{
|
||||
public class ProfileEditorOverride : InteractionSystem, IModSystem
|
||||
public class ProfileEditorOverride : InteractionSystem
|
||||
{
|
||||
protected override bool IsPossible(ref InteractionData data)
|
||||
{
|
||||
@@ -17,6 +16,6 @@ namespace MMOKitchen.Systems
|
||||
SetComponent(data.Target, Editor);
|
||||
}
|
||||
|
||||
private CTriggerProfileEditor Editor;
|
||||
private CTriggerPlayerSpecificUI Editor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user