by FDARI » Mon May 30, 2011 3:30 am
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.
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.