Skip to content

Commit

Permalink
Fix modded items inside Autofisher + typo
Browse files Browse the repository at this point in the history
  • Loading branch information
gardenappl committed Aug 15, 2018
1 parent d9baca2 commit 4b75cac
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion AutofisherHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static class AutofisherHooks
{
static Dictionary<HookType, List<MethodInfo>> hooks = new Dictionary<HookType, List<MethodInfo>>();

public static void Initialize()
static AutofisherHooks()
{
hooks[HookType.CatchFish] = new List<MethodInfo>();
hooks[HookType.GetFishingLevel] = new List<MethodInfo>();
Expand Down
2 changes: 1 addition & 1 deletion Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static void LoadFKConfig()

setting.AddComment("Stat changes and new early game gem staves", commentScale);
setting.AddBool(AltStaffsKey, "Alternate Staves", false);
setting.AddComment("Magic stones that replуnish health and mana for a number of uses.", commentScale);
setting.AddComment("Magic stones that replenish health and mana for a number of uses.", commentScale);
setting.AddBool(MagicStonesKey, "Magic Stones", false);
setting.AddComment("Unobtainable God Mode item(use Cheat Sheet or another mod.)", commentScale);
setting.AddBool(GodStoneKey, "God Stone", false);
Expand Down
13 changes: 11 additions & 2 deletions GoldensMisc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
using System.Linq;

namespace GoldensMisc
{
Expand All @@ -40,11 +41,10 @@ public GoldensMisc()
public override void Load()
{
Instance = this; //apparently you get some problems with Mod Reloading if you put this in the constructor
FixCSharp6CompilerIssueThing();
FKtModSettingsLoaded = ModLoader.GetMod("FKTModSettings") != null;
VanillaTweaksLoaded = ModLoader.GetMod("VanillaTweaks") != null;

AutofisherHooks.Initialize();

if(!Main.dedServ)
{
if(FKtModSettingsLoaded)
Expand Down Expand Up @@ -80,6 +80,15 @@ public override void Load()
AddProjectile("MagicSpearMiniAlt", new MagicSpearMini());
}
}

static void FixCSharp6CompilerIssueThing()
{
var thing = Enumerable.Range(5, 10);
foreach(int i in thing)
{
//nothing
}
}

public override void PostSetupContent()
{
Expand Down
2 changes: 1 addition & 1 deletion GoldensMisc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>E:\Yurik\Steam\SteamApps\common\Terraria\Terraria.exe -build "$(ProjectDir)\" -savedirectory "E:\Yurik\Terraria"</PreBuildEvent>
<PreBuildEvent>E:\Yurik\Steam\SteamApps\common\Terraria\tModLoaderServer.exe -build "$(ProjectDir)\" -savedirectory "E:\Yurik\Terraria"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
Expand Down
7 changes: 1 addition & 6 deletions Projectiles/AutofisherBobber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ public override void SetDefaults()
//ai[1] - tile entity ID
public override void AI()
{
//Main.NewText(projectile.ai[1]);
if(!TileEntity.ByID.ContainsKey((int)projectile.ai[1]) || !(TileEntity.ByID[(int)projectile.ai[1]] is AutofisherTE))
{
projectile.Kill();
//Main.NewText("kill me");
return;
}
var te = (AutofisherTE)TileEntity.ByID[(int)projectile.ai[1]];
Expand Down Expand Up @@ -142,7 +140,7 @@ public override void AI()
Rectangle rectangle2 = new Rectangle(te.Position.X * 16, te.Position.Y * 16, 48, 32);
if(((Rectangle)rectangle1).Intersects(rectangle2))
{
if((double)projectile.ai[0] > 0.0 && (double)projectile.ai[0] < 3930.0)
if((double)projectile.ai[0] > 0.0)
{
int Type = (int)projectile.ai[0];
Item newItem = new Item();
Expand Down Expand Up @@ -189,7 +187,6 @@ public override void AI()
}
else
{
//Main.NewText("just fishin");
//bool flag = false;
//Vector2 vector2 = new Vector2((float)(projectile.position.X + (double)projectile.width * 0.5), (float)(projectile.position.Y + (double)projectile.height * 0.5));
//float num1 = (float)(Main.player[projectile.owner].position.X + (double)(Main.player[projectile.owner].width / 2) - vector2.X);
Expand All @@ -199,7 +196,6 @@ public override void AI()
// projectile.ai[0] = 1f;
if(projectile.wet)
{
//Main.NewText("wet");
projectile.rotation = 0.0f;
projectile.velocity.X *= 0.9f;
int index1 = (int)(projectile.Center.X + (double)((projectile.width / 2 + 8) * projectile.direction)) / 16;
Expand Down Expand Up @@ -443,7 +439,6 @@ public int FishingCheck()
// num18 += 10;
int type = -1;
var zone = MiscUtils.GetZoneInLocation(te.Position.X, te.Position.Y);
//Main.NewText(zone);

bool junk = false;

Expand Down
4 changes: 0 additions & 4 deletions Tiles/AutofisherTE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ public override void Update()
if(baitItem != null && (bobberProj == -1 || !Main.projectile[bobberProj].active ||
Main.projectile[bobberProj].type != mod.ProjectileType<AutofisherBobber>()))
{
//Main.NewText("new proj!");
var bobberPos = new Point(Position.X + (facingRight ? 2 : 0), Position.Y).ToWorldCoordinates();
bobberProj = Projectile.NewProjectile(bobberPos, new Vector2(facingRight ? 3f : -3f, 0f), mod.ProjectileType<AutofisherBobber>(), 0, 0, ai1: this.ID);
Main.projectile[bobberProj].ai[1] = this.ID;
Main.projectile[bobberProj].netUpdate = true;
}
//Main.NewText(FishingCooldown);
if(FishingCooldown > 0)
{
FishingCooldown--;
Expand All @@ -64,7 +62,6 @@ public override void Update()
{
if(Main.rand.Next(150) == 1)
{
//Main.NewText("hello!");
FishingCooldown = 500;
int itemType = 0;
try
Expand Down Expand Up @@ -126,7 +123,6 @@ public int GetFishingLevel(Item baitItem)
power = (int)((double)power * 0.949999988079071);
if(Main.moonPhase == 4)
power = (int)((double)power * 0.899999976158142);
//Main.NewText("raw fish power: " + num2);
AutofisherHooks.GetFishingLevel(this, baitItem, ref power);
return power;
}
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
displayName = Miscellania
author = goldenapple
version = 1.6.3
version = 1.6.4
homepage = http://forums.terraria.org/index.php?threads/miscellania.39500/
hideResources = false
hideCode = false
Expand Down

0 comments on commit 4b75cac

Please sign in to comment.