v0.3.0
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Other Installed Mods**
|
||||
- SomeMod v1.2.3
|
||||
- AnotherMod v3.2.1
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,16 +0,0 @@
|
||||
name: Opened Issue
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: 'Opened Issue'
|
||||
uses: umahmood/pushover-actions@main
|
||||
env:
|
||||
PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }}
|
||||
PUSHOVER_USER: ${{ secrets.PUSHOVER_USER }}
|
||||
with:
|
||||
title: 'Opened Issue'
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
# Default ignored files
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
@@ -11,3 +11,5 @@
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# GitHub Copilot persisted chat sessions
|
||||
/copilot/chatSessions
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
Generated
Generated
-6
@@ -1,6 +0,0 @@
|
||||
<?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.0
|
||||
|
||||
- Rewrote backend.
|
||||
- Increased player cap to 100
|
||||
@@ -0,0 +1,4 @@
|
||||
[h1]Release Notes v0.3.0[/h1]
|
||||
|
||||
- Rewrote backend.
|
||||
- Increased player cap to 100
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 StarFluxMods
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<Configurations>Release;Debug</Configurations>
|
||||
<AssemblyName>$(MSBuildProjectName)-Workshop</AssemblyName>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>CS0114</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<AssetBundlePath>$(ProjectDir)UnityProject - MMOKitchen\content\mod.assets</AssetBundlePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="content\**" />
|
||||
<Compile Remove="UnityProject - MMOKitchen\**" />
|
||||
<EmbeddedResource Remove="content\**" />
|
||||
<EmbeddedResource Remove="UnityProject - MMOKitchen\**" />
|
||||
<None Remove="UnityProject - MMOKitchen\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.10.21" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Changelogs\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32811.315
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MMOKitchen", "MMOKitchen\MMOKitchen.csproj", "{008489AE-40DC-433A-8037-E846C6EAC883}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{008489AE-40DC-433A-8037-E846C6EAC883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{008489AE-40DC-433A-8037-E846C6EAC883}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{008489AE-40DC-433A-8037-E846C6EAC883}.Release|Any CPU.ActiveCfg = Workshop|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AA51C7D7-1CC8-4304-9540-D214CFFF8597}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Yariazen.PlateUp.ModBuildUtilities" Version="1.10.21" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,65 +0,0 @@
|
||||
using Kitchen;
|
||||
using KitchenLib;
|
||||
using KitchenLib.Event;
|
||||
using KitchenLib.Preferences;
|
||||
using KitchenMods;
|
||||
using MMOKitchenReborn.Menus;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchenReborn
|
||||
{
|
||||
public class Main : BaseMod
|
||||
{
|
||||
public const string MOD_ID = "mmokitchen";
|
||||
public const string MOD_NAME = "MMO Kitchen";
|
||||
public const string MOD_AUTHOR = "StarFluxGames";
|
||||
public const string MOD_VERSION = "0.2.1";
|
||||
public const string MOD_COMPATIBLE_VERSIONS = ">=1.1.4";
|
||||
|
||||
public static PreferenceManager manager;
|
||||
public Main() : base(MOD_ID, MOD_NAME, MOD_AUTHOR, MOD_VERSION, MOD_COMPATIBLE_VERSIONS, Assembly.GetExecutingAssembly()) { }
|
||||
|
||||
protected override void OnPostActivate(Mod mod)
|
||||
{
|
||||
manager = new PreferenceManager(MOD_ID);
|
||||
manager.RegisterPreference(new PreferenceInt("requiredConsentPercentage", 100));
|
||||
manager.RegisterPreference(new PreferenceBool("scaleAbove4Players", false));
|
||||
manager.RegisterPreference(new PreferenceFloat("scaleAbove4PlayersMultiplier", 0.1f));
|
||||
manager.Load();
|
||||
|
||||
ModsPreferencesMenu<PauseMenuAction>.RegisterMenu("MMO Kitchen", 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("MMO Kitchen", 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));
|
||||
};
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void LogInfo(string message)
|
||||
{
|
||||
Debug.Log($"[{MOD_NAME}] " + message);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void LogWarning(string message)
|
||||
{
|
||||
Debug.LogWarning($"[{MOD_NAME}] " + message);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void LogError(string message)
|
||||
{
|
||||
Debug.LogError($"[{MOD_NAME}] " + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
using Kitchen;
|
||||
using Kitchen.Modules;
|
||||
using KitchenLib;
|
||||
using KitchenLib.Preferences;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchenReborn.Menus
|
||||
{
|
||||
public class PreferenceMenu<T> : KLMenu<T>
|
||||
{
|
||||
public PreferenceMenu(Transform container, ModuleList module_list) : base(container, module_list)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Setup(int player_id)
|
||||
{
|
||||
New<SpacerElement>(true);
|
||||
AddLabel("Required Consent Percentage");
|
||||
AddSelect<int>(requiredPercentage);
|
||||
requiredPercentage.OnChanged += delegate (object _, int result)
|
||||
{
|
||||
Main.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Set(result);
|
||||
};
|
||||
|
||||
New<SpacerElement>(true);
|
||||
|
||||
AddLabel("Scale Above 4 Players");
|
||||
AddSelect<bool>(scaleEnabled);
|
||||
scaleEnabled.OnChanged += delegate (object _, bool result)
|
||||
{
|
||||
Main.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Set(result);
|
||||
};
|
||||
|
||||
AddLabel("Scale Multiplier");
|
||||
AddSelect<float>(scaleMultiplier);
|
||||
scaleMultiplier.OnChanged += delegate (object _, float result)
|
||||
{
|
||||
Main.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Set(result);
|
||||
};
|
||||
|
||||
New<SpacerElement>(true);
|
||||
New<SpacerElement>(true);
|
||||
|
||||
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i)
|
||||
{
|
||||
Main.manager.Save();
|
||||
this.RequestPreviousMenu();
|
||||
}, 0, 1f, 0.2f);
|
||||
}
|
||||
private Option<int> requiredPercentage = new Option<int>(new List<int> { 25, 50, 75, 100 }, Main.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 }, Main.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 }, Main.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Get(), new List<string> { "Enabled", "Disabled" });
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Kitchen.Modules;
|
||||
using KitchenLib.Preferences;
|
||||
using KitchenLib.Utils;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(ConsentElement), "Update")]
|
||||
public class ConsentElement_Patch
|
||||
{
|
||||
public static bool Prefix(ConsentElement __instance)
|
||||
{
|
||||
|
||||
PlayerManager pm = Unity.Entities.World.DefaultGameObjectInjectionWorld.GetExistingSystem<PlayerManager>();
|
||||
if (pm == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
MethodInfo updateBar = ReflectionUtils.GetMethod<ConsentElement>("UpdateBar");
|
||||
MethodInfo getProgressSpeed = ReflectionUtils.GetMethod<ConsentElement>("GetProgressSpeed");
|
||||
FieldInfo progress = ReflectionUtils.GetField<ConsentElement>("Progress");
|
||||
PropertyInfo isCompleted = AccessTools.Property(typeof(ConsentElement), "IsCompleted");
|
||||
|
||||
FieldInfo consentsSwap = ReflectionUtils.GetField<ConsentElement>("ConsentsSwap");
|
||||
|
||||
Dictionary<int, bool> x = (Dictionary<int, bool>)consentsSwap.GetValue(__instance);
|
||||
|
||||
int counter = 0;
|
||||
foreach (int y in x.Keys)
|
||||
if (x[y])
|
||||
counter++;
|
||||
|
||||
float progressSpeed = (float)getProgressSpeed.Invoke(__instance, new object[] { });
|
||||
|
||||
if ((((float)counter / (float)x.Count) * 100) >= Main.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Value)
|
||||
progressSpeed = 1f;
|
||||
|
||||
if (progressSpeed <= 0f)
|
||||
progress.SetValue(__instance, (float)progress.GetValue(__instance) - (2f * Time.unscaledDeltaTime));
|
||||
else
|
||||
progress.SetValue(__instance, (float)progress.GetValue(__instance) + (progressSpeed * Time.unscaledDeltaTime));
|
||||
|
||||
isCompleted.SetValue(__instance, ((float)progress.GetValue(__instance) >= 1f));
|
||||
progress.SetValue(__instance, Mathf.Clamp01((float)progress.GetValue(__instance)));
|
||||
updateBar.Invoke(__instance, new object[] { });
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Preferences;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(DifficultyHelpers))]
|
||||
public class DifficultyHelpers_Patch
|
||||
{
|
||||
[HarmonyPatch("CustomerPlayersRateModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void CustomerPlayersRateModifier_Postfix(ref float __result, int player_count)
|
||||
{
|
||||
if (Main.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value)
|
||||
if (player_count > 4)
|
||||
__result = 1 + (player_count * Main.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value);
|
||||
}
|
||||
|
||||
[HarmonyPatch("FireSpreadModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void FireSpreadModifier_Postfix(ref float __result, int player_count)
|
||||
{
|
||||
if (Main.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value)
|
||||
if (player_count > 4)
|
||||
__result = 0.75f + (player_count * Main.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value);
|
||||
}
|
||||
|
||||
[HarmonyPatch("PatiencePlayerCountModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void PatiencePlayerCountModifier_Postfix(ref float __result, int player_count)
|
||||
{
|
||||
if (Main.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Value)
|
||||
if (player_count > 4)
|
||||
__result = 0.75f + (player_count * Main.manager.GetPreference<PreferenceFloat>("scaleAbove4PlayersMultiplier").Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen.NetworkSupport;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
/*
|
||||
* This patch is used to change how many players can join the lobby using Discord.
|
||||
*/
|
||||
|
||||
[HarmonyPatch(typeof(DiscordPlatform), "CreateNewLobby")]
|
||||
public static class DiscordPlatform_Patch
|
||||
{
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (var i = 0; i < codes.Count; i++)
|
||||
if (codes[i].opcode == OpCodes.Ldc_I4_4)
|
||||
codes[i].opcode = OpCodes.Ldc_I4_8;
|
||||
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerManager), "Initialise")]
|
||||
public class PlayerManager_Patch
|
||||
{
|
||||
static void Prefix(PlayerManager __instance)
|
||||
{
|
||||
FieldInfo maxPlayers = ReflectionUtils.GetField<PlayerManager>("MaxPlayers");
|
||||
maxPlayers.SetValue(__instance, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen.NetworkSupport;
|
||||
using Steamworks;
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MMOKitchenReborn.Patches
|
||||
{
|
||||
/*
|
||||
* This patch is used to change how many players can join the lobby using Steam.
|
||||
*/
|
||||
|
||||
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
|
||||
public class SteamPlatform_Patch
|
||||
{
|
||||
public static bool Prefix(SteamPlatform __instance, Action<bool, Lobby> callback)
|
||||
{
|
||||
if (__instance.IsReady)
|
||||
{
|
||||
SteamMatchmaking.CreateLobbyAsync(12).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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using Kitchen;
|
||||
using KitchenMods;
|
||||
|
||||
namespace MMOKitchenReborn.Systems;
|
||||
|
||||
public class AnyProfileEditor : InteractionSystem, IModSystem
|
||||
{
|
||||
protected override bool IsPossible(ref InteractionData data)
|
||||
{
|
||||
return Require(data.Target, out Editor);
|
||||
}
|
||||
|
||||
protected override void Perform(ref InteractionData data)
|
||||
{
|
||||
Editor.IsTriggered = true;
|
||||
Editor.TriggerEntity = data.Interactor;
|
||||
SetComponent(data.Target, Editor);
|
||||
}
|
||||
|
||||
private CTriggerProfileEditor Editor;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.Collections.Generic;
|
||||
using Kitchen;
|
||||
using Kitchen.Modules;
|
||||
using KitchenLib;
|
||||
using KitchenLib.Preferences;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchen.Menus
|
||||
{
|
||||
public class PreferenceMenu<T> : KLMenu<T>
|
||||
{
|
||||
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<bool> scaleEnabled = new Option<bool>(new List<bool> { true, false }, Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Get(), new List<string> { "Enabled", "Disabled" });
|
||||
|
||||
public override void Setup(int player_id)
|
||||
{
|
||||
New<SpacerElement>(true);
|
||||
AddLabel("Required Consent Percentage");
|
||||
AddSelect<int>(requiredPercentage);
|
||||
requiredPercentage.OnChanged += delegate (object _, int result)
|
||||
{
|
||||
Mod.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Set(result);
|
||||
};
|
||||
|
||||
New<SpacerElement>(true);
|
||||
|
||||
AddLabel("Scale Above 4 Players");
|
||||
AddSelect<bool>(scaleEnabled);
|
||||
scaleEnabled.OnChanged += delegate (object _, bool result)
|
||||
{
|
||||
Mod.manager.GetPreference<PreferenceBool>("scaleAbove4Players").Set(result);
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate (int i)
|
||||
{
|
||||
Mod.manager.Save();
|
||||
this.RequestPreviousMenu();
|
||||
}, 0, 1f, 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using KitchenLib;
|
||||
using KitchenLib.Logging;
|
||||
using KitchenMods;
|
||||
using System.Reflection;
|
||||
using Kitchen;
|
||||
using KitchenLib.Event;
|
||||
using KitchenLib.Preferences;
|
||||
using MMOKitchen.Menus;
|
||||
|
||||
namespace MMOKitchen
|
||||
{
|
||||
public class Mod : BaseMod, IModSystem
|
||||
{
|
||||
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_AUTHOR = "StarFluxGames";
|
||||
public const string MOD_GAMEVERSION = ">=1.1.9";
|
||||
|
||||
public static KitchenLogger Logger;
|
||||
public static PreferenceManager manager;
|
||||
|
||||
public static int MaxPlayers = 100;
|
||||
|
||||
public Mod() : base(MOD_GUID, MOD_NAME, MOD_AUTHOR, MOD_VERSION, MOD_GAMEVERSION, Assembly.GetExecutingAssembly()) { }
|
||||
|
||||
protected override void OnInitialise()
|
||||
{
|
||||
Logger.LogWarning($"{MOD_GUID} v{MOD_VERSION} in use!");
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
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.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));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Kitchen.Modules;
|
||||
using KitchenLib.Preferences;
|
||||
using KitchenLib.Utils;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MMOKitchen.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(ConsentElement), "Update")]
|
||||
public class ConsentElementPatch
|
||||
{
|
||||
public static bool Prefix(ConsentElement __instance)
|
||||
{
|
||||
|
||||
PlayerManager pm = Unity.Entities.World.DefaultGameObjectInjectionWorld.GetExistingSystem<PlayerManager>();
|
||||
if (pm == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
MethodInfo updateBar = ReflectionUtils.GetMethod<ConsentElement>("UpdateBar");
|
||||
MethodInfo getProgressSpeed = ReflectionUtils.GetMethod<ConsentElement>("GetProgressSpeed");
|
||||
FieldInfo progress = ReflectionUtils.GetField<ConsentElement>("Progress");
|
||||
PropertyInfo isCompleted = AccessTools.Property(typeof(ConsentElement), "IsCompleted");
|
||||
|
||||
FieldInfo consentsSwap = ReflectionUtils.GetField<ConsentElement>("ConsentsSwap");
|
||||
|
||||
Dictionary<int, bool> x = (Dictionary<int, bool>)consentsSwap.GetValue(__instance);
|
||||
|
||||
int counter = 0;
|
||||
foreach (int y in x.Keys)
|
||||
if (x[y])
|
||||
counter++;
|
||||
|
||||
float progressSpeed = (float)getProgressSpeed.Invoke(__instance, new object[] { });
|
||||
|
||||
if ((((float)counter / (float)x.Count) * 100) >= Mod.manager.GetPreference<PreferenceInt>("requiredConsentPercentage").Value)
|
||||
progressSpeed = 1f;
|
||||
|
||||
if (progressSpeed <= 0f)
|
||||
progress.SetValue(__instance, (float)progress.GetValue(__instance) - (2f * Time.unscaledDeltaTime));
|
||||
else
|
||||
progress.SetValue(__instance, (float)progress.GetValue(__instance) + (progressSpeed * Time.unscaledDeltaTime));
|
||||
|
||||
isCompleted.SetValue(__instance, ((float)progress.GetValue(__instance) >= 1f));
|
||||
progress.SetValue(__instance, Mathf.Clamp01((float)progress.GetValue(__instance)));
|
||||
updateBar.Invoke(__instance, new object[] { });
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Preferences;
|
||||
|
||||
namespace MMOKitchen.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(DifficultyHelpers))]
|
||||
public class DifficultyHelpersPatch
|
||||
{
|
||||
[HarmonyPatch("CustomerPlayersRateModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void CustomerPlayersRateModifier_Postfix(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);
|
||||
}
|
||||
|
||||
[HarmonyPatch("FireSpreadModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void FireSpreadModifier_Postfix(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);
|
||||
}
|
||||
|
||||
[HarmonyPatch("PatiencePlayerCountModifier")]
|
||||
[HarmonyPostfix]
|
||||
static void PatiencePlayerCountModifier_Postfix(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MMOKitchen.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerManager), "GetLeastUnusedIndex")]
|
||||
public class PlayerManagerPatch
|
||||
{
|
||||
static void Prefix(PlayerManager __instance)
|
||||
{
|
||||
FieldInfo info = ReflectionUtils.GetField<PlayerManager>("MaxPlayers");
|
||||
info.SetValue(__instance, Mod.MaxPlayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using HarmonyLib;
|
||||
using Kitchen.NetworkSupport;
|
||||
using Steamworks;
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MMOKitchen.Patches
|
||||
{
|
||||
/*
|
||||
* This patch is used to change how many players can join the lobby using Steam.
|
||||
*/
|
||||
|
||||
[HarmonyPatch(typeof(SteamPlatform), "CreateNewLobby")]
|
||||
public class SteamPlatformPatch
|
||||
{
|
||||
public static bool Prefix(SteamPlatform __instance, Action<bool, Lobby> callback)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# MMOKitchen
|
||||
|
||||
## Description
|
||||
|
||||
4 Staff just isn't enough? Hire 8 more for your team!
|
||||
|
||||
MMOKitchen allows up to 12 more players to join your game!
|
||||
|
||||
## Requirements
|
||||
|
||||
- KitchenLib >= 0.3.0
|
||||
|
||||
## Installation
|
||||
|
||||
- Subscribe on the Steam Workshop
|
||||
|
||||
## Credits
|
||||
|
||||
Massive shoutouts to `bedbug1226#5243` , `ava233#3113` , `Aragami_delp_#5775`, and `Caracal#1469` for helping test this mod!
|
||||
|
||||
Massive thanks to `Aragami_delp_#5775` for finding the bug causing Network Players to have problems joining.
|
||||
@@ -0,0 +1,22 @@
|
||||
using Kitchen;
|
||||
using KitchenMods;
|
||||
|
||||
namespace MMOKitchen.Systems
|
||||
{
|
||||
public class ProfileEditorOverride : InteractionSystem, IModSystem
|
||||
{
|
||||
protected override bool IsPossible(ref InteractionData data)
|
||||
{
|
||||
return Require(data.Target, out Editor);
|
||||
}
|
||||
|
||||
protected override void Perform(ref InteractionData data)
|
||||
{
|
||||
Editor.IsTriggered = true;
|
||||
Editor.TriggerEntity = data.Interactor;
|
||||
SetComponent(data.Target, Editor);
|
||||
}
|
||||
|
||||
private CTriggerProfileEditor Editor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user