More Multiplayer fixes
This commit is contained in:
1 parent
bcff687beb
commit
ae29d4fef8
6 files changed
+28
-3
No files matched your search
@@ -5844,7 +5844,10 @@ namespace CalamityMod.NPCs
|
||||
velocitySlownessFactor += 0.15f;
|
||||
|
||||
if (demonSwordImpales > 0 && npc.CanBeMoved(true))
|
||||
{
|
||||
npc.velocity *= Utils.Remap(demonSwordImpales, 1, 5, 0.9f, 0.3f, true);
|
||||
npc.SyncMotionToServer();
|
||||
}
|
||||
|
||||
if (gState > 0)
|
||||
{
|
||||
|
||||
@@ -347,6 +347,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
writer.Write(Projectile.rotation);
|
||||
writer.Write(Projectile.localAI[2]);
|
||||
writer.Write(Projectile.localAI[0]);
|
||||
writer.WriteVector2(impalePos);
|
||||
|
||||
writer.WriteFlags(stuckInTarget, exitedTarget, stuckInGround, thrown);
|
||||
}
|
||||
@@ -357,6 +358,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.rotation = reader.ReadSingle();
|
||||
Projectile.localAI[2] = reader.ReadSingle();
|
||||
Projectile.localAI[0] = reader.ReadSingle();
|
||||
impalePos = reader.ReadVector2();
|
||||
|
||||
reader.ReadFlags(out stuckInTarget, out exitedTarget, out stuckInGround, out thrown);
|
||||
}
|
||||
|
||||
@@ -371,6 +371,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
writer.Write(Projectile.rotation);
|
||||
writer.Write(Projectile.localAI[2]);
|
||||
writer.Write(Projectile.localAI[0]);
|
||||
writer.WriteVector2(impalePos);
|
||||
|
||||
writer.WriteFlags(stuckInTarget, exitedTarget, stuckInGround, thrown);
|
||||
}
|
||||
@@ -381,6 +382,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.rotation = reader.ReadSingle();
|
||||
Projectile.localAI[2] = reader.ReadSingle();
|
||||
Projectile.localAI[0] = reader.ReadSingle();
|
||||
impalePos = reader.ReadVector2();
|
||||
|
||||
reader.ReadFlags(out stuckInTarget, out exitedTarget, out stuckInGround, out thrown);
|
||||
}
|
||||
|
||||
@@ -373,6 +373,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
writer.Write(Projectile.rotation);
|
||||
writer.Write(Projectile.localAI[2]);
|
||||
writer.Write(Projectile.localAI[0]);
|
||||
writer.WriteVector2(impalePos);
|
||||
|
||||
writer.WriteFlags(stuckInTarget, exitedTarget, stuckInGround, thrown);
|
||||
}
|
||||
@@ -383,6 +384,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.rotation = reader.ReadSingle();
|
||||
Projectile.localAI[2] = reader.ReadSingle();
|
||||
Projectile.localAI[0] = reader.ReadSingle();
|
||||
impalePos = reader.ReadVector2();
|
||||
|
||||
reader.ReadFlags(out stuckInTarget, out exitedTarget, out stuckInGround, out thrown);
|
||||
}
|
||||
|
||||
@@ -366,6 +366,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
writer.Write(Projectile.rotation);
|
||||
writer.Write(Projectile.localAI[2]);
|
||||
writer.Write(Projectile.localAI[0]);
|
||||
writer.WriteVector2(impalePos);
|
||||
|
||||
writer.WriteFlags(stuckInTarget, exitedTarget, stuckInGround, thrown);
|
||||
}
|
||||
@@ -376,6 +377,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.rotation = reader.ReadSingle();
|
||||
Projectile.localAI[2] = reader.ReadSingle();
|
||||
Projectile.localAI[0] = reader.ReadSingle();
|
||||
impalePos = reader.ReadVector2();
|
||||
|
||||
reader.ReadFlags(out stuckInTarget, out exitedTarget, out stuckInGround, out thrown);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.CalPlayer;
|
||||
@@ -13,6 +14,7 @@ using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
@@ -125,11 +127,11 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
if (!outOfRange)
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(0.0065f * (energyNumber % 2 == 0 ? -1 : 1)) * 1.004f;
|
||||
|
||||
if (soundCooldown == 0 && Main.rand.NextBool(3500 * Projectile.MaxUpdates) && visuals)
|
||||
if (soundCooldown == 0 && Main.rand.NextBool(4500 * Projectile.MaxUpdates) && visuals && time > 18000) // Sounds are an easter egg that only plays if they've been alive for over 5 minutes
|
||||
{
|
||||
SoundStyle certainlyNotADeadChild = new("CalamityMod/Sounds/Item/AmuletVox", 6);
|
||||
soundSlot = SoundEngine.PlaySound(certainlyNotADeadChild with { Volume = 0.3f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center);
|
||||
soundCooldown = 300 * Projectile.MaxUpdates;
|
||||
soundCooldown = 800 * Projectile.MaxUpdates;
|
||||
}
|
||||
if (soundCooldown > 0)
|
||||
soundCooldown--;
|
||||
@@ -142,6 +144,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
soundCooldown = 0;
|
||||
if (Projectile.ai[2] == 5) // Effects for the moment they stop being idle
|
||||
{
|
||||
Projectile.netUpdate = true;
|
||||
time = 0;
|
||||
healing = (Owner.statLife < Owner.statLifeMax2 * 0.5f);
|
||||
Projectile.ai[2]++;
|
||||
@@ -168,7 +171,8 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
if (Utils.Distance(goalPosition, Projectile.Center) < 50)
|
||||
{
|
||||
Owner.HealPlayer(2);
|
||||
Owner.HealPlayer((energyNumber % 2 == 0 ? 3 : 4));
|
||||
Projectile.netUpdate = true;
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
@@ -214,6 +218,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 420);
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
@@ -237,6 +242,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
dust2.noLightEmittence = true;
|
||||
}
|
||||
}
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
@@ -254,5 +260,13 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
return false;
|
||||
}
|
||||
public override bool? CanDamage() => canDamage ? null : false;
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.WriteFlags(canDamage, healing);
|
||||
}
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
reader.ReadFlags(out canDamage, out healing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user