Exemplo n.º 1
0
void CGib::Spawn(const char *szGibModel)
{
	pev->movetype = MOVETYPE_BOUNCE;

	// deading the bounce a bit
	pev->friction = 0.55;

	// sometimes an entity inherits the edict from a former piece of glass,
	// and will spawn using the same render FX or rendermode! bad!
	pev->renderamt = 255.0;
	pev->rendermode = kRenderNormal;
	pev->renderfx = kRenderFxNone;

	/// hopefully this will fix the VELOCITY TOO LOW crap
	pev->solid = SOLID_SLIDEBOX;

	MAKE_STRING_CLASS("gib", pev);

	SET_MODEL(ENT(pev), szGibModel);
	UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));

	pev->nextthink = gpGlobals->time + 4.0f;
	m_lifeTime = 25.0f;

	SetThink(&CGib::WaitTillLand);
	SetTouch(&CGib::BounceGibTouch);

	m_material = matNone;

	// how many blood decals this gib can place (1 per bounce until none remain).
	m_cBloodDecals = 5;
}
Exemplo n.º 2
0
/* <1844c2> ../cstrike/dlls/subs.cpp:252 */
void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value)
{
	if (!pev->target && !m_iszKillTarget)
		return;

	if (!m_flDelay)
	{
		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 (pev->target)
			FireTargets(STRING(pev->target), pActivator, this, useType, value);
	}
	else
	{
		CBaseDelay *pTemp = GetClassPtr((CBaseDelay *)NULL);
		if (pTemp->pev->classname)
			RemoveEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME);

		MAKE_STRING_CLASS("DelayedUse", pTemp->pev);
		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.0f;
		pTemp->pev->target = pev->target;

		if (pActivator && pActivator->IsPlayer())
			pTemp->pev->owner = pActivator->edict();
		else
			pTemp->pev->owner = NULL;
	}
}
Exemplo n.º 3
0
/* <cd466> ../cstrike/dlls/h_cycler.cpp:96 */
void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
{
	if (!szModel || !szModel[0])
	{
		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);
	}

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

	PRECACHE_MODEL(szModel);
	SET_MODEL(ENT(pev), szModel);

	CCycler::Spawn();

	UTIL_SetSize(pev, vecMin, vecMax);
}