Skip to content

Commit 35b921c

Browse files
committed
Add 'Ignored by' parameter for monsters
1 parent 74a0ab3 commit 35b921c

File tree

6 files changed

+95
-2
lines changed

6 files changed

+95
-2
lines changed

dlls/basemonster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ class CBaseMonster : public CBaseToggle
447447

448448
int m_customSoundMask;
449449
short m_prisonerTo;
450+
short m_ignoredBy;
450451
short m_freeRoam;
451452
short m_activeAfterCombat;
452453
short m_huntActivitiesCount;

dlls/hgrunt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,6 +2444,7 @@ void CHGruntRepel::RepelUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
24442444
pGrunt->m_displayName = m_displayName;
24452445
pGrunt->m_customSoundMask = m_customSoundMask;
24462446
pGrunt->m_prisonerTo = m_prisonerTo;
2447+
pGrunt->m_ignoredBy = m_ignoredBy;
24472448
pGrunt->m_freeRoam = m_freeRoam;
24482449
pGrunt->m_activeAfterCombat = m_activeAfterCombat;
24492450
pGrunt->m_sizeForGrapple = m_sizeForGrapple;

dlls/monstermaker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ CBaseEntity* CMonsterMaker::SpawnMonster(const Vector &placePosition, const Vect
740740

741741
createdMonster->m_customSoundMask = m_customSoundMask;
742742
createdMonster->m_prisonerTo = m_prisonerTo;
743+
createdMonster->m_ignoredBy = m_ignoredBy;
743744
createdMonster->m_freeRoam = m_freeRoam;
744745
createdMonster->m_activeAfterCombat = m_activeAfterCombat;
745746
createdMonster->m_sizeForGrapple = m_sizeForGrapple;

dlls/monsters.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ TYPEDESCRIPTION CBaseMonster::m_SaveData[] =
123123

124124
DEFINE_FIELD( CBaseMonster, m_customSoundMask, FIELD_INTEGER ),
125125
DEFINE_FIELD( CBaseMonster, m_prisonerTo, FIELD_SHORT ),
126+
DEFINE_FIELD( CBaseMonster, m_ignoredBy, FIELD_SHORT ),
126127
DEFINE_FIELD( CBaseMonster, m_freeRoam, FIELD_SHORT ),
127128
DEFINE_FIELD( CBaseMonster, m_activeAfterCombat, FIELD_SHORT ),
128129
DEFINE_FIELD( CBaseMonster, m_huntActivitiesCount, FIELD_SHORT ),
@@ -361,9 +362,15 @@ void CBaseMonster::Look( int iDistance )
361362
(!m_prisonerTo || m_prisonerTo != pSightEnt->Classify()) &&
362363
pSightEnt->pev->health > 0 )
363364
{
365+
const int myClassify = Classify();
364366
CBaseMonster* pSightMonster = pSightEnt->MyMonsterPointer();
365-
if (pSightMonster && pSightMonster->m_prisonerTo != 0 && pSightMonster->m_prisonerTo == Classify())
366-
continue;
367+
if (pSightMonster)
368+
{
369+
if (pSightMonster->m_prisonerTo != 0 && pSightMonster->m_prisonerTo == myClassify)
370+
continue;
371+
if (pSightMonster->m_ignoredBy != 0 && pSightMonster->m_ignoredBy == myClassify)
372+
continue;
373+
}
367374

368375
const int iRelationship = IRelationship( pSightEnt );
369376
// the looker will want to consider this entity
@@ -3672,6 +3679,11 @@ void CBaseMonster::KeyValue( KeyValueData *pkvd )
36723679
m_prisonerTo = (short)atoi( pkvd->szValue );
36733680
pkvd->fHandled = TRUE;
36743681
}
3682+
else if ( FStrEq( pkvd->szKeyName, "ignoredby" ) )
3683+
{
3684+
m_ignoredBy = (short)atoi( pkvd->szValue );
3685+
pkvd->fHandled = TRUE;
3686+
}
36753687
else if ( FStrEq( pkvd->szKeyName, "freeroam" ) )
36763688
{
36773689
m_freeRoam = (short)atoi( pkvd->szValue );

dlls/triggers.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5552,6 +5552,7 @@ class CTriggerConfigureMonster : public CPointEntity
55525552
short m_freeRoam;
55535553
short m_sizeForGrapple;
55545554
short m_gibPolicy;
5555+
short m_ignoredBy;
55555556

55565557
short m_iTriggerCondition;
55575558
short m_iTriggerAltCondition;
@@ -5583,6 +5584,7 @@ TYPEDESCRIPTION CTriggerConfigureMonster::m_SaveData[] =
55835584
DEFINE_FIELD( CTriggerConfigureMonster, m_freeRoam, FIELD_SHORT ),
55845585
DEFINE_FIELD( CTriggerConfigureMonster, m_sizeForGrapple, FIELD_SHORT ),
55855586
DEFINE_FIELD( CTriggerConfigureMonster, m_gibPolicy, FIELD_SHORT ),
5587+
DEFINE_FIELD( CTriggerConfigureMonster, m_ignoredBy, FIELD_SHORT ),
55865588
DEFINE_FIELD( CTriggerConfigureMonster, m_iTriggerCondition, FIELD_SHORT ),
55875589
DEFINE_FIELD( CTriggerConfigureMonster, m_iTriggerAltCondition, FIELD_SHORT ),
55885590
DEFINE_FIELD( CTriggerConfigureMonster, m_iszTriggerTarget, FIELD_STRING ),
@@ -5658,6 +5660,11 @@ void CTriggerConfigureMonster::KeyValue(KeyValueData *pkvd)
56585660
m_gibPolicy = (short)atoi( pkvd->szValue );
56595661
pkvd->fHandled = TRUE;
56605662
}
5663+
else if ( FStrEq( pkvd->szKeyName, "ignoredby" ) )
5664+
{
5665+
m_ignoredBy = (short)atoi( pkvd->szValue );
5666+
pkvd->fHandled = TRUE;
5667+
}
56615668
else if( FStrEq( pkvd->szKeyName, "TriggerTarget" ) )
56625669
{
56635670
m_iszTriggerTarget = ALLOC_STRING( pkvd->szValue );
@@ -5773,6 +5780,7 @@ void CTriggerConfigureMonster::Affect(CBaseEntity *pEntity)
57735780
MaySetResettableValue(pMonster->m_freeRoam, m_freeRoam);
57745781
MaySetResettableValue2(pMonster->m_sizeForGrapple, m_sizeForGrapple);
57755782
MaySetResettableValue(pMonster->m_gibPolicy, m_gibPolicy);
5783+
MaySetResettableValue(pMonster->m_ignoredBy, m_ignoredBy);
57765784

57775785
MaySetResettableValue(pMonster->m_iTriggerCondition, m_iTriggerCondition);
57785786
MaySetResettableValue(pMonster->m_iTriggerAltCondition, m_iTriggerAltCondition);

fgd/halflife.fgd

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,29 @@
295295
18 : "Snark"
296296
19 : "Gargantua"
297297
]
298+
ignoredby(choices) : "Ignored by classify" : : "Get ignored by this class" =
299+
[
300+
0 : "Not ignored"
301+
1 : "Machine"
302+
2 : "Player"
303+
3 : "Human passive"
304+
4 : "Human military"
305+
5 : "Alien military"
306+
6 : "Alien passive"
307+
7 : "Alien monster"
308+
8 : "Alien prey"
309+
9 : "Alien predator"
310+
10 : "Insect"
311+
11 : "Player ally"
312+
12 : "Player bioweapon"
313+
13 : "Alien bioweapon"
314+
14 : "Race X predator"
315+
15 : "Race X shock"
316+
16 : "Opfor ally"
317+
17 : "Blackops"
318+
18 : "Snark"
319+
19 : "Gargantua"
320+
]
298321
]
299322

300323
@BaseClass = MonsterSoundMask
@@ -7702,6 +7725,53 @@
77027725
127 : "Every sound and scent"
77037726
1028 : "Default, except Player"
77047727
]
7728+
prisonerto(choices) : "Act as Prisoner to" =
7729+
[
7730+
-1 : "Reset"
7731+
0 : "No change"
7732+
1 : "Machine"
7733+
2 : "Player"
7734+
3 : "Human passive"
7735+
4 : "Human military"
7736+
5 : "Alien military"
7737+
6 : "Alien passive"
7738+
7 : "Alien monster"
7739+
8 : "Alien prey"
7740+
9 : "Alien predator"
7741+
10 : "Insect"
7742+
11 : "Player ally"
7743+
12 : "Player bioweapon"
7744+
13 : "Alien bioweapon"
7745+
14 : "Race X predator"
7746+
15 : "Race X shock"
7747+
16 : "Opfor ally"
7748+
17 : "Blackops"
7749+
18 : "Snark"
7750+
19 : "Gargantua"
7751+
]
7752+
ignoredby(choices) : "Ignored by classify" =
7753+
[
7754+
-1 : "Reset"
7755+
0 : "No change"
7756+
1 : "Machine"
7757+
3 : "Human passive"
7758+
4 : "Human military"
7759+
5 : "Alien military"
7760+
6 : "Alien passive"
7761+
7 : "Alien monster"
7762+
8 : "Alien prey"
7763+
9 : "Alien predator"
7764+
10 : "Insect"
7765+
11 : "Player ally"
7766+
12 : "Player bioweapon"
7767+
13 : "Alien bioweapon"
7768+
14 : "Race X predator"
7769+
15 : "Race X shock"
7770+
16 : "Opfor ally"
7771+
17 : "Blackops"
7772+
18 : "Snark"
7773+
19 : "Gargantua"
7774+
]
77057775
TriggerTarget(String) : "TriggerTarget" : : "The event to trigger when the TriggerCondition is met. Setting 'null' means clearing the trigger target."
77067776
TriggerCondition(Choices) : "Trigger Condition" : : "This controls the condition under which a monster will trigger its TriggerTarget. The options are:" =
77077777
[

0 commit comments

Comments
 (0)