v0.1.6
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# Release Notes v0.1.6
|
||||||
|
|
||||||
|
- Added an extra door inside the workshop
|
||||||
|
- Added democratic voting system (Editable in Preferences, default is 50%)
|
||||||
|
- Fixed a bug causing some map layouts to not generate correctly
|
||||||
@@ -64,6 +64,9 @@
|
|||||||
<Reference Include="KitchenMods">
|
<Reference Include="KitchenMods">
|
||||||
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\KitchenMods.dll</HintPath>
|
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\KitchenMods.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Sirenix.Serialization">
|
||||||
|
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Sirenix.Serialization.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Unity.Entities">
|
<Reference Include="Unity.Entities">
|
||||||
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Unity.Entities.dll</HintPath>
|
<HintPath>..\..\..\..\Libraries\PlateUp_Data\Managed\Unity.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
+57
-1
@@ -3,9 +3,16 @@ using System.Reflection;
|
|||||||
using KitchenLib.Utils;
|
using KitchenLib.Utils;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
|
using Kitchen;
|
||||||
|
using KitchenLib.Event;
|
||||||
|
using MMOKitchen.Menus;
|
||||||
|
|
||||||
#if BEPINEX
|
#if BEPINEX
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
#endif
|
#endif
|
||||||
|
#if WORKSHOP
|
||||||
|
using KitchenMods;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MMOKitchen
|
namespace MMOKitchen
|
||||||
{
|
{
|
||||||
@@ -18,10 +25,28 @@ namespace MMOKitchen
|
|||||||
public const string MOD_ID = "mmokitchen";
|
public const string MOD_ID = "mmokitchen";
|
||||||
public const string MOD_NAME = "MMO Kitchen";
|
public const string MOD_NAME = "MMO Kitchen";
|
||||||
public const string MOD_AUTHOR = "StarFluxGames";
|
public const string MOD_AUTHOR = "StarFluxGames";
|
||||||
public const string MOD_VERSION = "0.1.5";
|
public const string MOD_VERSION = "0.1.6";
|
||||||
public const string MOD_COMPATIBLE_VERSIONS = "1.1.2";
|
public const string MOD_COMPATIBLE_VERSIONS = "1.1.2";
|
||||||
|
|
||||||
|
public const string CONSENT_REQUIRED_ID = "requiredConsent";
|
||||||
|
|
||||||
|
public int RequiredConsentPercentage;
|
||||||
public Main() : base(MOD_ID, MOD_NAME, MOD_AUTHOR, MOD_VERSION, MOD_COMPATIBLE_VERSIONS, Assembly.GetExecutingAssembly()) { }
|
public Main() : base(MOD_ID, MOD_NAME, MOD_AUTHOR, MOD_VERSION, MOD_COMPATIBLE_VERSIONS, Assembly.GetExecutingAssembly()) { }
|
||||||
|
|
||||||
|
#if BEPINEX
|
||||||
|
protected override void OnInitialise()
|
||||||
|
#endif
|
||||||
|
#if WORKSHOP
|
||||||
|
protected override void OnPostActivate(Mod mod)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
KitchenLib.IntPreference requiredConsent = PreferenceUtils.Register<KitchenLib.IntPreference>(MOD_ID, CONSENT_REQUIRED_ID, "Required Consent Percentage");
|
||||||
|
requiredConsent.Value = 50;
|
||||||
|
PreferenceUtils.Load();
|
||||||
|
RequiredConsentPercentage = PreferenceUtils.Get<KitchenLib.IntPreference>(MOD_ID, CONSENT_REQUIRED_ID).Value;
|
||||||
|
SetupPreferences();
|
||||||
|
}
|
||||||
|
|
||||||
public static Texture2D LoadImage(string base64)
|
public static Texture2D LoadImage(string base64)
|
||||||
{
|
{
|
||||||
byte[] bytes = Convert.FromBase64String(base64);
|
byte[] bytes = Convert.FromBase64String(base64);
|
||||||
@@ -30,5 +55,36 @@ namespace MMOKitchen
|
|||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupPreferences()
|
||||||
|
{
|
||||||
|
Events.PreferenceMenu_MainMenu_SetupEvent += (s, args) =>
|
||||||
|
{
|
||||||
|
Type type = args.instance.GetType().GetGenericArguments()[0];
|
||||||
|
args.mInfo.Invoke(args.instance, new object[] { MOD_NAME, typeof(MMOKitchenPreferences<>).MakeGenericType(type), false });
|
||||||
|
};
|
||||||
|
|
||||||
|
Events.PreferenceMenu_MainMenu_CreateSubmenusEvent += (s, args) =>
|
||||||
|
{
|
||||||
|
args.Menus.Add(typeof(MMOKitchenPreferences<MainMenuAction>), new MMOKitchenPreferences<MainMenuAction>(args.Container, args.Module_list));
|
||||||
|
};
|
||||||
|
|
||||||
|
//Setting Up For Pause Menu
|
||||||
|
Events.PreferenceMenu_PauseMenu_SetupEvent += (s, args) =>
|
||||||
|
{
|
||||||
|
Type type = args.instance.GetType().GetGenericArguments()[0];
|
||||||
|
args.mInfo.Invoke(args.instance, new object[] { MOD_NAME, typeof(MMOKitchenPreferences<>).MakeGenericType(type), false });
|
||||||
|
};
|
||||||
|
Events.PreferenceMenu_PauseMenu_CreateSubmenusEvent += (s, args) =>
|
||||||
|
{
|
||||||
|
args.Menus.Add(typeof(MMOKitchenPreferences<PauseMenuAction>), new MMOKitchenPreferences<PauseMenuAction>(args.Container, args.Module_list));
|
||||||
|
};
|
||||||
|
|
||||||
|
Events.PreferencesSaveEvent += (s, args) =>
|
||||||
|
{
|
||||||
|
int consentPercentage = PreferenceUtils.Get<KitchenLib.IntPreference>(MOD_ID, CONSENT_REQUIRED_ID).Value;
|
||||||
|
RequiredConsentPercentage = consentPercentage;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using Kitchen.Modules;
|
||||||
|
using Kitchen;
|
||||||
|
using KitchenLib.Utils;
|
||||||
|
using KitchenLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MMOKitchen.Menus
|
||||||
|
{
|
||||||
|
public class MMOKitchenPreferences<T> : KLMenu<T>
|
||||||
|
{
|
||||||
|
public MMOKitchenPreferences(Transform container, ModuleList module_list) : base(container, module_list)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public override void Setup(int player_id)
|
||||||
|
{
|
||||||
|
this.Percentage = new Option<int>(
|
||||||
|
new List<int>
|
||||||
|
{
|
||||||
|
25, 50, 75, 100
|
||||||
|
},
|
||||||
|
PreferenceUtils.Get<KitchenLib.IntPreference>(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value,
|
||||||
|
new List<string>
|
||||||
|
{
|
||||||
|
"25%", "50%", "75%", "100%"
|
||||||
|
});
|
||||||
|
|
||||||
|
AddLabel("Required Consent Percentage");
|
||||||
|
Add<int>(this.Percentage).OnChanged += delegate (object _, int f)
|
||||||
|
{
|
||||||
|
PreferenceUtils.Get<KitchenLib.IntPreference>(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).Value = f;
|
||||||
|
};
|
||||||
|
|
||||||
|
New<SpacerElement>();
|
||||||
|
New<SpacerElement>();
|
||||||
|
|
||||||
|
AddButton("Apply", delegate
|
||||||
|
{
|
||||||
|
PreferenceUtils.Save();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate
|
||||||
|
{
|
||||||
|
RequestPreviousMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Option<int> Percentage;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using Kitchen;
|
||||||
|
using Kitchen.Modules;
|
||||||
|
using KitchenLib.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MMOKitchen.Patches
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(ConsentElement), "Update")]
|
||||||
|
public class ConsentElement_Patch
|
||||||
|
{
|
||||||
|
public static bool Prefix(ConsentElement __instance)
|
||||||
|
{
|
||||||
|
|
||||||
|
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) >= PreferenceUtils.Get<KitchenLib.IntPreference>(Main.MOD_ID, Main.CONSENT_REQUIRED_ID).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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ namespace MMOKitchen
|
|||||||
{
|
{
|
||||||
public static void Prefix(NewFromTexture __instance)
|
public static void Prefix(NewFromTexture __instance)
|
||||||
{
|
{
|
||||||
__instance.SourceTexture = Main.LoadImage("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAMUExURQD/ACQA/+nKIQAAAOiZT8gAAAAEdFJOU////wBAKqn0AAAACXBIWXMAAA6/AAAOvwE4BVMkAAAASUlEQVQoU52MyQ0AIAgEBfrv2StcYTXReSAyLE2u/Og2p7uAjTComihrZ32ITse9U5KuvKSh3kTFrMXSNTkxPV6wAUPgOOaqRToQCQU9rUN4jgAAAABJRU5ErkJggg==");
|
__instance.SourceTexture = Main.LoadImage("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAQCAMAAAA25D/gAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAMUExURQD/ACQA/+nKIQAAAOiZT8gAAAAEdFJOU////wBAKqn0AAAACXBIWXMAAA6/AAAOvwE4BVMkAAAAS0lEQVQoU52MUQ4AIAhCU+9/5yzLbFJb8YGOJxa56geXlpqBixBkTLRjtRH0QXR6vrapDWe9tCE2RcQ8zdu52eRYJ7iAJfAc64pFKggsBTc0VJH0AAAAAElFTkSuQmCC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,27 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Kitchen;
|
using Kitchen;
|
||||||
|
using KitchenLib.Utils;
|
||||||
|
using Unity.Entities;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace MMOKitchen
|
namespace MMOKitchen
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[HarmonyPatch(typeof(LayoutBuilder), "BuildWallBetween")]
|
[HarmonyPatch(typeof(LayoutBuilder), "BuildWallBetween")]
|
||||||
public class LayoutBuilder_Patch
|
public class LayoutBuilder_Patch
|
||||||
{
|
{
|
||||||
public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2)
|
public static bool Prefix(LayoutBuilder __instance, Vector2 tile1, Vector2 tile2)
|
||||||
|
{
|
||||||
|
if (__instance.Blueprint.ID == 4771956)
|
||||||
{
|
{
|
||||||
if ((tile1 == new Vector2(-11, -5) && tile2 == new Vector2(-10, -5))
|
if ((tile1 == new Vector2(-11, -5) && tile2 == new Vector2(-10, -5))
|
||||||
|| (tile1 == new Vector2(-11, -6) && tile2 == new Vector2(-10, -6))
|
|| (tile1 == new Vector2(-11, -6) && tile2 == new Vector2(-10, -6))
|
||||||
|| (tile1 == new Vector2(-11, -7) && tile2 == new Vector2(-10, -7))
|
|| (tile1 == new Vector2(-11, -7) && tile2 == new Vector2(-10, -7))
|
||||||
|| (tile1 == new Vector2(-11, -8) && tile2 == new Vector2(-10, -8)))
|
|| (tile1 == new Vector2(-11, -8) && tile2 == new Vector2(-10, -8)))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user