Fusable particle creation fix in MP
This commit is contained in:
1 parent
952fc0e398
commit
bfaaf22c0b
4 files changed
+10
-4
No files matched your search
@@ -176,6 +176,9 @@ namespace CalamityMod.Particles
|
||||
/// <param name="type">The type to check.</param>
|
||||
internal static FusableParticleRenderCollection GetParticleRenderCollectionByType(Type type)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
return null;
|
||||
|
||||
return ParticleSets.First(s => s.ParticleSet.GetType() == type);
|
||||
}
|
||||
|
||||
@@ -185,6 +188,9 @@ namespace CalamityMod.Particles
|
||||
/// <typeparam name="T">The type to check.</typeparam>
|
||||
public static T GetParticleSetByType<T>() where T : BaseFusableParticleSet
|
||||
{
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
return null;
|
||||
|
||||
return ParticleSets.First(s => s.ParticleSet.GetType() == typeof(T)).ParticleSet as T;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
// Emit particles.
|
||||
Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Circular(5f, 5f) * radius / 130f;
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>().SpawnParticle(spawnPosition, radius);
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>()?.SpawnParticle(spawnPosition, radius);
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => Color.White * projectile.Opacity;
|
||||
|
||||
@@ -232,12 +232,12 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
// Summon a base particle.
|
||||
Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Circular(1f, 1f) * particleSize / 26f;
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>().SpawnParticle(spawnPosition, particleSize);
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>()?.SpawnParticle(spawnPosition, particleSize);
|
||||
|
||||
// And an "ahead" particle that spawns based on current movement.
|
||||
// This causes the "head" of the overall thing to have bumps when moving.
|
||||
spawnPosition += projectile.velocity.RotatedByRandom(1.38f) * particleSize / 105f;
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>().SpawnParticle(spawnPosition, particleSize * 0.4f);
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>()?.SpawnParticle(spawnPosition, particleSize * 0.4f);
|
||||
}
|
||||
|
||||
// Release gas projectiles randomly. This does not happen when dying.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
float radius = MathHelper.SmoothStep(80f, 48f, 1f - projectile.timeLeft / 90f);
|
||||
Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Circular(5f, 5f) * radius / 130f;
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>().SpawnParticle(spawnPosition, radius);
|
||||
FusableParticleManager.GetParticleSetByType<GruesomeEminenceParticleSet>()?.SpawnParticle(spawnPosition, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user