You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
66 lines
1.6 KiB
8 years ago
|
/***
|
||
|
*
|
||
|
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
|
||
|
*
|
||
|
* This product contains software technology licensed from Id
|
||
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||
|
* All Rights Reserved.
|
||
|
*
|
||
|
* Use, distribution, and modification of this source code and/or resulting
|
||
|
* object code is restricted to non-commercial enhancements to products from
|
||
|
* Valve LLC. All other use, distribution, or modification is prohibited
|
||
|
* without written permission from Valve LLC.
|
||
|
*
|
||
|
****/
|
||
|
|
||
|
#include "extdll.h"
|
||
|
#include "util.h"
|
||
|
#include "cbase.h"
|
||
|
#include "weapons.h"
|
||
|
#include "player.h"
|
||
|
#include "skill.h"
|
||
|
#include "items.h"
|
||
|
#include "gamerules.h"
|
||
|
|
||
|
extern int gmsgItemPickup;
|
||
|
|
||
|
class CItemKevlar : public CItem
|
||
|
{
|
||
|
void Spawn(void)
|
||
|
{
|
||
|
Precache();
|
||
|
SET_MODEL(ENT(pev), "models/w_kevlar.mdl");
|
||
|
CItem::Spawn();
|
||
|
}
|
||
|
void Precache(void)
|
||
|
{
|
||
|
PRECACHE_MODEL("models/w_kevlar.mdl");
|
||
|
PRECACHE_SOUND("player/kevlar_zipper.wav");
|
||
|
}
|
||
|
BOOL MyTouch(CBasePlayer *pPlayer)
|
||
|
{
|
||
|
if (pPlayer->pev->deadflag != DEAD_NO)
|
||
|
{
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
if ((pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY) &&
|
||
|
(pPlayer->pev->weapons & (1 << WEAPON_SUIT)))
|
||
|
{
|
||
|
pPlayer->pev->armorvalue += MAX_NORMAL_BATTERY;
|
||
|
pPlayer->pev->armorvalue = min(pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY);
|
||
|
|
||
|
EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "player/kevlar_zipper.wav", 1, ATTN_NORM);
|
||
|
|
||
|
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev);
|
||
|
WRITE_STRING(STRING(pev->classname));
|
||
|
MESSAGE_END();
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
return FALSE;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
LINK_ENTITY_TO_CLASS(item_bodyarmour, CItemKevlar);
|