# HG changeset patch
# User Extended-Tangent <ethgaming101@hotmail.com>
# Date 1769730361 18000
#      Thu Jan 29 18:46:01 2026 -0500
# Node ID e84aa030104d682a3055ac9dc9fdcb21f6390885
# Parent  2d4749b0fa1d76c29c17ce1700462577740dd5e1
Added a Decorate and ACS function to force dropping of team items.

diff -r 2d4749b0fa1d -r e84aa030104d src/d_player.h
--- a/src/d_player.h	Mon Jan 12 13:55:30 2026 -0500
+++ b/src/d_player.h	Thu Jan 29 18:46:01 2026 -0500
@@ -108,7 +108,7 @@
 	// has special items of interest (terminator, flags, etc.). Those need to be dropped or else
 	// the game will become disrupted.
 	// [BB] We also call this when a player dies. These special items also need to be dropped then.
-	virtual void DropImportantItems( bool bLeavingGame, AActor *pSource = NULL );
+	virtual void DropImportantItems( bool bLeavingGame, bool bSetTimer = false, AActor *pSource = NULL );
 
 	virtual void TweakSpeeds (int &forwardmove, int &sidemove);
 	virtual void MorphPlayerThink ();
diff -r 2d4749b0fa1d -r e84aa030104d src/p_acs.cpp
--- a/src/p_acs.cpp	Mon Jan 12 13:55:30 2026 -0500
+++ b/src/p_acs.cpp	Thu Jan 29 18:46:01 2026 -0500
@@ -5551,6 +5551,7 @@
 	ACSF_GetWadInfo,
 	ACSF_SetMapUsedStatus,
 	ACSF_CheckScript,
+	ACSF_DropImportantItems,
 
 	// ZDaemon
 	ACSF_GetTeamScore = 19620,	// (int team)
@@ -6800,6 +6801,41 @@
 		break;
 		}
 
+		case ACSF_DropImportantItems:
+		{
+			if (argCount > 0) 
+			{
+				AActor *source;
+				if (argCount >= 2) 
+				{
+					source = SingleActorFromTID(args[1], activator);
+				}
+
+				if (args[0] == 0) 
+				{
+					if (activator != NULL && activator->player != NULL) 
+					{
+						activator->player->mo->DropImportantItems(false, true, source);
+					}
+				}
+				else 
+				{
+					FActorIterator it(args[0]);
+					AActor *actor;
+
+					while ((actor = it.Next()) != NULL)
+					{
+						if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn)))
+						{
+							APlayerPawn *playerActor = static_cast<APlayerPawn*>(actor);
+							playerActor->DropImportantItems(false, true, source);
+						}
+					}
+				}
+			}
+			break;
+		}
+
 		case ACSF_CheckFlag:
 		{
 			AActor *actor = SingleActorFromTID(args[0], activator);
diff -r 2d4749b0fa1d -r e84aa030104d src/p_user.cpp
--- a/src/p_user.cpp	Mon Jan 12 13:55:30 2026 -0500
+++ b/src/p_user.cpp	Thu Jan 29 18:46:01 2026 -0500
@@ -2065,7 +2065,7 @@
 	// [BB] Drop any important items the player may be carrying before handling
 	// any other part of the death logic.
 	if ( NETWORK_InClientMode() == false )
-		DropImportantItems ( false, source );
+		DropImportantItems ( false, false, source );
 
 	Super::Die (source, inflictor, dmgflags);
 
@@ -2178,7 +2178,7 @@
 	}
 }
 
-void APlayerPawn::DropImportantItems( bool bLeavingGame, AActor *pSource )
+void APlayerPawn::DropImportantItems( bool bLeavingGame, bool bSetTimer, AActor *pSource )
 {
 	AActor		*pTeamItem;
 	AInventory	*pInventory;
@@ -2213,6 +2213,11 @@
 				if ( pTeamItem )
 				{
 					pTeamItem->flags |= MF_DROPPED;
+					if (bSetTimer && pTeamItem->IsKindOf(RUNTIME_CLASS(AInventory))) {
+						ATeamItem* pTeamInventory = static_cast<ATeamItem*>(pTeamItem);
+						pTeamInventory->flags &= ~(MF_SPECIAL | MF_SOLID);
+						pTeamInventory->DropTime = 30;
+					}
 
 					// If the flag spawned in an instant return zone, the return routine
 					// has already been executed. No need to do anything!
@@ -2262,6 +2267,11 @@
 			if ( pTeamItem )
 			{
 				pTeamItem->flags |= MF_DROPPED;
+				if (bSetTimer && pTeamItem->IsKindOf(RUNTIME_CLASS(AInventory))) {
+					ATeamItem* pTeamInventory = static_cast<ATeamItem*>(pTeamItem);
+					pTeamInventory->flags &= ~(MF_SPECIAL | MF_SOLID);
+					pTeamInventory->DropTime = 30;
+				}
 
 				pTeamItem->tid = 668;
 				pTeamItem->AddToHash( );
diff -r 2d4749b0fa1d -r e84aa030104d src/thingdef/thingdef_codeptr.cpp
--- a/src/thingdef/thingdef_codeptr.cpp	Mon Jan 12 13:55:30 2026 -0500
+++ b/src/thingdef/thingdef_codeptr.cpp	Thu Jan 29 18:46:01 2026 -0500
@@ -6082,3 +6082,18 @@
 
 	ACTION_SET_RESULT(res);
 }
+
+//==========================================================================
+//
+// A_DropImportantItems
+//
+//==========================================================================
+
+DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropImportantItems)
+{
+	if (self->player && self->player->mo == self)
+	{
+		self->player->mo->DropImportantItems(false, true);
+	}
+}
+
