Fix func_breakable being destroyed with one shot

A use function was added to func_breakable so it can be destroyed when
triggered by an entity but it stopped using health when shot.

Issue introduced in e0418bd2d4.
This commit is contained in:
Zack Middleton 2023-06-06 03:36:31 -05:00
parent ed6fbd1796
commit 08872e95e0

View file

@ -935,13 +935,13 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
// shootable doors / buttons don't actually have any health
if ( targ->s.eType == ET_MOVER ) {
if ( targ->use && (targ->moverState == MOVER_POS1
|| targ->moverState == ROTATOR_POS1) ) {
targ->use( targ, inflictor, attacker );
} else if ( targ->use == NULL ) { // entity is a func_breakable
if ( !Q_stricmp( targ->classname, "func_breakable" ) ) {
targ->health -= damage;
if (targ->health <= 0)
Break_Breakable (targ, attacker);
} else if ( targ->use && (targ->moverState == MOVER_POS1
|| targ->moverState == ROTATOR_POS1) ) {
targ->use( targ, inflictor, attacker );
}
return;
}