diff --git a/ChensGradiusMod.cs b/ChensGradiusMod.cs
index fb08dfd..b520da4 100644
--- a/ChensGradiusMod.cs
+++ b/ChensGradiusMod.cs
@@ -449,6 +449,50 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)
break;
}
+ case PacketMessageType.BroadcastSound:
+ SoundPacketType soundPacketType = (SoundPacketType)reader.ReadByte();
+ switch (soundPacketType)
+ {
+ case SoundPacketType.Vanilla:
+ {
+ ushort soundType = reader.ReadUInt16();
+ Vector2 soundPosition = reader.ReadVector2();
+ byte soundStyle = reader.ReadByte();
+
+ if (IsServer())
+ {
+ ModPacket packet = GetPacket();
+ packet.Write((byte)PacketMessageType.BroadcastSound);
+ packet.Write((byte)SoundPacketType.Vanilla);
+ packet.Write(soundType);
+ packet.WriteVector2(soundPosition);
+ packet.Write(soundStyle);
+ packet.Send();
+ }
+ else Main.PlaySound(soundType, soundPosition, soundStyle);
+ break;
+ }
+
+ case SoundPacketType.Legacy:
+ {
+ string customSound = reader.ReadString();
+ Vector2 soundPosition = reader.ReadVector2();
+
+ if (IsServer())
+ {
+ ModPacket packet = GetPacket();
+ packet.Write((byte)PacketMessageType.BroadcastSound);
+ packet.Write((byte)SoundPacketType.Legacy);
+ packet.Write(customSound);
+ packet.WriteVector2(soundPosition);
+ packet.Send();
+ }
+ else Main.PlaySound(GetLegacySoundSlot(SoundType.Custom, customSound), soundPosition);
+ break;
+ }
+ }
+ break;
+
case PacketMessageType.SpawnBoss:
Vector2 initialPosition = reader.ReadVector2();
if (IsServer())
@@ -460,11 +504,13 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)
NPC npc = Main.npc[npcIndex];
NetMessage.BroadcastChatMessage(NetworkText.FromKey(Language.GetTextValue("Announcement.HasAwoken", npc.GivenOrTypeName)), new Color(175, 75, 255));
ModPacket packet = GetPacket();
- packet.Write((byte)PacketMessageType.SpawnBoss);
+ packet.Write((byte)PacketMessageType.BroadcastSound);
+ packet.Write((byte)SoundPacketType.Vanilla);
+ packet.Write((ushort)SoundID.Roar);
packet.WriteVector2(initialPosition);
+ packet.Write((byte)0);
packet.Send();
}
- else Main.PlaySound(SoundID.Roar, initialPosition, 0);
break;
case PacketMessageType.RecurveUpdatePositions:
@@ -533,9 +579,16 @@ internal enum PacketMessageType : byte
ClientChangesChargeMultiple,
SpawnRetaliationBullet,
ClientChangesSearchOption,
+ BroadcastSound,
SpawnBoss,
RecurveUpdatePositions,
ClientChangesTurretOption
};
+
+ internal enum SoundPacketType : byte
+ {
+ Vanilla,
+ Legacy
+ }
}
}
\ No newline at end of file
diff --git a/ChensGradiusMod.csproj b/ChensGradiusMod.csproj
index e349379..7093a34 100644
--- a/ChensGradiusMod.csproj
+++ b/ChensGradiusMod.csproj
@@ -6,7 +6,7 @@
net45
x86
7.3
- 1.2.2
+ 1.2.3
diff --git a/NPCs/BigCoreCustom.cs b/NPCs/BigCoreCustom.cs
index 582725b..d144f67 100644
--- a/NPCs/BigCoreCustom.cs
+++ b/NPCs/BigCoreCustom.cs
@@ -8,6 +8,7 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
+using static ChensGradiusMod.ChensGradiusMod;
using static ChensGradiusMod.GradiusHelper;
namespace ChensGradiusMod.NPCs
@@ -255,8 +256,20 @@ private void PerformAttack()
Main.myPlayer);
}
- Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Enemies/BigCoreShoot"),
- npc.Center);
+ if (IsServer())
+ {
+ ModPacket packet = mod.GetPacket();
+ packet.Write((byte)PacketMessageType.BroadcastSound);
+ packet.Write((byte)SoundPacketType.Legacy);
+ packet.Write("Sounds/Enemies/BigCoreShoot");
+ packet.WriteVector2(npc.Center);
+ packet.Send();
+ }
+ else
+ {
+ Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Enemies/BigCoreShoot"),
+ npc.Center);
+ }
}
}
}
diff --git a/build.txt b/build.txt
index 17f7253..5730ec8 100644
--- a/build.txt
+++ b/build.txt
@@ -1,6 +1,6 @@
displayName = Chen's Gradius Mod
author = blancfaye7
-version = 1.2.2
+version = 1.2.3
homepage = https://forums.terraria.org/index.php?threads/chens-gradius-mod.83289/
hideCode = true
hideResources = true
diff --git a/forum.txt b/forum.txt
index 0e9880c..e1e3a7f 100644
--- a/forum.txt
+++ b/forum.txt
@@ -1,7 +1,7 @@
Hello. I decided to share my mod here in the forums. I'm not very good at documenting, but it will improve as time passes. Without further ado...
[IMG]https://i.imgur.com/FKqzjlB.png[/IMG]
-[B][U][SIZE=6]Mod Version: 1.2.2
+[B][U][SIZE=6]Mod Version: 1.2.3
tModLoader: 0.11.8.5
The mod will be ported to tModLoader 1.4! Stay tuned![/SIZE][/U][/B]
@@ -251,6 +251,9 @@ For more information, visit this [URL=https://github.com/cheeeeeeeeeen/Chens-Gra
The content is moved because it's hard to maintain a Wiki and a main post! However, the latest version change will still be here.
Click [URL=https://github.com/cheeeeeeeeeen/Chens-Gradius-Mod/wiki/Changelog]here[/URL] for the full changelog.
+1.2.3
+ - Fix Big Core's Laser sounds not being heard by clients on a dedicated server setup.
+
1.2.2
- Fix Big Core Custom spawning on dedicated servers as it does not work when clients use the spawner.
[/SPOILER]