# HG changeset patch
# User Ru5tK1ng
# Date 1705559663 21600
#      Thu Jan 18 00:34:23 2024 -0600
# Branch pillars
# Node ID 7c08b79fc98459018bae61ab1f43e9bf172604b7
# Parent  f46ab13b972a3a2ffbd7baf2e88c43a1828ce7af
Fixed: Clients tried to destroy pillars twice which would cause out of sequence errors between building and destroying them (addresses 2946).

diff -r f46ab13b972a -r 7c08b79fc984 docs/zandronum-history.txt
--- a/docs/zandronum-history.txt	Fri Sep 29 08:23:34 2023 -0400
+++ b/docs/zandronum-history.txt	Thu Jan 18 00:34:23 2024 -0600
@@ -114,6 +114,7 @@
 -	- Fixed: the coop info wasn't getting drawn in clientside demos. [Kaminsky]
 -	- Fixed: Floatbob items having incorrect z-height after a map reset and glitchy GL floor clipping (addresses 2361). [Ru5tK1ng]
 -	- Fixed: Monsters spawned by BossBrain cubes would move before being spawned on the clients therefore triggering warning messages (addresses 2655). [Ru5tK1ng]
+-   - Fixed: Clients tried to destroy pillars twice which would cause out of sequence errors between building and destroying them (addresses 2946). [Ru5tK1ng]
 !	- The result value of GAMEEVENT_MEDALS event scripts can now be used to determine whether or not the player receives the medal. [Kaminsky]
 !	- GAMEMODE flags are now validated after all GAMEMODE lumps have been parsed instead of after each one. The internal game mode name (e.g. "TeamLMS") is now printed with the error message instead of the actual name. [Kaminsky]
 !	- Added an extra check to ensure that game modes have a (short) name. [Kaminsky]
diff -r f46ab13b972a -r 7c08b79fc984 src/p_pillar.cpp
--- a/src/p_pillar.cpp	Fri Sep 29 08:23:34 2023 -0400
+++ b/src/p_pillar.cpp	Thu Jan 18 00:34:23 2024 -0600
@@ -225,6 +225,13 @@
 	{
 		// [BC] If we're the server, tell clients to destroy the pillar, and to stop
 		// the sector sound sequence.
+		// [RK] We'll destroy the pillar and stop the sound on the host first
+		if ( NETWORK_InClientMode() == false )
+		{
+			SN_StopSequence( m_Sector, CHAN_FLOOR );
+			Destroy();
+		}
+
 		if ( NETWORK_GetState( ) == NETSTATE_SERVER )
 		{
 			SERVERCOMMANDS_StopSectorSequence( m_Sector );
@@ -235,9 +242,6 @@
 			SERVERCOMMANDS_SetSectorFloorPlane( ULONG( m_Sector - sectors ));
 			SERVERCOMMANDS_SetSectorCeilingPlane( ULONG( m_Sector - sectors ));
 		}
-
-		SN_StopSequence (m_Sector, CHAN_FLOOR);
-		Destroy ();
 	}
 	else
 	{
