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
// 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 ) );
if ( !FNullEnt( existsGAME ) )
{
// this entity already exists and we should ignore it
// use REMOVE_ENTITY instead of UTIL_Remove!
// 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
@@ -467,10 +467,16 @@ void scan_monster_bsp(void)
else if (strcmp(kv_pair->key, "use_monstermod") == 0)
{
if (atoi(kv_pair->value) == 1)
{
// The extra plugin must be available to handle the old entity!
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);
}
}
strcpy(data[kvd_index].key, kv_pair->key);

View File

@@ -70,6 +70,12 @@ void CMMonsterMaker :: KeyValue( KeyValueData *pkvd )
m_iMonsterBlood = atoi(pkvd->szValue);
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.
// CMBaseMonster::KeyValue will process TriggerCondition/TriggerTarget
// keyvalues in the same way.