+ Attemtped to fix niche error with TelekineticEnemyGrab in MP
This commit is contained in:
1 parent
54b64b0b8c
commit
4e55df0904
1 file changed
+43
-40
@@ -22,7 +22,7 @@ public class TelekineticEnemyGrab : ModProjectile, ILocalizedModType
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public override string Texture => "CalamityMod/Particles/BloomRing";
|
||||
|
||||
BezierCurve curve;
|
||||
BezierCurve curve = null;
|
||||
int throwSign = 0;
|
||||
Vector2 throwPos = Vector2.Zero;
|
||||
Vector2 holdPos;
|
||||
@@ -331,55 +331,58 @@ public class TelekineticEnemyGrab : ModProjectile, ILocalizedModType
|
||||
if (Time < 15)
|
||||
glowOpacity = Time / 15f;
|
||||
|
||||
Main.spriteBatch.End(out var snapshot);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
Texture2D ring = TextureAssets.Projectile[Type].Value;
|
||||
|
||||
List<Vector2> points = curve.GetPoints(pCount);
|
||||
for (int i = 1; i < pCount; i++)
|
||||
if (curve != null)
|
||||
{
|
||||
float scale1 = MathHelper.Lerp(0.1f, 1f, i / (float)(pCount - 1));
|
||||
float scale2 = MathHelper.Lerp(0.1f, 1f, (i + 1) / (float)(pCount - 1));
|
||||
float scale = MathHelper.Lerp(scale1, scale2, wrappedTime);
|
||||
Main.spriteBatch.End(out var snapshot);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
float rot1 = (points[i] - points[i - 1]).ToRotation();
|
||||
Texture2D ring = TextureAssets.Projectile[Type].Value;
|
||||
|
||||
float rot2;
|
||||
if (i == pCount - 1)
|
||||
rot2 = points[i].ToRotation();
|
||||
else
|
||||
rot2 = (points[i + 1] - points[i]).ToRotation();
|
||||
List<Vector2> points = curve.GetPoints(pCount);
|
||||
for (int i = 1; i < pCount; i++)
|
||||
{
|
||||
float scale1 = MathHelper.Lerp(0.1f, 1f, i / (float)(pCount - 1));
|
||||
float scale2 = MathHelper.Lerp(0.1f, 1f, (i + 1) / (float)(pCount - 1));
|
||||
float scale = MathHelper.Lerp(scale1, scale2, wrappedTime);
|
||||
|
||||
float rot;
|
||||
if (i == pCount - 1)
|
||||
rot = rot1;
|
||||
else
|
||||
rot = rot1.AngleLerp(rot2, wrappedTime);
|
||||
float rot1 = (points[i] - points[i - 1]).ToRotation();
|
||||
|
||||
Vector2 pos;
|
||||
if (i == pCount - 1)
|
||||
pos = Vector2.Lerp(points[i], points[i] + rot.ToRotationVector2() * Vector2.Distance(points[^1], points[^2]), wrappedTime);
|
||||
else
|
||||
pos = Vector2.Lerp(points[i], points[i + 1], wrappedTime);
|
||||
float rot2;
|
||||
if (i == pCount - 1)
|
||||
rot2 = points[i].ToRotation();
|
||||
else
|
||||
rot2 = (points[i + 1] - points[i]).ToRotation();
|
||||
|
||||
Color color;
|
||||
if (evenRed)
|
||||
color = (i % 2 == 0 ? Color.Red : Color.Magenta) * 0.666f;
|
||||
else
|
||||
color = (i % 2 == 0 ? Color.Magenta : Color.Red) * 0.666f;
|
||||
float rot;
|
||||
if (i == pCount - 1)
|
||||
rot = rot1;
|
||||
else
|
||||
rot = rot1.AngleLerp(rot2, wrappedTime);
|
||||
|
||||
if (i == pCount - 1)
|
||||
color *= 1 - wrappedTime;
|
||||
else if (i == 1)
|
||||
color *= wrappedTime;
|
||||
Vector2 pos;
|
||||
if (i == pCount - 1)
|
||||
pos = Vector2.Lerp(points[i], points[i] + rot.ToRotationVector2() * Vector2.Distance(points[^1], points[^2]), wrappedTime);
|
||||
else
|
||||
pos = Vector2.Lerp(points[i], points[i + 1], wrappedTime);
|
||||
|
||||
Main.spriteBatch.Draw(ring, pos + Projectile.velocity - Main.screenPosition, null, color * glowOpacity, rot, ring.Size() * 0.5f, new Vector2(0.5f, 1f) * scale, 0, 0);
|
||||
Color color;
|
||||
if (evenRed)
|
||||
color = (i % 2 == 0 ? Color.Red : Color.Magenta) * 0.666f;
|
||||
else
|
||||
color = (i % 2 == 0 ? Color.Magenta : Color.Red) * 0.666f;
|
||||
|
||||
if (i == pCount - 1)
|
||||
color *= 1 - wrappedTime;
|
||||
else if (i == 1)
|
||||
color *= wrappedTime;
|
||||
|
||||
Main.spriteBatch.Draw(ring, pos + Projectile.velocity - Main.screenPosition, null, color * glowOpacity, rot, ring.Size() * 0.5f, new Vector2(0.5f, 1f) * scale, 0, 0);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(snapshot);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(snapshot);
|
||||
|
||||
Vector2[] offsets = [Vector2.UnitX * 2, Vector2.UnitX * -2, Vector2.UnitY * 2, Vector2.UnitY * -2];
|
||||
for (int i = 0; i < 4; i++)
|
||||
Main.EntitySpriteDraw(EnemyGlowTextures[enemyID], Projectile.Center - Main.screenPosition + offsets[i].RotatedBy(Projectile.rotation), frame, Color.Lerp(Color.Red, Color.Magenta, ((float)Math.Sin((Main.GlobalTimeWrappedHourly * 5f)) / 2f + 0.5f)) * glowOpacity, Projectile.rotation, frame.Size() * 0.5f, 1f, 0);
|
||||
|
||||
Reference in new issue
Block a user