mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Added limit parameter to A_RadiusGive.
- The function ends operation if the number of successfully given actors reaches this count.
This commit is contained in:
parent
aa6753383d
commit
1b1195df6a
2 changed files with 7 additions and 6 deletions
|
@ -5635,16 +5635,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
|||
PARAM_FLOAT (distance);
|
||||
PARAM_INT (flags);
|
||||
PARAM_INT_OPT (amount) { amount = 0; }
|
||||
PARAM_CLASS_OPT (filter, AActor) { filter = NULL; }
|
||||
PARAM_CLASS_OPT (filter, AActor) { filter = nullptr; }
|
||||
PARAM_NAME_OPT (species) { species = NAME_None; }
|
||||
PARAM_FLOAT_OPT (mindist) { mindist = 0; }
|
||||
PARAM_INT_OPT (limit) { limit = 0; }
|
||||
|
||||
// We need a valid item, valid targets, and a valid range
|
||||
if (item == NULL || (flags & RGF_MASK) == 0 || !flags || distance <= 0 || mindist >= distance)
|
||||
if (item == nullptr || (flags & RGF_MASK) == 0 || !flags || distance <= 0 || mindist >= distance)
|
||||
{
|
||||
ACTION_RETURN_INT(0);
|
||||
}
|
||||
|
||||
bool unlimited = (limit <= 0);
|
||||
if (amount == 0)
|
||||
{
|
||||
amount = 1;
|
||||
|
@ -5654,7 +5655,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
|||
if (flags & RGF_MISSILES)
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
while ((thing = it.Next()))
|
||||
while ((thing = it.Next()) && ((unlimited) || (given < limit)))
|
||||
{
|
||||
given += DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist);
|
||||
}
|
||||
|
@ -5666,7 +5667,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
|||
FMultiBlockThingsIterator it(check, self->X(), self->Y(), mid-distance, mid+distance, distance, false, self->Sector);
|
||||
FMultiBlockThingsIterator::CheckResult cres;
|
||||
|
||||
while ((it.Next(&cres)))
|
||||
while ((it.Next(&cres)) && ((unlimited) || (given < limit)))
|
||||
{
|
||||
given += DoRadiusGive(self, cres.thing, item, amount, distance, flags, filter, species, mindist);
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ ACTOR Actor native //: Thinker
|
|||
native state A_JumpIfInTargetInventory(class<Inventory> itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT);
|
||||
native bool A_GiveToTarget(class<Inventory> itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT);
|
||||
native bool A_TakeFromTarget(class<Inventory> itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT);
|
||||
native int A_RadiusGive(class<Inventory> itemtype, float distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0);
|
||||
native int A_RadiusGive(class<Inventory> itemtype, float distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0, int limit = 0);
|
||||
native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT);
|
||||
native void A_CountdownArg(int argnum, state targstate = "");
|
||||
action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true);
|
||||
|
|
Loading…
Reference in a new issue