Enhance item_security

This commit is contained in:
s1lent 2018-05-24 12:50:50 +07:00
parent 96af8a797d
commit 8e3b6f4166
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C

View File

@ -282,13 +282,32 @@ LINK_ENTITY_TO_CLASS(item_antidote, CItemAntidote, CCSItemAntidote)
void CItemSecurity::Spawn() void CItemSecurity::Spawn()
{ {
Precache(); Precache();
SET_MODEL(ENT(pev), "models/w_security.mdl");
if (pev->model.IsNullOrEmpty())
{
// default model
SET_MODEL(ENT(pev), "models/w_security.mdl");
}
else
{
// custom model
SET_MODEL(ENT(pev), pev->model);
}
CItem::Spawn(); CItem::Spawn();
} }
void CItemSecurity::Precache() void CItemSecurity::Precache()
{ {
PRECACHE_MODEL("models/w_security.mdl"); if (pev->model.IsNullOrEmpty())
{
// default model
PRECACHE_MODEL("models/w_security.mdl");
return;
}
// custom model
PRECACHE_MODEL(pev->model);
} }
BOOL CItemSecurity::MyTouch(CBasePlayer *pPlayer) BOOL CItemSecurity::MyTouch(CBasePlayer *pPlayer)