Fix broken shock roach death.

Fix hwgrunt not spinning down the minigun.
Other misc. fixes.
This commit is contained in:
Giegue
2023-03-04 17:24:01 -03:00
parent 62063e34da
commit bd02a95260
7 changed files with 40 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ new Trie:g_HLDefaultNames;
public plugin_init()
{
register_plugin( "HL-MONSTER Bridge", "1.0", "Giegue" );
register_plugin( "HL-MONSTER Bridge", "1.1", "Giegue" );
RegisterHam( Ham_IRelationship, "monster_alien_controller", "mmIRelationship" );
RegisterHam( Ham_IRelationship, "monster_alien_grunt", "mmIRelationship" );
@@ -67,10 +67,12 @@ public plugin_init()
TrieSetString( g_HLDefaultNames, "monster_osprey", "Osprey Helicopter" );
TrieSetString( g_HLDefaultNames, "monster_gargantua", "Gargantua" );
TrieSetString( g_HLDefaultNames, "monster_nihilanth", "Nihilanth" );
TrieSetString( g_HLDefaultNames, "monster_tentacle"," Tentacle" );
TrieSetString( g_HLDefaultNames, "monster_tentacle", "Tentacle" );
set_task( 0.3, "hlScan", 0, "", 0, "b" );
register_srvcmd( "monster_hurt_entity", "hlTakeDamage" );
RegisterHam( Ham_Killed, "player", "PlayerKilled", 1 );
}
public plugin_end()
{
@@ -186,3 +188,17 @@ public hlTakeDamage()
ExecuteHamB( Ham_TakeDamage, victim, inflictor, attacker, damage, damageBits );
}
}
public PlayerKilled( victim, attacker, shouldgib )
{
// don't obstruct monstermod
if ( victim == attacker )
return HAM_IGNORED;
// fix monster score
if ( entity_get_int( attacker, EV_INT_flags ) & FL_MONSTER )
entity_set_float( attacker, EV_FL_frags, entity_get_float( attacker, EV_FL_frags ) + 2 );
entity_set_edict( victim, EV_ENT_dmg_inflictor, attacker );
return HAM_IGNORED;
}

View File

@@ -399,12 +399,12 @@ void check_player_dead( edict_t *pPlayer )
}
else
{
// SOMETHING that is a monster
// Does this monster have a name?
if ( !FStringNull( pAttacker->v.netname ) )
strcpy(szName, STRING( pAttacker->v.netname ));
else
{
// No netname, use classname
// No name, use class
strcpy(szName, STRING( pAttacker->v.classname ));
}
}
@@ -537,8 +537,8 @@ void check_monster_info( edict_t *pPlayer )
// It should be alive
if ( UTIL_IsAlive( tr.pHit ) )
{
// Must be a monster
if (tr.pHit->v.flags & FL_MONSTER)
// Must be a monster (and strictly a monster!)
if (strncmp( STRING( tr.pHit->v.classname ), "monster_", 8 ) == 0 && tr.pHit->v.flags & FL_MONSTER)
{
char szName[129];
float monsterHealth, monsterFrags;

View File

@@ -372,6 +372,8 @@ void CMHornet::DieTouch ( edict_t *pOther )
CMBaseMonster *pMonster = GetClassPtr((CMBaseMonster *)VARS(pOther));
pMonster->TakeDamage( pev, VARS( pev->owner ), pev->dmg, DMG_BULLET );
}
else
UTIL_TakeDamageExternal( pOther, pev, VARS( pev->owner ), pev->dmg, DMG_BULLET );
}
pev->modelindex = 0;// so will disappear for the 0.1 secs we wait until NEXTTHINK gets rid

View File

@@ -700,7 +700,18 @@ void CMHWGrunt :: SetActivity ( Activity NewActivity )
case ACT_RUN:
case ACT_WALK:
default:
iSequence = LookupActivity ( NewActivity );
if ( m_flMinigunSpinTime != 0 )
{
// if the hwgrunt used his minigun but became unable to attack
// then spin it down before doing anything else
refreshActivity = FALSE;
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "hassault/hw_spindown.wav", 0.8, ATTN_NORM);
m_flMinigunSpinTime = gpGlobals->time + 1.40;
iSequence = LookupSequence( "spindown" );
}
else
iSequence = LookupActivity ( NewActivity );
break;
}

View File

@@ -153,7 +153,7 @@ void CMShockRoach::MonsterThink(void)
{
pev->health = -1;
Killed(pev, 0);
return;
//return; // it still needs to think
}
CMHeadCrab::MonsterThink();

View File

@@ -39,7 +39,7 @@ typedef struct {
} gamedll_funcs_t;
extern gamedll_funcs_t *gpGamedllFuncs;
extern void check_player_dead( edict_t *pPlayer );
// Print to console.
void META_CONS(char *fmt, ...) {
@@ -1760,6 +1760,7 @@ int UTIL_TakeDamage( edict_t *pEdict, entvars_t *pevInflictor, entvars_t *pevAtt
{
pEdict->v.health = 1; // can't suicide if already dead!
gpGamedllFuncs->dllapi_table->pfnClientKill(pEdict);
check_player_dead(pEdict); // will you just fucking work?
// Add 1 score to the monster that killed this player
if ( pevAttacker->flags & FL_MONSTER )