moved util location and fix
This commit is contained in:
1 parent
10f5613fb4
commit
bda06b5aa0
30 files changed
+130
-98
No files matched your search
@@ -68,6 +68,7 @@ using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.Systems.Mechanic;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -3929,13 +3930,13 @@ namespace CalamityMod.CalPlayer
|
||||
d.velocity = Main.rand.NextVector2Unit() * spreadSpeed;
|
||||
|
||||
Vector2 segmentTwoPos = Player.Center + segmentTwoStart + segmentTwoIncrement * interpolant;
|
||||
d = CalamityUtils.SafeCloneDust(d);
|
||||
d = Dust.BetterCloneDust(d);
|
||||
d.position = segmentTwoPos;
|
||||
d.scale = Main.rand.NextFloat(1.2f, 1.8f);
|
||||
d.velocity = Main.rand.NextVector2Unit() * spreadSpeed;
|
||||
|
||||
Vector2 segmentThreePos = Player.Center + segmentThreeStart + segmentThreeIncrement * interpolant;
|
||||
d = CalamityUtils.SafeCloneDust(d);
|
||||
d = Dust.BetterCloneDust(d);
|
||||
d.position = segmentThreePos;
|
||||
d.scale = Main.rand.NextFloat(1.2f, 1.8f);
|
||||
d.velocity = Main.rand.NextVector2Unit() * spreadSpeed;
|
||||
|
||||
@@ -45,6 +45,7 @@ using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.UI;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -2101,9 +2102,9 @@ namespace CalamityMod.CalPlayer
|
||||
d.velocity = dustVel;
|
||||
d.noGravity = true;
|
||||
d.scale *= Main.rand.NextFloat(1.1f, 1.4f);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient;
|
||||
using CalamityMod.Tiles.FurnitureAuric;
|
||||
using CalamityMod.Tiles.Ores;
|
||||
using CalamityMod.UI;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -1672,7 +1673,7 @@ namespace CalamityMod.CalPlayer
|
||||
holyDust.noGravity = true;
|
||||
holyDust.scale = 1f;
|
||||
holyDust.fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dustClone = CalamityUtils.SafeCloneDust(holyDust);
|
||||
Dust dustClone = Dust.BetterCloneDust(holyDust);
|
||||
Dust extraDust = dustClone;
|
||||
extraDust.scale /= 2f;
|
||||
extraDust = dustClone;
|
||||
|
||||
@@ -15,6 +15,7 @@ using CalamityMod.Items.Weapons.Typeless;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -253,7 +254,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
|
||||
@@ -6,6 +6,7 @@ using CalamityMod.Events;
|
||||
using CalamityMod.Items.Tools;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -196,7 +197,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
|
||||
@@ -5,6 +5,7 @@ using CalamityMod.Events;
|
||||
using CalamityMod.Items.Tools;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -375,7 +376,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f + k;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
|
||||
@@ -30,6 +30,7 @@ using CalamityMod.Projectiles.Summon;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Systems.Graphic;
|
||||
using CalamityMod.Tiles.Ores;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -707,7 +708,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
@@ -1353,7 +1354,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 3f;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
@@ -1644,7 +1645,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f + i;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
@@ -1253,7 +1254,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
Main.dust[despawnRainbowDust].scale = 0.35f;
|
||||
if (despawnRainbowDust != 6000)
|
||||
{
|
||||
Dust dust = CalamityUtils.SafeCloneDust(despawnRainbowDust);
|
||||
Dust dust = Dust.BetterCloneDust(despawnRainbowDust);
|
||||
dust.scale /= 2f;
|
||||
dust.fadeIn *= 0.85f;
|
||||
dust.color = new Color(255, 255, 255, 255);
|
||||
@@ -1317,7 +1318,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
Main.dust[dust].scale = 0.35f;
|
||||
if (dust != Main.maxDust)
|
||||
{
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
dust2.scale /= 2f;
|
||||
dust2.fadeIn *= 0.85f;
|
||||
dust2.color = new Color(255, 255, 255, 255);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.IO;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
holyDust.fadeIn = fadeIn;
|
||||
holyDust.scale = dustScale;
|
||||
holyDust.noLight = true;
|
||||
Dust holyDust2 = CalamityUtils.SafeCloneDust(holyDust);
|
||||
Dust holyDust2 = Dust.BetterCloneDust(holyDust);
|
||||
Dust dust = holyDust2;
|
||||
dust.scale *= 0.65f;
|
||||
dust = holyDust2;
|
||||
@@ -182,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Main.dust[killDust].noGravity = true;
|
||||
Main.dust[killDust].scale = 2f;
|
||||
Main.dust[killDust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust killDustClone = CalamityUtils.SafeCloneDust(killDust);
|
||||
Dust killDustClone = Dust.BetterCloneDust(killDust);
|
||||
Dust dust = killDustClone;
|
||||
dust.scale /= 2f;
|
||||
dust = killDustClone;
|
||||
@@ -199,7 +200,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat() * 1f;
|
||||
dust.fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust killDustClone2 = CalamityUtils.SafeCloneDust(killDust2);
|
||||
Dust killDustClone2 = Dust.BetterCloneDust(killDust2);
|
||||
dust = killDustClone2;
|
||||
dust.scale /= 2f;
|
||||
dust = killDustClone2;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
@@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Main.dust[dust].scale = 0.7f;
|
||||
if (dust != Main.maxDust)
|
||||
{
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
dust2.scale /= 2f;
|
||||
dust2.fadeIn *= 0.85f;
|
||||
dust2.color = new Color(255, 255, 255, 255);
|
||||
@@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Main.dust[dust].scale = 0.7f;
|
||||
if (dust != Main.maxDust)
|
||||
{
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
dust2.scale /= 2f;
|
||||
dust2.fadeIn *= 0.85f;
|
||||
dust2.color = new Color(255, 255, 255, 255);
|
||||
@@ -148,7 +149,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Main.dust[dust].scale = 1.4f;
|
||||
if (dust != Main.maxDust)
|
||||
{
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
dust2.scale /= 2f;
|
||||
dust2.fadeIn *= 0.85f;
|
||||
dust2.color = new Color(255, 255, 255, 255);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -143,7 +144,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Main.dust[rainbowDust].noGravity = true;
|
||||
if (Projectile.scale != 1.4f)
|
||||
{
|
||||
Dust rainbowClone = CalamityUtils.SafeCloneDust(rainbowDust);
|
||||
Dust rainbowClone = Dust.BetterCloneDust(rainbowDust);
|
||||
rainbowClone.color = color;
|
||||
rainbowClone.scale /= 2f;
|
||||
rainbowClone.noGravity = true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -417,7 +418,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
dust.color = Color.SkyBlue;
|
||||
dust.fadeIn = 1.5f;
|
||||
|
||||
dust = CalamityUtils.SafeCloneDust(dust);
|
||||
dust = Dust.BetterCloneDust(dust);
|
||||
dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints).RotatedBy(offsetAngle) * new Vector2(-1f, 1f);
|
||||
}
|
||||
}
|
||||
@@ -649,7 +650,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
dust.scale = 1.4f;
|
||||
dust.noGravity = true;
|
||||
|
||||
dust = CalamityUtils.SafeCloneDust(dust);
|
||||
dust = Dust.BetterCloneDust(dust);
|
||||
dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints) * new Vector2(1f, -1f) + new Vector2(30f, -12f);
|
||||
}
|
||||
}
|
||||
@@ -691,7 +692,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
dust.color = Color.Purple;
|
||||
dust.fadeIn = 1.5f;
|
||||
|
||||
dust = CalamityUtils.SafeCloneDust(dust);
|
||||
dust = Dust.BetterCloneDust(dust);
|
||||
dust.velocity = dust.velocity.RotatedBy(MathHelper.PiOver4);
|
||||
dust.color = Color.White;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -195,7 +196,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
// If the beam isn't at max scale, then make additional smaller dust.
|
||||
if (Projectile.scale != MaxBeamScale)
|
||||
{
|
||||
Dust smallDust = CalamityUtils.SafeCloneDust(d);
|
||||
Dust smallDust = Dust.BetterCloneDust(d);
|
||||
smallDust.scale /= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -275,7 +276,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
// If the beam isn't at max scale, then make additional smaller dust.
|
||||
if (Projectile.scale != MaxBeamScale)
|
||||
{
|
||||
Dust smallDust = CalamityUtils.SafeCloneDust(d);
|
||||
Dust smallDust = Dust.BetterCloneDust(d);
|
||||
smallDust.scale /= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
@@ -123,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
fire.noGravity = true;
|
||||
fire.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f;
|
||||
|
||||
fire = CalamityUtils.SafeCloneDust(fire);
|
||||
fire = Dust.BetterCloneDust(fire);
|
||||
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
|
||||
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
|
||||
}
|
||||
@@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
fire.noGravity = true;
|
||||
fire.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f;
|
||||
|
||||
fire = CalamityUtils.SafeCloneDust(fire);
|
||||
fire = Dust.BetterCloneDust(fire);
|
||||
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
|
||||
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using CalamityMod.Dusts;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
@@ -166,7 +167,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
fire.noGravity = true;
|
||||
fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer;
|
||||
|
||||
fire = CalamityUtils.SafeCloneDust(fire);
|
||||
fire = Dust.BetterCloneDust(fire);
|
||||
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
|
||||
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -48,8 +49,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
crystalShard.color = Color.Yellow;
|
||||
crystalShard.noGravity = true;
|
||||
|
||||
CalamityUtils.SafeCloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * 0.666f) * i / 4f;
|
||||
CalamityUtils.SafeCloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * -0.666f) * i / 4f;
|
||||
Dust.BetterCloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * 0.666f) * i / 4f;
|
||||
Dust.BetterCloneDust(crystalShard).velocity = initialVelocity.RotatedBy(MathHelper.Pi * -0.666f) * i / 4f;
|
||||
}
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
risingMagic.scale = Main.rand.NextFloat(0.6f, 1.2f);
|
||||
risingMagic.noLight = true;
|
||||
|
||||
risingMagic = CalamityUtils.SafeCloneDust(risingMagic);
|
||||
risingMagic = Dust.BetterCloneDust(risingMagic);
|
||||
risingMagic.scale *= 0.65f;
|
||||
risingMagic.fadeIn *= 0.65f;
|
||||
risingMagic.color = new Color(255, 255, 255, 255);
|
||||
@@ -183,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
explosionDust.scale = 1.1f;
|
||||
explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f);
|
||||
|
||||
explosionDust = CalamityUtils.SafeCloneDust(explosionDust);
|
||||
explosionDust = Dust.BetterCloneDust(explosionDust);
|
||||
explosionDust.scale /= 2f;
|
||||
explosionDust.fadeIn /= 2f;
|
||||
explosionDust.color = new Color(255, 255, 255, 255);
|
||||
@@ -198,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
explosionDust.scale = Main.rand.NextFloat();
|
||||
explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f);
|
||||
|
||||
explosionDust = CalamityUtils.SafeCloneDust(explosionDust);
|
||||
explosionDust = Dust.BetterCloneDust(explosionDust);
|
||||
explosionDust.scale /= 2f;
|
||||
explosionDust.fadeIn /= 2f;
|
||||
explosionDust.color = new Color(255, 255, 255, 255);
|
||||
|
||||
@@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
@@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
fire.noGravity = true;
|
||||
fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer;
|
||||
|
||||
fire = CalamityUtils.SafeCloneDust(fire);
|
||||
fire = Dust.BetterCloneDust(fire);
|
||||
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
|
||||
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
|
||||
fire.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Utilities;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -237,7 +238,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// If the beam isn't at max scale, then make additional smaller dust.
|
||||
if (Projectile.scale != MaxBeamScale)
|
||||
{
|
||||
Dust smallDust = CalamityUtils.SafeCloneDust(d);
|
||||
Dust smallDust = Dust.BetterCloneDust(d);
|
||||
smallDust.scale /= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Utilities;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
@@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
fire.color = Color.Lerp(Color.White, Color.Purple, Main.rand.NextFloat());
|
||||
fire.scale = Main.rand.NextFloat(1f, 1.1f);
|
||||
|
||||
fire = CalamityUtils.SafeCloneDust(fire);
|
||||
fire = Dust.BetterCloneDust(fire);
|
||||
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
|
||||
fire.velocity += Projectile.velocity * 0.6f;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using Terraria.GameContent.Shaders;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Utilities;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
@@ -262,7 +263,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// If the beam isn't at max scale, then make additional smaller dust.
|
||||
if (Projectile.scale != MaxBeamScale)
|
||||
{
|
||||
Dust smallDust = CalamityUtils.SafeCloneDust(d);
|
||||
Dust smallDust = Dust.BetterCloneDust(d);
|
||||
smallDust.scale /= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
@@ -195,8 +196,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
d.fadeIn = 1.5f;
|
||||
d.scale *= Main.rand.NextFloat(1.4f, 1.9f) - lerp * 0.5f;
|
||||
d.color = Color.Lerp(Color.Cyan, Color.Magenta, lerp);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 2f / 3f);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 4f / 3f);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 2f / 3f);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 4f / 3f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,9 +245,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
d.scale *= Main.rand.NextFloat(1.8f, 2.2f) * (1 - speed / 7);
|
||||
d.color = color;
|
||||
d.fadeIn = 1;
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi);
|
||||
CalamityUtils.SafeCloneDust(d).velocity = dustVel.RotatedBy(-MathHelper.PiOver2);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi);
|
||||
Dust.BetterCloneDust(d).velocity = dustVel.RotatedBy(-MathHelper.PiOver2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
prismaticEnergy.color = dustColor;
|
||||
prismaticEnergy.noGravity = true;
|
||||
|
||||
prismaticEnergy = CalamityUtils.SafeCloneDust(prismaticEnergy);
|
||||
prismaticEnergy = Dust.BetterCloneDust(prismaticEnergy);
|
||||
prismaticEnergy.scale *= 0.6f;
|
||||
}
|
||||
}
|
||||
@@ -151,9 +152,9 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
explosionDust.scale = 1.1f;
|
||||
explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f);
|
||||
|
||||
CalamityUtils.SafeCloneDust(explosionDust).velocity *= Main.rand.NextFloat(0.8f);
|
||||
Dust.BetterCloneDust(explosionDust).velocity *= Main.rand.NextFloat(0.8f);
|
||||
|
||||
explosionDust = CalamityUtils.SafeCloneDust(explosionDust);
|
||||
explosionDust = Dust.BetterCloneDust(explosionDust);
|
||||
explosionDust.scale /= 2f;
|
||||
explosionDust.fadeIn /= 2f;
|
||||
explosionDust.color = new Color(255, 255, 255, 255);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -131,7 +132,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
sulphuricAcid.noGravity = true;
|
||||
sulphuricAcid.velocity *= 1.8f;
|
||||
|
||||
sulphuricAcid = CalamityUtils.SafeCloneDust(sulphuricAcid);
|
||||
sulphuricAcid = Dust.BetterCloneDust(sulphuricAcid);
|
||||
sulphuricAcid.velocity *= -1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using CalamityMod.Buffs.Summon.Whips;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
@@ -149,7 +150,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f + k;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = CalamityUtils.SafeCloneDust(dust);
|
||||
Dust dust2 = Dust.BetterCloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
|
||||
@@ -6,6 +6,7 @@ using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.NPCs.SupremeCalamitas;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -1164,7 +1165,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
dust26.fadeIn = fadeIn;
|
||||
dust26.scale = num981;
|
||||
dust26.noLight = true;
|
||||
Dust dust27 = CalamityUtils.SafeCloneDust(dust26);
|
||||
Dust dust27 = Dust.BetterCloneDust(dust26);
|
||||
Dust dust = dust27;
|
||||
dust.scale *= 0.65f;
|
||||
dust = dust27;
|
||||
@@ -1210,7 +1211,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Main.dust[num71].noGravity = true;
|
||||
Main.dust[num71].scale = 2f;
|
||||
Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust11 = CalamityUtils.SafeCloneDust(num71);
|
||||
Dust dust11 = Dust.BetterCloneDust(num71);
|
||||
Dust dust = dust11;
|
||||
dust.scale /= 2f;
|
||||
dust = dust11;
|
||||
@@ -1228,7 +1229,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat() * 1f;
|
||||
dust.fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust12 = CalamityUtils.SafeCloneDust(num74);
|
||||
Dust dust12 = Dust.BetterCloneDust(num74);
|
||||
dust = dust12;
|
||||
dust.scale /= 2f;
|
||||
dust = dust12;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
@@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
rainbowDust.fadeIn = fadeIn;
|
||||
rainbowDust.noLight = true;
|
||||
|
||||
Dust rainbowDust2 = CalamityUtils.SafeCloneDust(rainbowDust);
|
||||
Dust rainbowDust2 = Dust.BetterCloneDust(rainbowDust);
|
||||
rainbowDust2.scale *= 0.65f;
|
||||
rainbowDust2.fadeIn *= 0.65f;
|
||||
rainbowDust2.color = new Color(255, 255, 255, 255);
|
||||
@@ -114,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
dustID.noGravity = true;
|
||||
dustID.fadeIn = Main.rand.NextFloat() * 2f;
|
||||
|
||||
Dust dustCloning = CalamityUtils.SafeCloneDust(dustID);
|
||||
Dust dustCloning = Dust.BetterCloneDust(dustID);
|
||||
dustCloning.scale /= 2f;
|
||||
dustCloning.fadeIn /= 2f;
|
||||
dustCloning.color = Color.White;
|
||||
@@ -125,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
dustID.noGravity = true;
|
||||
dustID.fadeIn = Main.rand.NextFloat() * 2f;
|
||||
|
||||
Dust dustCloning2 = CalamityUtils.SafeCloneDust(dustID);
|
||||
Dust dustCloning2 = Dust.BetterCloneDust(dustID);
|
||||
dustCloning2.scale /= 2f;
|
||||
dustCloning2.fadeIn /= 2f;
|
||||
dustCloning2.color = Color.White;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.Utilities
|
||||
{
|
||||
internal static class DustExtensions
|
||||
{
|
||||
extension(Dust dust)
|
||||
{
|
||||
[Obsolete("DO NOT USE. It is an unsafe fix to an even more unsafe vanilla method.")]
|
||||
public static Dust BetterCloneDust(Dust rf)
|
||||
{
|
||||
if (rf.dustIndex == Main.maxDustToDraw)
|
||||
{
|
||||
return new Dust();
|
||||
}
|
||||
|
||||
int num = Dust.NewDust(rf.position, 0, 0, rf.type);
|
||||
if (!Main.dust.IndexInRange(num))
|
||||
{
|
||||
return new Dust();
|
||||
}
|
||||
Dust obj = Main.dust[num];
|
||||
obj.position = rf.position;
|
||||
obj.velocity = rf.velocity;
|
||||
obj.fadeIn = rf.fadeIn;
|
||||
obj.noGravity = rf.noGravity;
|
||||
obj.scale = rf.scale;
|
||||
obj.rotation = rf.rotation;
|
||||
obj.noLight = rf.noLight;
|
||||
obj.active = rf.active;
|
||||
obj.type = rf.type;
|
||||
obj.color = rf.color;
|
||||
obj.alpha = rf.alpha;
|
||||
obj.frame = rf.frame;
|
||||
obj.shader = rf.shader;
|
||||
obj.customData = rf.customData;
|
||||
return obj;
|
||||
}
|
||||
|
||||
[Obsolete("DO NOT USE. It is an unsafe fix to an even more unsafe vanilla method.")]
|
||||
public static Dust BetterCloneDust(int dustIndex)
|
||||
{
|
||||
return BetterCloneDust(Main.dust[dustIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,49 +321,5 @@ namespace CalamityMod
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modified version of Dust.CloneDust that clones dust safely. Returns a blank, unused dust if the dust cap is exceeded
|
||||
/// </summary>
|
||||
/// <param name="rf"></param>
|
||||
/// <returns></returns>
|
||||
public static Dust SafeCloneDust(Dust rf)
|
||||
{
|
||||
if (rf.dustIndex == Main.maxDustToDraw)
|
||||
{
|
||||
return rf;
|
||||
}
|
||||
|
||||
int num = Dust.NewDust(rf.position, 0, 0, rf.type);
|
||||
if (!Main.dust.IndexInRange(num))
|
||||
{
|
||||
return new Dust();
|
||||
}
|
||||
Dust obj = Main.dust[num];
|
||||
obj.position = rf.position;
|
||||
obj.velocity = rf.velocity;
|
||||
obj.fadeIn = rf.fadeIn;
|
||||
obj.noGravity = rf.noGravity;
|
||||
obj.scale = rf.scale;
|
||||
obj.rotation = rf.rotation;
|
||||
obj.noLight = rf.noLight;
|
||||
obj.active = rf.active;
|
||||
obj.type = rf.type;
|
||||
obj.color = rf.color;
|
||||
obj.alpha = rf.alpha;
|
||||
obj.frame = rf.frame;
|
||||
obj.shader = rf.shader;
|
||||
obj.customData = rf.customData;
|
||||
return obj;
|
||||
}
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="SafeCloneDust(Dust)"/>
|
||||
/// </summary>
|
||||
/// <param name="dustIndex"></param>
|
||||
/// <returns></returns>
|
||||
public static Dust SafeCloneDust(int dustIndex)
|
||||
{
|
||||
return SafeCloneDust(Main.dust[dustIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user