コード例 #1
0
void TridentHit(ServerEntity_t *ent)
{
	vec3_t	forward,temp,sndvec,vel;
	trace_t	trace;

	Math_AngleVectors(ent->v.v_angle,forward,temp,temp);

	// [18/4/2012] A nice soft bounce ~hogsy
	vel[0] = vel[1] = 0;
	vel[2] = 0.5;

	sndvec[0] = ent->v.origin[0]+forward[0]*78;
	sndvec[1] = ent->v.origin[1]+forward[1]*78;
	sndvec[2] = ent->v.origin[2]+forward[2]*78;

	trace = Traceline(ent,ent->v.origin,sndvec,0);

	sndvec[0] = trace.endpos[0]-forward[0]*4;
	sndvec[1] = trace.endpos[1]-forward[1]*4;
	sndvec[2] = trace.endpos[2]-forward[2]*4;

	if(trace.fraction == 1.0f)
		return;
	if(trace.ent->v.bTakeDamage)
    {
		if(trace.ent->local.bBleed)
			Engine.Particle(sndvec,vel,10,"blood",30);

		Entity_Damage(trace.ent,ent,20,0);
	}
	else if(trace.ent)
		Engine.Particle(sndvec,vel,10,"smoke",30);
}
コード例 #2
0
void arrow_touch(ServerEntity_t *ent, ServerEntity_t *other)
{
	// [25/6/2012] Cleaned up ~hogsy
	// [7/4/2012] Cleaned up ~hogsy
	char	snd[64];

	if(other == ent->local.eOwner)
		return;

	// We hit an enemy! Stick with 'em
	if(other->v.bTakeDamage)
	{
		// Fleshy sound plz
		sprintf(snd,"weapons/crossbow/arrowwetimpact%i.wav",rand()%5+1);

		Entity_Damage(other, ent, 25, 0);

		ent->v.think		= WEAPON_StickThink;
		ent->v.dNextThink	= Server.dTime+0.1;
	}
	// [25/6/2012] Moved so we don't set this before checking what we're hitting ~hogsy
	else
		sprintf(snd,"weapons/crossbow/arrowimpact%i.wav",rand()%5+1);

	Sound(ent,CHAN_ITEM,snd,255,ATTN_NORM);

	ent->v.velocity[0] = ent->v.velocity[1] = ent->v.velocity[2] = 0;
	ent->v.avelocity[0] = ent->v.avelocity[1] = ent->v.avelocity[2] = 0;
	ent->v.enemy = other;
}
コード例 #3
0
void HermesCloudTouch(ServerEntity_t *ent, ServerEntity_t *other)
{
	if(other->Monster.type != MONSTER_PLAYER)
		return;

	if(other->v.health > 0 && other->v.movetype == MOVETYPE_STEP)
	{
		Entity_Damage(other, ent, 5, DAMAGE_TYPE_NORMAL);
		//other->local.poisoned = 1; TODO: MAKE IT WORK
	}
}
コード例 #4
0
// [4/7/2012] Renamed to Discus_ProjectileTouch ~hogsy
void Discus_ProjectileTouch(ServerEntity_t *ent,ServerEntity_t *other)
{
	char	snd[64];
	vec3_t	vel;

	// [4/8/2012] Updated to use owner ~hogsy
	if(other == ent->local.eOwner)
	{
		// Don't touch the owner while being thrown
		if(ent->local.hit == 0)
			return;

		Discus_Catch(other,ent);
		return;
	}

	if(ent->local.hit == 2)
		ent->local.hit = 1;
	else if(ent->local.hit == 1)
		ent->local.hit = 2;
	else
		ent->local.hit = 1;

	if(other->v.bTakeDamage)
	{
		Entity_Damage(other, ent, 35, 0);

		Sound(ent,CHAN_BODY,"weapons/discus/discushit.wav",255,ATTN_NORM);
		return;
	}

	// [23/5/2012] Cleaned up ~hogsy
	sprintf(snd,"weapons/discus/discusclang%i.wav",rand()%5+1);
	Sound(ent,CHAN_BODY,snd,255,ATTN_NORM);

	vel[0] = vel[1] = 0;
	vel[2] = 5.0f;
	Engine.Particle(ent->v.origin,vel,4.0f,"smoke",15);

	// [4/7/2012] Simplified ~hogsy
	ent->v.angles[2] -= 180.0f;

	if(ent->local.hit == 1)
	{
		ent->v.think		= Discus_Follow;
		ent->v.dNextThink	= Server.dTime+0.01;
	}
	else
		ent->v.think		= NULL;
}
コード例 #5
0
void GreekfireTouch(ServerEntity_t *ent, ServerEntity_t *other)
{
	vec3_t vel;

	if (other == ent->local.eOwner)
		return;

	if(other->v.bTakeDamage)
		Entity_Damage(other, ent, 50, 0);

	Math_VectorCopy(ent->v.velocity,vel);
	Math_VectorInverse(vel);

	Engine.Particle(ent->v.origin,vel,5,"spark",17);

	Math_VectorClear(ent->v.velocity);

	Entity_Remove(ent);
}
コード例 #6
0
void ShockLaser_Touch(ServerEntity_t *ent, ServerEntity_t *other)
{
	char	*cSound;

	if(!other || (other == ent->local.owner))
		return;

	if(other->v.takedamage)
	{
		// burning flesh sound
		cSound = "weapons/shockwave/burn.wav";

		Entity_Damage(other, ent, 100, 0);
	}
	else
		cSound = "weapons/shockwave/fade.wav";

	Sound(ent,CHAN_ITEM,cSound,255,ATTN_NORM);

	Entity_Remove(ent);
}
コード例 #7
0
/*	Damage entities within a specific radius.
*/
void Entity_RadiusDamage(ServerEntity_t *eInflictor, float fRadius, int iDamage, int iDamageType)
{
	int		i;
	float	fDistance;
	MathVector3f_t	vOrigin;
	ServerEntity_t *eTarget = Engine.Server_FindRadius(eInflictor->v.origin, fRadius);

	do
	{
		if(eTarget->v.bTakeDamage)
		{
			for(i = 0; i < 3; i++)
				vOrigin[i] = eTarget->v.origin[i]+(eTarget->v.mins[i]+eTarget->v.maxs[i])*0.5f;

			Math_VectorSubtract(eInflictor->v.origin,vOrigin,vOrigin);

			fDistance = 0.5f*(float)Math_VectorLength(vOrigin);
			if(fDistance > 0)
			{
				Math_VectorInverse(vOrigin);
				Math_VectorAdd(eTarget->v.velocity,vOrigin,eTarget->v.velocity);

				// Reduce the damage by distance.
				fDistance = (float)iDamage-(100.0f/fDistance);

				// Less damage for the inflictor.
				if(eTarget == eInflictor)
					fDistance = fDistance/2.0f;

				if(fDistance > 0)
					Entity_Damage(eTarget,eInflictor,(int)fDistance,iDamageType);
			}
		}

		eTarget = eTarget->v.chain;
	}
	while(eTarget);
}
コード例 #8
0
ファイル: server.c プロジェクト: ExperimentationBox/Edenite
/*	Called by the engine.
	Called for the "kill" command.
*/
void Server_KillClient(ServerEntity_t *eClient)
{
	if (eClient->Monster.state != MONSTER_STATE_DEAD)
		Entity_Damage(eClient, eClient, eClient->v.iHealth, DAMAGE_TYPE_NORMAL);
}
コード例 #9
0
void Area_ButtonBlocked(ServerEntity_t *eArea, ServerEntity_t *eOther)
{
	Entity_Damage(eOther, eArea, eArea->local.damage, DAMAGE_TYPE_CRUSH);
}
コード例 #10
0
void Area_DoorBlocked(ServerEntity_t *door, ServerEntity_t *other) {
	Entity_Damage(other, door, door->local.damage, DAMAGE_TYPE_CRUSH);
}
コード例 #11
0
void Area_RotateBlocked(ServerEntity_t *area, ServerEntity_t *other) {
	Entity_Damage(other, area, area->local.damage, DAMAGE_TYPE_CRUSH);
}
コード例 #12
0
void Area_KillTouch(ServerEntity_t *area, ServerEntity_t *other) {
	// Damage it, until it gibs and gets removed.
	Entity_Damage(other, area, other->v.health, DAMAGE_TYPE_NORMAL);
}
コード例 #13
0
void Point_DamageUse(ServerEntity_t *eEntity)
{
	Entity_Damage(eEntity->local.activator, eEntity, eEntity->local.iDamage, eEntity->local.style);
}