A_GiveInventory radius extension

Moderator: GZDoom Developers

Post Reply
User avatar
Major Cooke
Posts: 8209
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

A_GiveInventory radius extension

Post by Major Cooke »

Following the expansion suggestion of this, I figured I might as well ask for another alternative; giving inventory items to any or all actors within a specific range, similar to A_Explode's radius.

However, there would also be a few flag suggestions to incorporate as well. The flags would have to be specified in order for certain entities to be applicable for radial inventory reception, (weird saying, much?) but these have NO effect on the calling actor's current codepointer actors. They will receive it regardless of these flags being specified or not.

_MONSTERS - Makes monsters eligible to receive the inventory item.
_PROJECTILES - Ditto, but aimed at projectiles.
_MISC - Things that aren't one of the two above can receive items.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: A_GiveInventory radius extension

Post by FDARI »

A_GiveInventory feels a little too specific for a use of radius-based actor acquisition, but I recognise the underlying need. It would seem more "right" to me to have an ACS search function that creates a temporary array of nearby actors.

int FindNearbyActors(int range, int flags);
Flags: NOMONSTERS, NOPROJECTILES, NOMISCELLANEOUS
Return: Pointer to a list of monsters, valid until the end of the tick.
Note: The flags might not be necessary. They only make sense if it is more efficient to filter here than in modder ACS.

int GetActorListLength(int actorList);
Return: Number of actors in a temporary (or permanent, should those ever come to be) collection

int SetActivatorFromList(int actorList, int index);
Return: TRUE for success, FALSE for failure (index out of bounds, or otherwise unsuccessful)

With that, you could iterate all your actors in ACS, and perform other checks for more detailed filtering (health, friendliness, orientation, current inventory...).

... Of course; you could achieve similar results using A_GiveInventory with custom inventory objects.
User avatar
CommanderZ
Posts: 210
Joined: Sun Nov 14, 2010 8:23 am
Location: Czech Republic
Contact:

Re: A_GiveInventory radius extension

Post by CommanderZ »

This would be great addition! But I think it would be better to have an option to make A_Explode apply puff on its victims. This would be more powerful, more meaningful and it could easily emulate the functionality you propose.
It would seem more "right" to me to have an ACS search function that creates a temporary array of nearby actors.
This can be done already, but it is pain in the a**. You have to assign sequential TID to all the actors you want to iterate over and then iterate over that range of TIDs with for loop.

Having more streamlined way to do this would be great though.
User avatar
Major Cooke
Posts: 8209
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: A_GiveInventory radius extension

Post by Major Cooke »

@FDARI: That's exactly what I'd like to avoid... ACS. If we can get this going for DECORATE in a much simpler way than going about assigning +NOBLOCKMAP to monsters who have already been targeted and affected, or somehow similar to what CommanderZ says, then it'd make life a lot easier on everyone.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”