Add damagesource

This commit is contained in:
jekyllgrim 2024-06-03 12:25:12 +03:00 committed by Ricardo Luís Vaz Silva
parent f13bc09840
commit 83165dccbf
4 changed files with 7 additions and 0 deletions

View file

@ -1233,6 +1233,7 @@ public:
TObjPtr<AActor*> alternative; // (Un)Morphed actors stored here. Those with the MF_UNMORPHED flag are the originals.
TObjPtr<AActor*> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor*> master; // Thing which spawned this one (prevents mutual attacks)
TObjPtr<AActor*> damagesource; // [AA] Thing that fired a hitscan using this actor as a puff
int tid; // thing identifier
int special; // special

View file

@ -168,6 +168,7 @@ IMPLEMENT_POINTERS_START(AActor)
IMPLEMENT_POINTER(target)
IMPLEMENT_POINTER(lastenemy)
IMPLEMENT_POINTER(tracer)
IMPLEMENT_POINTER(damagesource)
IMPLEMENT_POINTER(goal)
IMPLEMENT_POINTER(LastLookActor)
IMPLEMENT_POINTER(Inventory)
@ -6286,6 +6287,9 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos1
if ( puff && (puff->flags5 & MF5_PUFFGETSOWNER))
puff->target = source;
// [AA] Track the source of the attack unconditionally in a separate field.
puff->damagesource = source;
// Angle is the opposite of the hit direction (i.e. the puff faces the source.)
puff->Angles.Yaw = hitdir + DAngle::fromDeg(180);

View file

@ -2005,6 +2005,7 @@ DEFINE_FIELD(AActor, strafecount)
DEFINE_FIELD(AActor, target)
DEFINE_FIELD(AActor, master)
DEFINE_FIELD(AActor, tracer)
DEFINE_FIELD(AActor, damagesource)
DEFINE_FIELD(AActor, LastHeard)
DEFINE_FIELD(AActor, lastenemy)
DEFINE_FIELD(AActor, LastLookActor)

View file

@ -148,6 +148,7 @@ class Actor : Thinker native
native Actor Target;
native Actor Master;
native Actor Tracer;
native Actor DamageSource;
native Actor LastHeard;
native Actor LastEnemy;
native Actor LastLookActor;