Add keyvalue to disable item dropping
SamVanheer/halflife-op4-updated#72
This commit is contained in:
parent
cb1a50d24d
commit
b624a61897
3 changed files with 24 additions and 2 deletions
|
@ -109,6 +109,8 @@ public:
|
|||
|
||||
float m_flLastYawTime;
|
||||
|
||||
bool m_AllowItemDropping = true;
|
||||
|
||||
bool Save(CSave& save) override;
|
||||
bool Restore(CRestore& restore) override;
|
||||
|
||||
|
@ -356,5 +358,9 @@ public:
|
|||
bool ExitScriptedSequence();
|
||||
bool CineCleanup();
|
||||
|
||||
CBaseEntity* DropItem(const char* pszItemName, const Vector& vecPos, const Vector& vecAng); // drop an item.
|
||||
/**
|
||||
* @brief Drop an item.
|
||||
* Will return @c nullptr if item dropping is disabled for this NPC.
|
||||
*/
|
||||
CBaseEntity* DropItem(const char* pszItemName, const Vector& vecPos, const Vector& vecAng);
|
||||
};
|
||||
|
|
|
@ -100,6 +100,7 @@ TYPEDESCRIPTION CBaseMonster::m_SaveData[] =
|
|||
|
||||
DEFINE_FIELD(CBaseMonster, m_scriptState, FIELD_INTEGER),
|
||||
DEFINE_FIELD(CBaseMonster, m_pCine, FIELD_CLASSPTR),
|
||||
DEFINE_FIELD(CBaseMonster, m_AllowItemDropping, FIELD_BOOLEAN),
|
||||
};
|
||||
|
||||
//IMPLEMENT_SAVERESTORE( CBaseMonster, CBaseToggle );
|
||||
|
@ -2977,6 +2978,10 @@ bool CBaseMonster::KeyValue(KeyValueData* pkvd)
|
|||
m_iTriggerCondition = atoi(pkvd->szValue);
|
||||
return true;
|
||||
}
|
||||
else if (FStrEq(pkvd->szKeyName, "allow_item_dropping"))
|
||||
{
|
||||
m_AllowItemDropping = atoi(pkvd->szValue) != 0;
|
||||
}
|
||||
|
||||
return CBaseToggle::KeyValue(pkvd);
|
||||
}
|
||||
|
@ -3411,7 +3416,12 @@ CBaseEntity* CBaseMonster::DropItem(const char* pszItemName, const Vector& vecPo
|
|||
if (!pszItemName)
|
||||
{
|
||||
ALERT(at_console, "DropItem() - No item name!\n");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!m_AllowItemDropping)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CBaseEntity* pItem = CBaseEntity::Create(pszItemName, vecPos, vecAng, edict());
|
||||
|
|
|
@ -180,6 +180,12 @@
|
|||
256: "Pre-Disaster" : 0
|
||||
512: "Fade Corpse" : 0
|
||||
]
|
||||
|
||||
allow_item_dropping(choices) : "Allow Item Dropping" : 1 : "This controls whether this NPC will drop items on death" =
|
||||
[
|
||||
0 : "No"
|
||||
1 : "Yes"
|
||||
]
|
||||
]
|
||||
|
||||
@BaseClass = TalkMonster
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue