Wulfrum hook uses aistyle 7

This commit is contained in:
IbanPlay committed 2022-07-12 01:40:00 +02:00
1 parent 8ffd11924d
commit 9635a74b5d
4 files changed
+7 -20

No files matched your search

-2
View File
@@ -57,7 +57,6 @@ namespace CalamityMod.ILEditing
IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw += DrawCustomLava2;
IL.Terraria.Main.oldDrawWater += DrawCustomLava3;
On.Terraria.GameContent.Drawing.TileDrawing.Draw += ClearTilePings;
On.Terraria.Player.RemoveAllGrapplingHooks += RemoveCustomGrapples;
On.Terraria.Player.GrappleMovement += CustomGrappleMovementCheck;
On.Terraria.Player.UpdatePettingAnimal += CustomGrapplePreDefaultMovement;
On.Terraria.Player.PlayerFrame += CustomGrapplePostFrame;
@@ -172,7 +171,6 @@ namespace CalamityMod.ILEditing
On.Terraria.NPC.Collision_DecideFallThroughPlatforms -= EnableCalamityBossPlatformCollision;
IL.Terraria.Wiring.HitWireSingle -= AddTwinklersToStatue;
On.Terraria.GameContent.Drawing.TileDrawing.Draw -= ClearTilePings;
On.Terraria.Player.RemoveAllGrapplingHooks -= RemoveCustomGrapples;
On.Terraria.Player.GrappleMovement -= CustomGrappleMovementCheck;
On.Terraria.Player.UpdatePettingAnimal -= CustomGrapplePreDefaultMovement;
On.Terraria.Player.PlayerFrame -= CustomGrapplePostFrame;
-13
View File
@@ -956,19 +956,6 @@ namespace CalamityMod.ILEditing
#region Custom Grappling hooks
/// <summary>
/// Custom grapples get removed when the vanilla function to remove all grapples get called, as the vanilla one relies solely on the ai stype = 7
/// </summary>
private static void RemoveCustomGrapples(On.Terraria.Player.orig_RemoveAllGrapplingHooks orig, Player self)
{
orig(self);
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == self.whoAmI && Main.projectile[i].type == ModContent.ProjectileType<WulfrumHook>())
Main.projectile[i].Kill();
}
}
/// <summary>
/// Determines if the custom grapple movement should take place or not. Useful for hooks that only do movement tricks in some cases
/// </summary>
+2 -2
View File
@@ -88,7 +88,7 @@ namespace CalamityMod.Items.Accessories
public override void OnSpawn(Projectile projectile, IEntitySource source)
{
Player owner = Main.player[projectile.owner];
if (projectile.aiStyle == 7 && owner.GetModPlayer<WulfrumPackPlayer>().WulfrumPackEquipped)
if (projectile.aiStyle == 7 && projectile.type != ProjectileType<WulfrumHook>() && owner.GetModPlayer<WulfrumPackPlayer>().WulfrumPackEquipped)
{
projectile.active = false;
}
@@ -413,7 +413,7 @@ namespace CalamityMod.Items.Accessories
for (int i = 0; i < Main.maxProjectiles; ++i)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != Player.whoAmI || p.aiStyle != 7)
if (!p.active || p.owner != Player.whoAmI || p.aiStyle != 7 || p.type == ProjectileType<WulfrumHook>())
continue;
p.Kill();
+5 -3
View File
@@ -55,13 +55,13 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.tileCollide = false;
Projectile.extraUpdates = WulfrumPackPlayer.HookUpdates;
Projectile.netImportant = true;
//Projectile.aiStyle = 7; Can i set its ai style to 7 wihle also making it not do anthing related to ai 7 whatsoever and use my own custom hook ai?
//That would bne great because fsr the onyl way to distinguish if a projectile is a hook or not is by checking its ai style.
Projectile.aiStyle = 7; //The projectile uses entirely custom AI, but for some reason terraria's only way to distinguish what is and isnt a hook is its ai style.
}
public override bool? CanDamage() => false;
public override void AI()
public override bool PreAI() => false;
public override void PostAI()
{
Lighting.AddLight(Projectile.Center, Color.DeepSkyBlue.ToVector3());
Vector2 BetweenOwner = Owner.Center - Projectile.Center;
@@ -247,5 +247,7 @@ namespace CalamityMod.Projectiles.Typeless
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, 0, 0);
return false;
}
public override bool PreDrawExtras() => false; //Prevents vanilla chain drawing from taking place
}
}