Sand & Sandgun changes & fixes

Fixed our sandball collision logic to work like Vanilla sand.

Adjusted damages of prehardmode falling sands to match Vanilla sand at 10. Astral stays 15, and Eutrophic is 5 due to sandgun balancing. (This is OK since most of the sand damage to a player comes from suffocation)

All our sands can now be fired by Sandgun and have unique effects depending on the sand. (For context, Vanilla Evil/Hallow sand does +5 damage and pierces infinitely)
- Sulphur Sand hits 2 targets and inflicts Irradiated
- Dunesand has lower velocity, infinte piercing, +5 damage, and longer time without gravity
- Eutrophic Sand has -5 damage and inflicts Eutrophication
- Polyp Sand has minor homing and ignores platforms
- Volcanic Sand does much less damage, but fires an additional short range shotgun blast
- Astral Sand splits into 5 homing sandballs on hit
This commit is contained in:
Doze-Zoze committed 2025-09-22 22:16:44 -05:00
1 parent 21b26521ed
commit c66d71006e
12 files changed
+231 -26

No files matched your search

+1 -2
View File
@@ -12,8 +12,7 @@ namespace CalamityMod.Items.Placeables.Abyss
Item.ResearchUnlockCount = 100;
ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType<SulphurousShale>();
// +5 flat damage, equal to other sand variants
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<SulphurousSandBallGun>(), 5);
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<SulphurousSandBallGun>(), 0);
}
public override void SetDefaults()
+1 -2
View File
@@ -13,8 +13,7 @@ namespace CalamityMod.Items.Placeables.Astral
Item.ResearchUnlockCount = 100;
ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SandBlock, 1);
// +5 flat damage, equal to other sand variants
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<AstralSandBallGun>(), 5);
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<AstralSandBallGun>(), 0);
}
public override void SetDefaults()
+11 -2
View File
@@ -1,4 +1,5 @@
using Terraria.ID;
using CalamityMod.Projectiles.Typeless;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.SunkenSea
@@ -11,8 +12,16 @@ namespace CalamityMod.Items.Placeables.SunkenSea
{
Item.ResearchUnlockCount = 100;
ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType<Shellstone>();
//+5 flat damage
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<DuneSandBallGun>(), 5);
}
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.Dunesand>());
public override void SetDefaults()
{
Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.Dunesand>());
Item.ammo = AmmoID.Sand;
Item.notAmmo = true;
}
}
}
+2 -2
View File
@@ -14,8 +14,8 @@ namespace CalamityMod.Items.Placeables.SunkenSea
Item.ResearchUnlockCount = 100;
ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType<Navystone>();
// +5 flat damage, equal to other sand variants
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<EutrophicSandBallGun>(), 5);
// -5 flat damage
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<EutrophicSandBallGun>(),-5);
}
public override void SetDefaults()
+10 -2
View File
@@ -1,4 +1,5 @@
using Terraria.ID;
using CalamityMod.Projectiles.Typeless;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.SunkenSea
@@ -9,8 +10,15 @@ namespace CalamityMod.Items.Placeables.SunkenSea
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 100;
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<PolypSandBallGun>(), 0);
}
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.PolypSand>());
public override void SetDefaults()
{
Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.PolypSand>());
Item.ammo = AmmoID.Sand;
Item.notAmmo = true;
}
}
}
+9 -2
View File
@@ -1,4 +1,5 @@
using Terraria.ID;
using CalamityMod.Projectiles.Typeless;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.SunkenSea
@@ -9,8 +10,14 @@ namespace CalamityMod.Items.Placeables.SunkenSea
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 100;
ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType<VolcanicSandBallGun>(), 0);
}
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.VolcanicSand>());
public override void SetDefaults()
{
Item.DefaultToPlaceableTile(ModContent.TileType<Tiles.SunkenSea.VolcanicSand>());
Item.ammo = AmmoID.Sand;
Item.notAmmo = true;
}
}
}
@@ -170,3 +170,6 @@ PinkPearlFalling.DisplayName: Pink Pearl Falling
PolypSandBallFalling.DisplayName: Polyp Sand Ball Falling
VolcanicSandBallFalling.DisplayName: Volcanic Sand Ball Falling
WhitePearlFalling.DisplayName: White Pearl Falling
DuneSandBallGun.DisplayName: Dunesandball
PolypSandBallGun.DisplayName: Polyp Sandball
VolcanicSandBallGun.DisplayName: Volcanic Sandball
+190 -10
View File
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Placeables.Abyss;
using CalamityMod.Items.Placeables.Astral;
using CalamityMod.Items.Placeables.SunkenSea;
@@ -90,6 +91,52 @@ namespace CalamityMod.Projectiles.Typeless
public override int TileType => ModContent.TileType<Tiles.AstralDesert.AstralSand>();
public override int ItemType => ModContent.ItemType<Items.Placeables.Astral.AstralSand>();
public override int DustType => 108;
//Doze: I'm giving our sandgun sands actual special effects because it's more interesting
//This one hits only one target but splits on impact into seeking mini sands
public override void SetDefaults()
{
base.SetDefaults();
Projectile.penetrate = 1;
Projectile.localNPCHitCooldown = 10;
Projectile.usesLocalNPCImmunity = true;
Projectile.usesIDStaticNPCImmunity = false;
}
public override bool PreAI()
{
if (Projectile.ai[2] == 1)
{
Projectile.scale = 0.75f;
if (Projectile.ai[1] == 0)
{
Projectile.originalDamage = Projectile.damage;
Projectile.damage = 0;
}
if (Projectile.ai[1] == 30)
{
Projectile.Calamity().conditionalHomingRange = 600;
Projectile.damage = Projectile.originalDamage;
}
}
return base.PreAI();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (Projectile.ai[2] != 1)
{
for (var i = 0; i < 4; i++)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f,0.75f), ModContent.ProjectileType<AstralSandBallGun>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, ai2: 1);
}
}
public override bool PreKill(int timeLeft)
{
if (Projectile.penetrate == 0)
Projectile.active = false;
return Projectile.active;
}
}
public class EutrophicSandBallGun : SandBall
@@ -98,6 +145,19 @@ namespace CalamityMod.Projectiles.Typeless
public override int TileType => ModContent.TileType<Tiles.SunkenSea.EutrophicSand>();
public override int ItemType => ModContent.ItemType<Items.Placeables.SunkenSea.EutrophicSand>();
public override int DustType => 108; // Weirdly same dusts as Astral
//Doze: I'm giving our sandgun sands actual special effects because it's more interesting
//This one hits only one target and does 5 less damage, but inflicts a relatively long stun debuff
public override void SetDefaults()
{
base.SetDefaults();
Projectile.penetrate = 1;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Eutrophication>(), 300);
}
}
public class SulphurousSandBallGun : SandBall
@@ -106,6 +166,128 @@ namespace CalamityMod.Projectiles.Typeless
public override int TileType => ModContent.TileType<Tiles.Abyss.SulphurousSand>();
public override int ItemType => ModContent.ItemType<Items.Placeables.Abyss.SulphurousSand>();
// Uses normal sand dust
//Doze: I'm giving our sandgun sands actual special effects because it's more interesting
//This one hits only two targets but inflicts Irradiated
public override void SetDefaults()
{
base.SetDefaults();
Projectile.penetrate = 2;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 150);
}
}
public class DuneSandBallGun : SandBall
{
public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune";
public override int TileType => ModContent.TileType<Tiles.SunkenSea.Dunesand>();
public override int ItemType => ModContent.ItemType<Items.Placeables.SunkenSea.Dunesand>();
public override int DustType => DustID.Sand;
//Doze: I'm giving our sandgun sands actual special effects because it's more interesting
//This one has much less velocity and no gravity for the first 3 seconds, pierces infinitely, and does 5 extra damage
public override void AI()
{
if (Projectile.ai[1] == 0 )
{
Projectile.velocity *= 0.5f;
}
if (Main.rand.NextBool())
{
int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType);
Main.dust[i].velocity.X *= 0.4f;
Main.dust[i].velocity.Y += Fired ? 0f : Projectile.velocity.Y * 0.5f;
}
Projectile.ai[1]++;
Projectile.rotation += 0.1f;
if (Projectile.ai[1] >= 180f)
{
Projectile.ai[1] = 180f;
Projectile.velocity.Y += 0.2f;
}
if (Projectile.velocity.Y > 10f)
Projectile.velocity.Y = 10f;
Point p = Projectile.Center.ToTileCoordinates();
// Don't check out of bounds
if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY)
return;
Tile placer = Main.tile[p.X, p.Y + 1];
if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f)
Projectile.Kill();
}
}
public class PolypSandBallGun : SandBall
{
public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallPolyp";
public override int TileType => ModContent.TileType<Tiles.SunkenSea.PolypSand>();
public override int ItemType => ModContent.ItemType<Items.Placeables.SunkenSea.PolypSand>();
public override int DustType => DustID.Sand;
//Doze: I'm giving our sandgun sands actual special effects because it's more interesting
//This one has a small homing range and can go through platforms
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
fallThrough = true;
return true;
}
public override void SetDefaults()
{
base.SetDefaults();
Projectile.penetrate = 1;
Projectile.Calamity().conditionalHomingRange = 160;
}
}
public class VolcanicSandBallGun : SandBall
{
public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallVolcanic";
public override int TileType => ModContent.TileType<Tiles.SunkenSea.EutrophicSand>();
public override int ItemType => ModContent.ItemType<Items.Placeables.SunkenSea.VolcanicSand>();
public override int DustType => -1;
//Doze: I'm giving our sandgun sands actual special effects because it's more interesting
//This one fires a shotgun of mini sands, but every sand deals less damage
public override void SetDefaults()
{
base.SetDefaults();
Projectile.localNPCHitCooldown = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.usesIDStaticNPCImmunity = false;
}
public override bool PreAI()
{
if (Projectile.ai[2] == 1)
{
if (Projectile.ai[1] == 0)
{
Projectile.scale = 0.75f;
Projectile.penetrate = 1;
Projectile.timeLeft = 30;
}
} else
{
if (Projectile.ai[1] == 0)
{
for (var i = 0; i < 5; i++)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * 0.75f, ModContent.ProjectileType<VolcanicSandBallGun>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, ai2: 1);
Projectile.damage = (int)(Projectile.damage * 0.5f);
}
}
return base.PreAI();
}
public override bool PreKill(int timeLeft)
{
if (Projectile.ai[2] == 1) //Baby sands should always vanish without placing blocks
Projectile.active = false;
return Projectile.active;
}
}
// All the setups go here to prevent mass blocks of copypasting
@@ -143,7 +325,7 @@ namespace CalamityMod.Projectiles.Typeless
// Using clones will not allow for custom dust types sadly
public override void AI()
{
if (Main.rand.NextBool())
if (Main.rand.NextBool() && DustType >= 0)
{
int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType);
Main.dust[i].velocity.X *= 0.4f;
@@ -159,21 +341,19 @@ namespace CalamityMod.Projectiles.Typeless
}
if (Projectile.velocity.Y > 10f)
Projectile.velocity.Y = 10f;
}
Point p = Projectile.Center.ToTileCoordinates();
// Don't check out of bounds
if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY)
return;
Tile placer = Main.tile[p.X, p.Y + 1];
if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f)
Projectile.Kill();
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
fallThrough = false;
return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac);
}
public override void OnKill(int timeLeft)
{
Point p = Projectile.Center.ToTileCoordinates();
// If the sand is dying outside the world border, cancel placing sand.
if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY)
// If the sand is dying outside the world border, or having used all of it's pierce, cancel placing sand.
if ( p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY)
return;
Tile placer = Main.tile[p.X, p.Y];
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.SunkenSea
TileID.Sets.Conversion.Sand[Type] = true;
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
TileID.Sets.Falling[Type] = true;
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<DunesandBallFalling>(), 15);
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<DunesandBallFalling>(), 10);
this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge");
this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge");
+1 -1
View File
@@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.SunkenSea
TileID.Sets.Conversion.Sand[Type] = true;
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
TileID.Sets.Falling[Type] = true;
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<EutrophicSandBallFalling>(), 15);
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<EutrophicSandBallFalling>(), 5);
this.RegisterUniversalMerge(ModContent.TileType<EutrophicSand>(), "CalamityMod/Tiles/Merges/EutrophicSandMerge");
this.RegisterUniversalMerge(ModContent.TileType<Navystone>(), "CalamityMod/Tiles/Merges/NavystoneMerge");
+1 -1
View File
@@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.SunkenSea
TileID.Sets.Conversion.Sand[Type] = true;
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
TileID.Sets.Falling[Type] = true;
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<PolypSandBallFalling>(), 15);
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<PolypSandBallFalling>(), 10);
this.RegisterUniversalMerge(ModContent.TileType<Shellstone>(), "CalamityMod/Tiles/Merges/ShellstoneMerge");
this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge");
+1 -1
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.SunkenSea
TileID.Sets.Conversion.Sand[Type] = true;
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
TileID.Sets.Falling[Type] = true;
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<VolcanicSandBallFalling>(), 15);
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<VolcanicSandBallFalling>(), 10);
//Stone merges
this.RegisterUniversalMerge(ModContent.TileType<Shellstone>(), "CalamityMod/Tiles/Merges/ShellstoneMerge");