Files
CalamityModPublic/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs
T
CongratsIsTrash e0e167346e Added ProjectileID.Sets.CultistIsResistantTo on every homing projectile in Calamity
This does nothing for Calamity since we disable Cultist's homing resist.
However, since this is effectively used as a homing projectile set, this will help with crossmod compatibility.
I ask that everyone else who changes homing projectiles in any way to help maintain this.
2024-09-09 23:52:07 -04:00

61 lines
1.9 KiB
C#

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class TrackingDiskLaser : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Misc";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public float Time
{
get => Projectile.localAI[0];
set => Projectile.localAI[0] = value;
}
public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true;
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 2;
Projectile.friendly = true;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.tileCollide = false;
Projectile.penetrate = 1;
Projectile.extraUpdates = 100;
Projectile.timeLeft = 600;
Projectile.ArmorPenetration = 10;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f);
Time++;
if (Time >= 10f)
{
for (int i = 0; i < 2; i++)
{
Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.TheDestroyer, 0f, 0f, 160, default, 2f);
dust.position = Projectile.Center;
dust.velocity = Projectile.velocity;
dust.scale = Projectile.scale;
dust.noGravity = true;
}
}
}
public override void OnKill(int timeLeft)
{
Projectile.ExpandHitboxBy(60);
Projectile.maxPenetrate = -1;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Damage();
}
}
}