# HG changeset patch
# User Extended-Tangent <ethgaming101@hotmail.com>
# Date 1769734267 18000
#      Thu Jan 29 19:51:07 2026 -0500
# Node ID 92d475871d814ca8d1329531066bf0b977fc263a
# Parent  2d4749b0fa1d76c29c17ce1700462577740dd5e1
Added ACS and Decorate functions to force the dropping of important gamemode items, like flags and skulls.

diff -r 2d4749b0fa1d -r 92d475871d81 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 19:51:07 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 bSetDropTime = false, AActor *pSource = NULL );
 
 	virtual void TweakSpeeds (int &forwardmove, int &sidemove);
 	virtual void MorphPlayerThink ();
diff -r 2d4749b0fa1d -r 92d475871d81 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 19:51:07 2026 -0500
@@ -5551,6 +5551,7 @@
 	ACSF_GetWadInfo,
 	ACSF_SetMapUsedStatus,
 	ACSF_CheckScript,
+	ACSF_DropImportantItems,
 
 	// ZDaemon
 	ACSF_GetTeamScore = 19620,	// (int team)
@@ -9007,6 +9008,37 @@
 			break;
 		}
 
+		case ACSF_DropImportantItems:
+		{
+			AActor* source = NULL;
+			if (argCount >= 2) {
+				source = SingleActorFromTID(args[1], activator);
+			}
+
+			if (args[0] == 0) 
+			{
+				if (activator && activator->player) 
+				{
+					activator->player->mo->DropImportantItems(false, true, source);
+				}
+			}
+			else 
+			{
+				FActorIterator iterator(args[0]);
+				AActor* actor;
+
+				while ((actor = iterator.Next()) != NULL)
+				{
+					if (actor->IsKindOf(RUNTIME_CLASS(APlayerPawn))) 
+					{
+						APlayerPawn* playerActor = static_cast<APlayerPawn*>(actor);
+						playerActor->DropImportantItems(false, true, source);
+					}
+				}
+			}
+			break;
+		}
+
 		default:
 			break;
 	}
diff -r 2d4749b0fa1d -r 92d475871d81 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 19:51:07 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 bSetDropTime, AActor *pSource )
 {
 	AActor		*pTeamItem;
 	AInventory	*pInventory;
@@ -2213,6 +2213,11 @@
 				if ( pTeamItem )
 				{
 					pTeamItem->flags |= MF_DROPPED;
+					if (bSetDropTime && pTeamItem->IsKindOf(RUNTIME_CLASS(AInventory))) {
+						AInventory* pTeamInventory = static_cast<AInventory*>(pTeamItem);
+						pTeamInventory->DropTime = 30;
+						pTeamInventory->flags &= ~(MF_SPECIAL | MF_SOLID);
+					}
 
 					// 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 (bSetDropTime && pTeamItem->IsKindOf(RUNTIME_CLASS(AInventory))) {
+					AInventory* pTeamInventory = static_cast<AInventory*>(pTeamItem);
+					pTeamInventory->DropTime = 30;
+					pTeamInventory->flags &= ~(MF_SPECIAL | MF_SOLID);
+				}
 
 				pTeamItem->tid = 668;
 				pTeamItem->AddToHash( );
diff -r 2d4749b0fa1d -r 92d475871d81 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 19:51:07 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);
+	}
+}
+
diff -r 2d4749b0fa1d -r 92d475871d81 wadsrc/static/actors/actor.txt
--- a/wadsrc/static/actors/actor.txt	Mon Jan 12 13:55:30 2026 -0500
+++ b/wadsrc/static/actors/actor.txt	Thu Jan 29 19:51:07 2026 -0500
@@ -232,6 +232,7 @@
 	action native A_CheckSight(state label);
 	action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
 	action native A_DropInventory(class<Inventory> itemtype);
+	action native A_DropImportantItems();
 	action native A_SetBlend(color color1, float alpha, int tics, color color2 = "");
 	action native A_ChangeFlag(string flagname, bool value);
 	action native A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT);
