Another fix to something that can fail catastrophically if monsters spontaneously cease to exist in the middle of a DamageMobj call.
Small adjustment to translocator module (hitbox uses master rather than target pointer), for safety. Removed some leftover sounds.
This commit is contained in:
parent
e2e55bf23b
commit
ada67df8c0
4 changed files with 15 additions and 13 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -13,34 +13,34 @@ Class ModuleHitbox : Actor
|
||||||
}
|
}
|
||||||
override int DamageMobj( Actor inflictor, Actor source, int damage, Name mod, int flags, double angle )
|
override int DamageMobj( Actor inflictor, Actor source, int damage, Name mod, int flags, double angle )
|
||||||
{
|
{
|
||||||
if ( target )
|
if ( master )
|
||||||
{
|
{
|
||||||
if ( inflictor ) target.vel += level.Vec3Diff(inflictor.pos,pos).unit()*damage*0.2;
|
if ( inflictor ) master.vel += level.Vec3Diff(inflictor.pos,pos).unit()*damage*0.2;
|
||||||
else if ( source ) target.vel += level.Vec3Diff(source.pos,pos).unit()*damage*0.2;
|
else if ( source ) master.vel += level.Vec3Diff(source.pos,pos).unit()*damage*0.2;
|
||||||
target.vel.z = 5;
|
master.vel.z = 5;
|
||||||
}
|
}
|
||||||
if ( !target || (target.target && ((target.target == source) || target.target.isTeammate(source))) ) return 0;
|
if ( !master || (master.target && ((master.target == source) || master.target.isTeammate(source))) ) return 0;
|
||||||
target.bAMBUSH = true;
|
master.bAMBUSH = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
override void Tick()
|
override void Tick()
|
||||||
{
|
{
|
||||||
Super.Tick();
|
Super.Tick();
|
||||||
if ( !target )
|
if ( !master )
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetOrigin(target.pos,true);
|
SetOrigin(master.pos,true);
|
||||||
if ( target.bMISSILE ) return;
|
if ( master.bMISSILE ) return;
|
||||||
let bi = BlockThingsIterator.Create(self,32);
|
let bi = BlockThingsIterator.Create(self,32);
|
||||||
while ( bi.Next() )
|
while ( bi.Next() )
|
||||||
{
|
{
|
||||||
if ( !bi.Thing || (bi.Thing != target.target) ) continue;
|
if ( !bi.Thing || (bi.Thing != master.target) ) continue;
|
||||||
if ( (Distance2D(bi.Thing)-bi.Thing.radius <= radius) && ((bi.Thing.pos.z <= pos.z+height) && (bi.Thing.pos.z+bi.Thing.height >= pos.z-height)) )
|
if ( (Distance2D(bi.Thing)-bi.Thing.radius <= radius) && ((bi.Thing.pos.z <= pos.z+height) && (bi.Thing.pos.z+bi.Thing.height >= pos.z-height)) )
|
||||||
{
|
{
|
||||||
A_PlaySound("misc/i_pkup");
|
A_PlaySound("misc/i_pkup");
|
||||||
target.Destroy();
|
master.Destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +149,7 @@ Class TranslocatorModule : Actor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
b = Spawn("ModuleHitbox",pos);
|
b = Spawn("ModuleHitbox",pos);
|
||||||
b.target = self;
|
b.master = self;
|
||||||
A_PlaySound("transloc/hum",CHAN_VOICE,0.5,true,2.0);
|
A_PlaySound("transloc/hum",CHAN_VOICE,0.5,true,2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1974,7 +1974,7 @@ Class ShredCorpseHitbox : Actor
|
||||||
override void Tick()
|
override void Tick()
|
||||||
{
|
{
|
||||||
Super.Tick();
|
Super.Tick();
|
||||||
if ( (!(target is 'UTPlayer') && !flak_corpsedamage) || !target || (target.Health > 0) || target.InStateSequence(target.CurState,target.FindState("XDeath")) )
|
if ( (!(target is 'UTPlayer') && !flak_corpsedamage) || !target || (target.Health > 0) || target.InStateSequence(target.CurState,target.FindState("XDeath",true)) )
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
|
|
@ -1995,6 +1995,8 @@ Class ShredCorpseHitbox : Actor
|
||||||
}
|
}
|
||||||
override int DamageMobj( Actor inflictor, Actor source, int damage, Name mod, int flags, double angle )
|
override int DamageMobj( Actor inflictor, Actor source, int damage, Name mod, int flags, double angle )
|
||||||
{
|
{
|
||||||
|
// somehow target can spontaneously stop existing while this is happening
|
||||||
|
if ( !target ) return 0;
|
||||||
if ( (target is 'UTPlayer') && (mod == 'Zapped') && (target.sprite == target.GetSpriteIndex('PLD9')) )
|
if ( (target is 'UTPlayer') && (mod == 'Zapped') && (target.sprite == target.GetSpriteIndex('PLD9')) )
|
||||||
{
|
{
|
||||||
// keep the zapping action on
|
// keep the zapping action on
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue