示例#1
0
CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity)	// Last check: 2013, May 28
{
	CGrenade *pGrenade = GetClassPtr((CGrenade*)NULL);

	pGrenade->pev->movetype	= MOVETYPE_TOSS;
	pGrenade->pev->solid	= SOLID_BBOX;

	if (pGrenade->pev->classname)
		RemoveEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME);

	pGrenade->pev->classname = MAKE_STRING("grenade");

	AddEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME);

	SET_MODEL(ENT(pGrenade->pev), "models/w_c4.mdl");

	UTIL_SetSize(pGrenade->pev, Vector(3, 6, 8), Vector(-3, -6, 0));
	UTIL_SetOrigin(pGrenade->pev, vecStart);

	pGrenade->pev->dmg		= 100;
	pGrenade->pev->angles	= vecVelocity;
	pGrenade->pev->velocity = g_vecZero;
	pGrenade->pev->owner	= ENT(pevOwner);

	pGrenade->SetThink(&CGrenade::C4Think);
	pGrenade->SetTouch(&CGrenade::C4Touch);

	pGrenade->pev->spawnflags = SF_DETONATE;
	pGrenade->pev->nextthink  = gpGlobals->time + 0.1;

	pGrenade->m_flC4Blow			= gpGlobals->time + g_pGameRules->m_iC4Timer;
	pGrenade->m_flNextFreqInterval	= g_pGameRules->m_iC4Timer / 4;
	pGrenade->m_flNextFreq			= gpGlobals->time;
	pGrenade->m_flNextBeep			= gpGlobals->time + 0.5;
	pGrenade->m_flNextBlink			= gpGlobals->time + 2.0;

	pGrenade->m_iCurWave	= 0;
	pGrenade->m_fAttenu		= 0;
	pGrenade->m_sBeepName	= NULL;

	pGrenade->m_fNextDefuse = 0;

	pGrenade->m_bIsC4		= true;
	pGrenade->m_bStartDefuse= false;
	pGrenade->m_bJustBlew	= false;

	pGrenade->pev->friction = 0.9;

	if (!FNullEnt(pevOwner))
	{
		CBasePlayer *pPlayer = (CBasePlayer*)Instance(pevOwner);

		if (pPlayer->IsPlayer())
			pGrenade->m_pentCurBombTarget = pPlayer->m_pentCurBombTarget;
	}
	else
		pGrenade->m_pentCurBombTarget = NULL;

	return pGrenade;
}
示例#2
0
void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value)
{
	if (FStringNull(pev->target) && !m_iszKillTarget)
		return;

	if (m_flDelay != 0)
	{
		CBaseDelay *pTemp = GetClassPtr((CBaseDelay *)NULL);

		if (pTemp->pev->classname)
			RemoveEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME);

		pTemp->pev->classname = MAKE_STRING("DelayedUse");
		AddEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME);

		pTemp->pev->nextthink = gpGlobals->time + m_flDelay;
		pTemp->SetThink(&CBaseDelay::DelayThink);
		pTemp->pev->button = (int)useType;
		pTemp->m_iszKillTarget = m_iszKillTarget;
		pTemp->m_flDelay = 0;
		pTemp->pev->target = pev->target;

		if (pActivator && pActivator->IsPlayer())
			pTemp->pev->owner = pActivator->edict();
		else
			pTemp->pev->owner = NULL;

		return;
	}

	if (m_iszKillTarget)
	{
		ALERT(at_aiconsole, "KillTarget: %s\n", STRING(m_iszKillTarget));
		edict_t *pentKillTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszKillTarget));

		while (!FNullEnt(pentKillTarget))
		{
			UTIL_Remove(CBaseEntity::Instance(pentKillTarget));
			ALERT(at_aiconsole, "killing %s\n", STRING(pentKillTarget->v.classname));
			pentKillTarget = FIND_ENTITY_BY_TARGETNAME(pentKillTarget, STRING(m_iszKillTarget));
		}
	}

	if (!FStringNull(pev->target))
		FireTargets(STRING(pev->target), pActivator, this, useType, value);
}
示例#3
0
/* <36b5fa> ../cstrike/dlls/bot/cs_bot_manager.cpp:415 */
void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer)
{
	if (!pPlayer || !pPlayer->IsBot())
		return;

	CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
	entvars_t *temp = VARS(pPlayer->edict());

	pBot->Disconnect();

	if (pPlayer->pev->classname)
		RemoveEntityHashValue(pPlayer->pev, STRING(pPlayer->pev->classname), CLASSNAME);

	FREE_PRIVATE(pPlayer->edict());

	CBasePlayer *player = GetClassPtr((CBasePlayer *)temp);
	AddEntityHashValue(player->pev, STRING(player->pev->classname), CLASSNAME);
	player->pev->flags = FL_DORMANT;
}
示例#4
0
void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
{
	if (!szModel || !*szModel)
	{
		ALERT(at_error, "cycler at %.0f %.0f %0.f missing modelname", pev->origin.x, pev->origin.y, pev->origin.z);
		REMOVE_ENTITY(ENT(pev));
		return;
	}

	if (pev->classname)
		RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);

	pev->classname = MAKE_STRING("cycler");
	AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);

	PRECACHE_MODEL(szModel);
	SET_MODEL(ENT(pev), szModel);
	CCycler::Spawn();
	UTIL_SetSize(pev, vecMin, vecMax);
}
示例#5
0
void CGrenade::Spawn(void)
{
	m_iBounceCount = 0;

	pev->movetype = MOVETYPE_BOUNCE;

	if (pev->classname)
		RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);

	pev->classname = MAKE_STRING("grenade");
	AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);

	m_bIsC4 = false;
	pev->solid = SOLID_BBOX;

	SET_MODEL(ENT(pev), "models/grenade.mdl");
	UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));

	pev->dmg = 30;
	m_fRegisteredSound = FALSE;
}
示例#6
0
void CHostage::Spawn(void)
{
	Precache();

	if (pev->classname)
		RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME);

	pev->classname = MAKE_STRING("hostage_entity");
	AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME);

	pev->movetype = MOVETYPE_STEP;
	pev->solid = SOLID_SLIDEBOX;
	pev->takedamage = DAMAGE_YES;
	pev->flags |= FL_MONSTER;
	pev->deadflag = DEAD_NO;
	pev->max_health = 100;
	pev->health = pev->max_health;
	pev->gravity = 1;
	pev->view_ofs = VEC_HOSTAGE_VIEW;
	pev->velocity = Vector(0, 0, 0);

	if (pev->spawnflags & SF_MONSTER_HITMONSTERCLIP)
		pev->flags |= FL_MONSTERCLIP;

	if (pev->skin < 0)
		pev->skin = 0;

	SET_MODEL(ENT(pev), STRING(pev->model));
	SetActivity(ACT_IDLE);

	m_flNextChange = 0;
	m_State = STAND;
	m_hTargetEnt = NULL;
	m_hStoppedTargetEnt = NULL;
	m_vPathToFollow[0] = Vector(0, 0, 0);
	m_flFlinchTime = 0;
	m_bRescueMe = 0;

	UTIL_SetSize(pev, VEC_HOSTAGE_HULL_MIN, VEC_HOSTAGE_HULL_MAX);
	UTIL_MakeVectors(pev->v_angle);

	SetBoneController(0, UTIL_VecToYaw(gpGlobals->v_forward));
	SetBoneController(1, 0);
	SetBoneController(2, 0);
	SetBoneController(3, 0);
	SetBoneController(4, 0);

	DROP_TO_FLOOR(ENT(pev));

	SetThink(&CHostage::IdleThink);
	pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);

	m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
	m_vStart = pev->origin;
	m_vStartAngles = pev->angles;
	m_vOldPos = Vector(9999, 9999, 9999);
	m_iHostageIndex = ++g_iHostageNumber;
	nTargetNode = -1;
	m_fHasPath = FALSE;
	m_flLastPathCheck = -1;
	m_flPathAcquired = -1;
	m_flPathCheckInterval = 0.1;
	m_flNextRadarTime = gpGlobals->time + RANDOM_FLOAT(0, 1);
	m_LocalNav = new CLocalNav(this);
	m_bStuck = FALSE;
	m_flStuckTime = 0;
	m_improv = NULL;
}