Skip to content

Commit

Permalink
overhaul compat for 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed Nov 26, 2019
1 parent 80d76e8 commit 949d13b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
3 changes: 0 additions & 3 deletions AssortedCrazyThings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,6 @@
<Reference Include="Terraria">
<HintPath>E:\Steam\SteamApps\common\Terraria\Terraria.exe</HintPath>
</Reference>
<Reference Include="TerrariaOverhaul">
<HintPath>D:\Visual Studio\References\TerrariaOverhaul.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Gores\" />
Expand Down
24 changes: 21 additions & 3 deletions Items/Tools/ExtendoNetGolden.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using AssortedCrazyThings.Projectiles.Tools;
using System;
using System.Reflection;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TerrariaOverhaul;

namespace AssortedCrazyThings.Items.Tools
{
Expand Down Expand Up @@ -42,10 +43,27 @@ public override bool CanUseItem(Player player)
// Ensures no more than one spear can be thrown out, use this when using autoReuse
return player.ownedProjectileCounts[item.shoot] < 1;
}

public void OverhaulInit()
{
this.SetTag(ItemTags.AllowQuickUse);
Mod oMod = ModLoader.GetMod("TerrariaOverhaul");
if (oMod != null)
{
try
{
Assembly TerrariaOverhaul = oMod.Code;
Type Extensions = TerrariaOverhaul.GetType(oMod.Name + ".Extensions");
MethodInfo SetTag = Extensions.GetMethod("SetTag", new Type[] { typeof(ModItem), typeof(int), typeof(bool) });
Type ItemTags = TerrariaOverhaul.GetType(oMod.Name + ".ItemTags");
FieldInfo AllowQuickUse = ItemTags.GetField("AllowQuickUse", BindingFlags.Static | BindingFlags.Public);
object AllowQuickUseValue = AllowQuickUse.GetValue(null);
SetTag.Invoke(null, new object[] { this, AllowQuickUseValue, true });
}
catch
{
ErrorLogger.Log("Failed to register Overhaul Quick Use feature to Extendo Nets");
}
}
//this.SetTag(ItemTags.AllowQuickUse);
}

public override void AddRecipes()
Expand Down
30 changes: 24 additions & 6 deletions Items/Tools/ExtendoNetRegular.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using AssortedCrazyThings.Projectiles.Tools;
using System;
using System.Reflection;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TerrariaOverhaul;

namespace AssortedCrazyThings.Items.Tools
{
Expand Down Expand Up @@ -37,16 +38,33 @@ public override void SetDefaults()
item.shoot = mod.ProjectileType<ExtendoNetRegularProj>();
}

public void OverhaulInit()
{
this.SetTag(ItemTags.AllowQuickUse);
}

public override bool CanUseItem(Player player)
{
// Ensures no more than one spear can be thrown out, use this when using autoReuse
return player.ownedProjectileCounts[item.shoot] < 1;
}
public void OverhaulInit()
{
Mod oMod = ModLoader.GetMod("TerrariaOverhaul");
if (oMod != null)
{
try
{
Assembly TerrariaOverhaul = oMod.Code;
Type Extensions = TerrariaOverhaul.GetType(oMod.Name + ".Extensions");
MethodInfo SetTag = Extensions.GetMethod("SetTag", new Type[] { typeof(ModItem), typeof(int), typeof(bool) });
Type ItemTags = TerrariaOverhaul.GetType(oMod.Name + ".ItemTags");
FieldInfo AllowQuickUse = ItemTags.GetField("AllowQuickUse", BindingFlags.Static | BindingFlags.Public);
object AllowQuickUseValue = AllowQuickUse.GetValue(null);
SetTag.Invoke(null, new object[] { this, AllowQuickUseValue, true });
}
catch
{
ErrorLogger.Log("Failed to register Overhaul Quick Use feature to Extendo Nets");
}
}
//this.SetTag(ItemTags.AllowQuickUse);
}

public override void AddRecipes()
{
Expand Down
3 changes: 1 addition & 2 deletions build.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
author = Harblesnargits, direwolf420
version = 1.3.0
displayName = Assorted Crazy Things
displayName = Assorted Crazy Things (Overhaul compat)
hideCode = true
hideResources = true
buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\*, Wiki\*
weakReferences = [email protected]
homepage = https://github.com/Werebearguy/AssortedCrazyThings/wiki

0 comments on commit 949d13b

Please sign in to comment.