mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Added: A_GiveToChildren
- Added: A_TakeFromChildren - Added: A_GiveToSiblings - Added: A_TakeFromSiblings - Added the following flags for A_RadiusGive: - RGF_NOSIGHT: Exclude sight check from distance. - RGF_MISSILES: Missiles can take inventory items.
This commit is contained in:
parent
c1a0ee9623
commit
165d2887fd
3 changed files with 87 additions and 22 deletions
|
@ -1677,6 +1677,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
|
|||
DoGiveInventory(self->target, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
AActor * mo;
|
||||
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self) DoGiveInventory(mo, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings)
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
AActor * mo;
|
||||
|
||||
if (self->master != NULL)
|
||||
{
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self->master && mo != self) DoGiveInventory(mo, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_TakeInventory
|
||||
|
@ -1737,6 +1762,31 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
|
|||
DoTakeInventory(self->target, PUSH_PARAMINFO);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
AActor * mo;
|
||||
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self) DoTakeInventory(mo, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings)
|
||||
{
|
||||
TThinkerIterator<AActor> it;
|
||||
AActor * mo;
|
||||
|
||||
if (self->master != NULL)
|
||||
{
|
||||
while ((mo = it.Next()))
|
||||
{
|
||||
if (mo->master == self->master && mo != self) DoTakeInventory(mo, PUSH_PARAMINFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Common code for A_SpawnItem and A_SpawnItemEx
|
||||
|
@ -4608,17 +4658,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedTerminate)
|
|||
//==========================================================================
|
||||
enum RadiusGiveFlags
|
||||
{
|
||||
RGF_GIVESELF = 1,
|
||||
RGF_PLAYERS = 2,
|
||||
RGF_MONSTERS = 4,
|
||||
RGF_OBJECTS = 8,
|
||||
RGF_VOODOO = 16,
|
||||
RGF_CORPSES = 32,
|
||||
RGF_MASK = 63,
|
||||
RGF_NOTARGET = 64,
|
||||
RGF_NOTRACER = 128,
|
||||
RGF_NOMASTER = 256,
|
||||
RGF_CUBE = 512,
|
||||
RGF_GIVESELF = 1 << 0,
|
||||
RGF_PLAYERS = 1 << 1,
|
||||
RGF_MONSTERS = 1 << 2,
|
||||
RGF_OBJECTS = 1 << 3,
|
||||
RGF_VOODOO = 1 << 4,
|
||||
RGF_CORPSES = 1 << 5,
|
||||
RGF_MASK = 63,
|
||||
RGF_NOTARGET = 1 << 6,
|
||||
RGF_NOTRACER = 1 << 7,
|
||||
RGF_NOMASTER = 1 << 8,
|
||||
RGF_CUBE = 1 << 9,
|
||||
RGF_NOSIGHT = 1 << 10,
|
||||
RGF_MISSILES = 1 << 11,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
||||
|
@ -4699,6 +4751,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if (thing->flags & MF_MISSILE)
|
||||
{
|
||||
if (!(flags & RGF_MISSILES))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
|
@ -4724,8 +4783,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
|
|||
}
|
||||
fixed_t dz = abs ((thing->z + thing->height/2) - (self->z + self->height/2));
|
||||
|
||||
if (P_CheckSight (thing, self, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
|
||||
{ // OK to give; target is in direct path
|
||||
if (P_CheckSight (thing, self, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) || (RGF_NOSIGHT))
|
||||
{ // OK to give; target is in direct path, or the monster doesn't care about it being in line of sight.
|
||||
AInventory *gift = static_cast<AInventory *>(Spawn (item, 0, 0, 0, NO_REPLACE));
|
||||
if (gift->IsKindOf(RUNTIME_CLASS(AHealth)))
|
||||
{
|
||||
|
|
|
@ -312,6 +312,10 @@ ACTOR Actor native //: Thinker
|
|||
action native A_RemoveTarget(int flags = 0);
|
||||
action native A_RemoveTracer(int flags = 0);
|
||||
action native A_Remove(int removee, int flags = 0);
|
||||
action native A_GiveToChildren(class<Inventory> itemtype, int amount = 0);
|
||||
action native A_GiveToSiblings(class<Inventory> itemtype, int amount = 0);
|
||||
action native A_TakeFromChildren(class<Inventory> itemtype, int amount = 0);
|
||||
action native A_TakeFromSiblings(class<Inventory> itemtype, int amount = 0);
|
||||
|
||||
action native A_CheckSightOrRange(float distance, state label);
|
||||
action native A_CheckRange(float distance, state label);
|
||||
|
|
|
@ -191,15 +191,17 @@ const int WAF_USEPUFF = 2;
|
|||
enum
|
||||
{
|
||||
RGF_GIVESELF = 1,
|
||||
RGF_PLAYERS = 2,
|
||||
RGF_MONSTERS = 4,
|
||||
RGF_OBJECTS = 8,
|
||||
RGF_VOODOO = 16,
|
||||
RGF_CORPSES = 32,
|
||||
RGF_NOTARGET = 64,
|
||||
RGF_NOTRACER = 128,
|
||||
RGF_NOMASTER = 256,
|
||||
RGF_CUBE = 512,
|
||||
RGF_PLAYERS = 1 << 1,
|
||||
RGF_MONSTERS = 1 << 2,
|
||||
RGF_OBJECTS = 1 << 3,
|
||||
RGF_VOODOO = 1 << 4,
|
||||
RGF_CORPSES = 1 << 5,
|
||||
RGF_NOTARGET = 1 << 6,
|
||||
RGF_NOTRACER = 1 << 7,
|
||||
RGF_NOMASTER = 1 << 8,
|
||||
RGF_CUBE = 1 << 9,
|
||||
RGF_NOSIGHT = 1 << 10,
|
||||
RGF_MISSILES = 1 << 11,
|
||||
};
|
||||
|
||||
// Activation flags
|
||||
|
|
Loading…
Reference in a new issue