52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ID;
|
|
|
|
namespace FabusMod.Projectiles.Shortsword;
|
|
|
|
public class CarbonKnife : ModProjectile
|
|
{
|
|
private const float maxTicks = 70f;
|
|
|
|
private const int alphaReducation = 25;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Carbon Knife");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.CloneDefaults(304);
|
|
AIType = 304;
|
|
Projectile.width = 14;
|
|
Projectile.height = 30;
|
|
Projectile.aiStyle = 2;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = 1;
|
|
}
|
|
|
|
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
|
{
|
|
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
|
|
{
|
|
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
|
|
}
|
|
return projHitbox.Intersects(targetHitbox);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
|
|
Vector2 position = Projectile.position;
|
|
Vector2 rotVector = Utils.ToRotationVector2(Projectile.rotation - MathHelper.ToRadians(90f));
|
|
int item = 0;
|
|
if (Main.netMode == NetmodeID.MultiplayerClient && item >= 0)
|
|
{
|
|
NetMessage.SendData(MessageID.KillProjectile);
|
|
}
|
|
}
|
|
}
|