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;
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++ )
{
@ -141,11 +139,7 @@ Class FlakAccumulator : Thinker
victim.DamageMobj(inflictor,source,amounts[i],type,DMG_THRUSTLESS);
}
// clean up
if ( inflictor )
{
if ( inflictor is 'FlakChunk' ) inflictor.bAMBUSH = false;
inflictor.bEXTREMEDEATH = false;
}
if ( inflictor ) inflictor.bEXTREMEDEATH = inflictor.default.bEXTREMEDEATH;
Destroy();
}
@ -346,26 +340,32 @@ Class FlakChunk : Actor
A_AlertMonsters();
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;
if ( !target.bNOBLOOD )
{
target.SpawnBlood(pos,AngleTo(target),damage);
A_StartSound("flak/meat",volume:0.3);
A_AlertMonsters();
}
return -1;
// safer to do here (backported from Demolitionist)
if ( !(other.bSHOOTABLE || other.bSOLID) || ((vel.length() <= 5) && other.bSHOOTABLE) || ((other == target) && !bHITOWNER) || (other == lasthit) )
return false;
return true;
}
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;
}
// with this we can guarantee that the chunk won't just keep on dealing damage
// this is something I wish Unreal's boulders did
lasthit = victim;
// 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);
// pass through if it's already dead
if ( victim.health-amt <= 0 )
@ -379,7 +379,16 @@ Class FlakChunk : Actor
}
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
{