by Blue Shadow » Fri Sep 05, 2014 5:44 am
			
			
			Simply put, this patch adds an ACS equivalent to [wiki]A_DropInventory [/wiki].
Syntax:
Code: Select all
void DropInventory(int tid, str inventory_item);
Passing 0 as the tid, drops the item from the activator.
 Spoiler: Diff/Patch preview
Code: Select all
 src/p_acs.cpp | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
diff --git a/src/p_acs.cpp b/src/p_acs.cpp
index 235a479..c2b99f9 100644
--- a/src/p_acs.cpp
+++ b/src/p_acs.cpp
@@ -4361,6 +4361,7 @@ enum EACSFunctions
 	ACSF_ChangeActorAngle,
 	ACSF_ChangeActorPitch,		// 80
 	ACSF_GetArmorInfo,
+	ACSF_DropInventory,
 
 	/* Zandronum's - these must be skipped when we reach 99!
 	-100:ResetMap(0),
@@ -5485,6 +5486,42 @@ doplaysound:			if (funcIndex == ACSF_PlayActorSound)
 			break;
 		}
 
+		case ACSF_DropInventory:
+		{
+			const char *type = FBehavior::StaticLookupString(args[1]);
+			AInventory *inv;
+
+			if (type != NULL)
+			{
+				if (args[0] == 0)
+				{
+					if (activator != NULL)
+					{
+						inv = activator->FindInventory(type);
+						if (inv)
+						{
+							activator->DropInventory(inv);
+						}
+					}
+				}
+				else
+				{
+					FActorIterator it(args[0]);
+					AActor *actor;
+
+					while ((actor = it.Next()) != NULL)
+					{
+						inv = actor->FindInventory(type);
+						if (inv)
+						{
+							actor->DropInventory(inv);
+						}
+					}
+				}
+			}
+			break;
+		}
+
 		case ACSF_CheckFlag:
 		{
 			AActor *actor = SingleActorFromTID(args[0], activator);
Patch:
dropinventory.zip
 
			
			
							Simply put, this patch adds an ACS equivalent to [wiki]A_DropInventory [/wiki].
Syntax:
[code]void DropInventory(int tid, str inventory_item);[/code]
Passing 0 as the tid, drops the item from the activator.
[spoiler=Diff/Patch preview][code] src/p_acs.cpp | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
diff --git a/src/p_acs.cpp b/src/p_acs.cpp
index 235a479..c2b99f9 100644
--- a/src/p_acs.cpp
+++ b/src/p_acs.cpp
@@ -4361,6 +4361,7 @@ enum EACSFunctions
 	ACSF_ChangeActorAngle,
 	ACSF_ChangeActorPitch,		// 80
 	ACSF_GetArmorInfo,
+	ACSF_DropInventory,
 
 	/* Zandronum's - these must be skipped when we reach 99!
 	-100:ResetMap(0),
@@ -5485,6 +5486,42 @@ doplaysound:			if (funcIndex == ACSF_PlayActorSound)
 			break;
 		}
 
+		case ACSF_DropInventory:
+		{
+			const char *type = FBehavior::StaticLookupString(args[1]);
+			AInventory *inv;
+
+			if (type != NULL)
+			{
+				if (args[0] == 0)
+				{
+					if (activator != NULL)
+					{
+						inv = activator->FindInventory(type);
+						if (inv)
+						{
+							activator->DropInventory(inv);
+						}
+					}
+				}
+				else
+				{
+					FActorIterator it(args[0]);
+					AActor *actor;
+
+					while ((actor = it.Next()) != NULL)
+					{
+						inv = actor->FindInventory(type);
+						if (inv)
+						{
+							actor->DropInventory(inv);
+						}
+					}
+				}
+			}
+			break;
+		}
+
 		case ACSF_CheckFlag:
 		{
 			AActor *actor = SingleActorFromTID(args[0], activator);
[/code][/spoiler]
Patch:
[attachment=0]dropinventory.zip[/attachment]