Fix incorrect flak chunk behavior.

This commit is contained in:
Marisa the Magician 2022-12-08 14:39:12 +01:00
commit d2951cfe0d

View file

@ -132,8 +132,6 @@ Class FlakAccumulator : Thinker
if ( inflictor ) inflictor.bEXTREMEDEATH = true; if ( inflictor ) inflictor.bEXTREMEDEATH = true;
else type = 'Extreme'; else type = 'Extreme';
} }
// make sure accumulation isn't reentrant
if ( inflictor && (inflictor is 'FlakChunk') ) inflictor.bAMBUSH = true;
// 何? // 何?
for ( int i=0; i<amounts.Size(); i++ ) for ( int i=0; i<amounts.Size(); i++ )
{ {
@ -141,11 +139,7 @@ Class FlakAccumulator : Thinker
victim.DamageMobj(inflictor,source,amounts[i],type,DMG_THRUSTLESS); victim.DamageMobj(inflictor,source,amounts[i],type,DMG_THRUSTLESS);
} }
// clean up // clean up
if ( inflictor ) if ( inflictor ) inflictor.bEXTREMEDEATH = inflictor.default.bEXTREMEDEATH;
{
if ( inflictor is 'FlakChunk' ) inflictor.bAMBUSH = false;
inflictor.bEXTREMEDEATH = false;
}
Destroy(); Destroy();
} }
@ -346,26 +340,32 @@ Class FlakChunk : Actor
A_AlertMonsters(); A_AlertMonsters();
if ( vel.length() < 5 ) ExplodeMissile(); if ( vel.length() < 5 ) ExplodeMissile();
} }
override int DoSpecialDamage( Actor target, int damage, Name damagetype ) override bool CanCollideWith( Actor other, bool passive )
{ {
if ( bAMBUSH || (vel.length() <= 5) ) return damage; // safer to do here (backported from Demolitionist)
if ( !target.bNOBLOOD ) if ( !(other.bSHOOTABLE || other.bSOLID) || ((vel.length() <= 5) && other.bSHOOTABLE) || ((other == target) && !bHITOWNER) || (other == lasthit) )
{ return false;
target.SpawnBlood(pos,AngleTo(target),damage); return true;
A_StartSound("flak/meat",volume:0.3);
A_AlertMonsters();
}
return -1;
} }
override int SpecialMissileHit( Actor victim ) override int SpecialMissileHit( Actor victim )
{ {
if ( bAMBUSH || (vel.length() <= 5) || ((victim == target) && !bHITOWNER) || (victim == lasthit) ) // directly bounce off non-shootable solids
if ( !victim.bSHOOTABLE )
{
if ( victim.bSOLID )
{
BlockingMobj = victim;
A_HandleBounce();
lasthit = victim;
}
return 1; return 1;
}
// with this we can guarantee that the chunk won't just keep on dealing damage // with this we can guarantee that the chunk won't just keep on dealing damage
// this is something I wish Unreal's boulders did // this is something I wish Unreal's boulders did
lasthit = victim; lasthit = victim;
// gather damage // gather damage
FlakAccumulator.Accumulate(victim,GetMissileDamage(0,0),self,target,damagetype); int dmg = GetMissileDamage(0,0);
FlakAccumulator.Accumulate(victim,dmg,self,target,damagetype);
int amt = FlakAccumulator.GetAmount(victim); int amt = FlakAccumulator.GetAmount(victim);
// pass through if it's already dead // pass through if it's already dead
if ( victim.health-amt <= 0 ) if ( victim.health-amt <= 0 )
@ -379,7 +379,16 @@ Class FlakChunk : Actor
} }
return 1; return 1;
} }
return -1; // HACK
ExplodeMissile(null,victim);
if ( !victim.bNOBLOOD )
{
victim.SpawnBlood(pos,AngleTo(victim),dmg);
A_StartSound("flak/meat",volume:0.3);
A_AlertMonsters();
}
else SetStateLabel("Crash");
return 1;
} }
States States
{ {