Add missing keyvalue in monstermaker.

Fix duplicate entity spawn in Half-Life.
This commit is contained in:
Giegue
2023-04-27 13:02:23 -03:00
parent f751720e59
commit ba9414ea6e
2 changed files with 16 additions and 4 deletions

View File

@@ -450,11 +450,11 @@ void scan_monster_bsp(void)
{ {
// the entity we are trying to spawn could already exist within the game // the entity we are trying to spawn could already exist within the game
// use the engine's CREATE_NAMED_ENTITY to see if it's valid or not // use the engine's CREATE_NAMED_ENTITY to see if it's valid or not
//
// if it is valid, this entity already exists and we should ignore it
edict_t *existsGAME = CREATE_NAMED_ENTITY( MAKE_STRING( kv_pair->value ) ); edict_t *existsGAME = CREATE_NAMED_ENTITY( MAKE_STRING( kv_pair->value ) );
if ( !FNullEnt( existsGAME ) ) if ( !FNullEnt( existsGAME ) )
{ {
// this entity already exists and we should ignore it
// use REMOVE_ENTITY instead of UTIL_Remove! // use REMOVE_ENTITY instead of UTIL_Remove!
// UTIL_Remove sets FL_KILLME to remove the entity on the next frame, that won't do. // UTIL_Remove sets FL_KILLME to remove the entity on the next frame, that won't do.
// REMOVE_ENTITY instead removes it instantly, which is needed to prevent server crashes // REMOVE_ENTITY instead removes it instantly, which is needed to prevent server crashes
@@ -468,8 +468,14 @@ void scan_monster_bsp(void)
{ {
if (atoi(kv_pair->value) == 1) if (atoi(kv_pair->value) == 1)
{ {
// EXPLICITY requested to use monstermod for this entity // The extra plugin must be available to handle the old entity!
use_monstermod_explicit = true; if (CVAR_GET_FLOAT("_hl_explicit"))
{
// EXPLICITY requested to use monstermod for this entity
use_monstermod_explicit = true;
}
else
LOG_MESSAGE(PLID, "WARNING: can't explicity add entity #%i - add-on plugin unavailable", ent);
} }
} }

View File

@@ -70,6 +70,12 @@ void CMMonsterMaker :: KeyValue( KeyValueData *pkvd )
m_iMonsterBlood = atoi(pkvd->szValue); m_iMonsterBlood = atoi(pkvd->szValue);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if ( FStrEq(pkvd->szKeyName, "respawn_as_playerally") )
{
if (atoi(pkvd->szValue))
m_iClassifyOverride = CLASS_PLAYER_ALLY;
pkvd->fHandled = TRUE;
}
// These are to keep consistency with Sven Co-op's squadmaker entity. // These are to keep consistency with Sven Co-op's squadmaker entity.
// CMBaseMonster::KeyValue will process TriggerCondition/TriggerTarget // CMBaseMonster::KeyValue will process TriggerCondition/TriggerTarget
// keyvalues in the same way. // keyvalues in the same way.