Skip to content

Commit

Permalink
etc
Browse files Browse the repository at this point in the history
  • Loading branch information
aedenthorn committed Sep 17, 2021
1 parent c028c19 commit 7ae3c01
Show file tree
Hide file tree
Showing 92 changed files with 503 additions and 432 deletions.
10 changes: 5 additions & 5 deletions AdvancedSigns/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AdvancedSigns
{
[BepInPlugin("aedenthorn.AdvancedSigns", "Advanced Signs", "0.1.1")]
[BepInPlugin("aedenthorn.AdvancedSigns", "Advanced Signs", "0.2.0")]
public class BepInExPlugin : BaseUnityPlugin
{
private static readonly bool isDebug = true;
Expand Down Expand Up @@ -111,10 +111,10 @@ private static Font GetFont(string fontName, int fontSize)
return Font.CreateDynamicFontFromOSFont(fontName, fontSize);
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand All @@ -124,8 +124,8 @@ static bool Prefix(Console __instance)
context.Config.Reload();
context.Config.Save();

Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} config reloaded" }).GetValue();
__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
12 changes: 6 additions & 6 deletions AnimationSpeed/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace AnimationSpeed
{
[BepInPlugin("aedenthorn.AnimationSpeed", "Animation Speed", "0.7.0")]
[BepInPlugin("aedenthorn.AnimationSpeed", "Animation Speed", "0.8.0")]
public class BepInExPlugin: BaseUnityPlugin
{
public static Dictionary<long, string> lastAnims = new Dictionary<long, string>();
Expand Down Expand Up @@ -214,21 +214,21 @@ public static float ChangeSpeed(Character character, Animator animator, float sp
return animator.speed;
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
string text = __instance.m_input.text;
if (text.ToLower().Equals("animationspeed reset"))
if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} reset"))
{
context.Config.Reload();
context.Config.Save();

Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { "Animation Speed config reloaded" }).GetValue();
__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
17 changes: 7 additions & 10 deletions AutoFeed/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace AutoFeed
{
[BepInPlugin("aedenthorn.AutoFeed", "Auto Feed", "0.4.0")]
[BepInPlugin("aedenthorn.AutoFeed", "Auto Feed", "0.5.0")]
public class BepInExPlugin: BaseUnityPlugin
{
public static ConfigEntry<bool> isDebug;
Expand Down Expand Up @@ -238,18 +238,14 @@ private static void ConsumeItem(ItemDrop.ItemData item, MonsterAI monsterAI, Cha
{
monsterAI.m_onConsumedItem?.Invoke(null);

(character as Humanoid).m_consumeItemEffects.Create(character.transform.position, Quaternion.identity, null, 1f);
(character as Humanoid).m_consumeItemEffects.Create(character.transform.position, Quaternion.identity, null, 1f, -1);
Traverse.Create(monsterAI).Field("m_animator").GetValue<ZSyncAnimation>().SetTrigger("consume");
if (monsterAI.m_consumeHeal > 0f)
{
character.Heal(monsterAI.m_consumeHeal, true);
}
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand All @@ -258,8 +254,9 @@ static bool Prefix(Console __instance)
{
context.Config.Reload();
context.Config.Save();
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} config reloaded" }).GetValue();

__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
9 changes: 5 additions & 4 deletions AutoFuel/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ public static async void RefuelSmelter(Smelter __instance, ZNetView ___m_nview,
}
}
}
[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand All @@ -410,8 +410,9 @@ static bool Prefix(Console __instance)
{
context.Config.Reload();
context.Config.Save();
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} config reloaded" }).GetValue();

__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
9 changes: 5 additions & 4 deletions AutoSplitStack/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ static void Postfix()
autoSplitting = false;
}
}
[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand All @@ -103,8 +103,9 @@ static bool Prefix(Console __instance)
{
context.Config.Reload();
context.Config.Save();
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} config reloaded" }).GetValue();

__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
12 changes: 7 additions & 5 deletions AutoStore/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,21 @@ static void Postfix(Container __instance, ZNetView ___m_nview)
}
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
string text = __instance.m_input.text;
if (text.ToLower().Equals("autostore reset"))
if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} reset"))
{
context.Config.Reload();
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { "AutoStore config reloaded" }).GetValue();
context.Config.Save();

__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions Backpack/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@ static void Prefix()
}
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand Down
13 changes: 5 additions & 8 deletions BackpackRedux/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace BackpackRedux
{
[BepInPlugin("aedenthorn.BackpackRedux", "Backpack Redux", "0.3.2")]
[BepInPlugin("aedenthorn.BackpackRedux", "Backpack Redux", "0.4.0")]
public class BepInExPlugin : BaseUnityPlugin
{
private static readonly bool isDebug = true;
Expand Down Expand Up @@ -277,11 +277,10 @@ static void Prefix()

}
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand All @@ -290,12 +289,10 @@ static bool Prefix(Console __instance)
{
context.Config.Reload();
context.Config.Save();

if (Player.m_localPlayer)
LoadBackpackInventory();

Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} config reloaded" }).GetValue();
__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions BuildPieceReplace/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ static void Postfix(Player __instance, bool __result, Piece piece, int ___m_plac
}


[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand Down
6 changes: 3 additions & 3 deletions BuildPieceTweaks/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace BuildPieceTweaks
{
[BepInPlugin("aedenthorn.BuildPieceTweaks", "Build Piece Tweaks", "0.2.5")]
[BepInPlugin("aedenthorn.BuildPieceTweaks", "Build Piece Tweaks", "0.3.0")]
public partial class BepInExPlugin : BaseUnityPlugin
{
private static BepInExPlugin context;
Expand Down Expand Up @@ -334,10 +334,10 @@ private static PieceData GetDataFromItem(GameObject go, string pieceName)
return pieceData;
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand Down
15 changes: 7 additions & 8 deletions BuildingDamageMod/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;

namespace BuildingDamageMod
{
[BepInPlugin("aedenthorn.BuildingDamageMod", "Building Damage Mod", "0.3.2")]
[BepInPlugin("aedenthorn.BuildingDamageMod", "Building Damage Mod", "0.4.0")]
public class BepInExPlugin: BaseUnityPlugin
{
private static readonly bool isDebug = true;
Expand All @@ -32,10 +31,10 @@ private void Awake()
{
context = this;
modEnabled = Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
creatorDamageMult = Config.Bind<float>("General", "CreatorDamagMult", 1f, "Multiply damage by creators by this much");
nonCreatorDamageMult = Config.Bind<float>("General", "NonCreatorDamagMult", 1f, "Multiply damage by non-creators by this much");
uncreatedDamageMult = Config.Bind<float>("General", "UncreatedDamagMult", 1f, "Multiply damage to uncreated buildings by this much");
naturalDamageMult = Config.Bind<float>("General", "NaturalDamagMult", 1f, "Multiply natural wear damage to buildings by this much");
creatorDamageMult = Config.Bind<float>("General", "CreatorDamageMult", 1f, "Multiply damage by creators by this much");
nonCreatorDamageMult = Config.Bind<float>("General", "NonCreatorDamageMult", 1f, "Multiply damage by non-creators by this much");
uncreatedDamageMult = Config.Bind<float>("General", "UncreatedDamageMult", 1f, "Multiply damage to uncreated buildings by this much");
naturalDamageMult = Config.Bind<float>("General", "NaturalDamageMult", 1f, "Multiply natural wear damage to buildings by this much");
nexusID = Config.Bind<int>("General", "NexusID", 233, "Nexus mod ID for updates");

if (!modEnabled.Value)
Expand All @@ -44,10 +43,10 @@ private void Awake()
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null);
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
Expand Down
26 changes: 13 additions & 13 deletions BuildingDemolish/BepInExPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace BuildingDemolish
{
[BepInPlugin("aedenthorn.BuildingDemolish", "Building Demolish", "0.4.0")]
[BepInPlugin("aedenthorn.BuildingDemolish", "Building Demolish", "0.5.0")]
public class BepInExPlugin : BaseUnityPlugin
{
private static readonly bool isDebug = true;
Expand Down Expand Up @@ -122,44 +122,44 @@ private static int DemolishPieces(float radius)
}
return count;
}

[HarmonyPatch(typeof(Console), "InputText")]
[HarmonyPatch(typeof(Terminal), "InputText")]
static class InputText_Patch
{
static bool Prefix(Console __instance)
static bool Prefix(Terminal __instance)
{
if (!modEnabled.Value)
return true;
string text = __instance.m_input.text;
if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} reset"))
{
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
context.Config.Reload();
context.Config.Save();
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} config reloaded" }).GetValue();

__instance.AddString(text);
__instance.AddString($"{context.Info.Metadata.Name} config reloaded");
return false;
}
if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} demolish"))
{
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
__instance.AddString(text);
int count = DemolishPieces(destroyRadius.Value);
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} demolished {count} pieces" }).GetValue();
__instance.AddString($"{context.Info.Metadata.Name} demolished {count} pieces");
return false;
}
if (text.ToLower().StartsWith($"{typeof(BepInExPlugin).Namespace.ToLower()} demolish "))
{
Traverse.Create(__instance).Method("AddString", new object[] { text }).GetValue();
if(int.TryParse(text.Split(' ')[2], out int radius))
__instance.AddString(text);
if (int.TryParse(text.Split(' ')[2], out int radius))
{
int count = DemolishPieces(radius);
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} demolished {count} pieces" }).GetValue();
__instance.AddString($"{context.Info.Metadata.Name} demolished {count} pieces");
}
else
Traverse.Create(__instance).Method("AddString", new object[] { $"{context.Info.Metadata.Name} syntax error" }).GetValue();
__instance.AddString($"{context.Info.Metadata.Name} syntax error");
return false;
}
return true;
}
}
}
}
}
Loading

0 comments on commit 7ae3c01

Please sign in to comment.