Exemplo n.º 1
0
void trigger_onlyregistered_touch(  )
{
	gedict_t *te;

	if ( strneq( other->s.v.classname, "player" ) )
		return;
	if ( !Activated( self, other ) )
	{
		if ( self->else_goal )
		{
			te = Findgoal( self->else_goal );
			if ( te )
				AttemptToActivate( te, other, self );
		}
		return;
	}
	if ( self->attack_finished > g_globalvars.time )
		return;

	self->attack_finished = g_globalvars.time + 2;
	if ( trap_cvar( "registered" ) )
	{
		self->s.v.message = "";
		activator = other;
		SUB_UseTargets(  );
		ent_remove( self );
	} else
	{
		if ( self->s.v.message && strneq( self->s.v.message, "" ) )
		{
			G_centerprint( other, "%s", self->s.v.message );
			sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM );
		}
	}
}
Exemplo n.º 2
0
void multi_touch(  )
{
	gedict_t *te;

	if ( !other->s.v.classname )
		return;
	if ( strneq( other->s.v.classname, "player" ) )
		return;

	if ( !Activated( self, other ) )
	{
		if ( self->else_goal )
		{
			te = Findgoal( self->else_goal );
			if ( te )
				AttemptToActivate( te, other, self );
		}
		return;
	}

	if ( !VectorCompareF( self->s.v.movedir, 0, 0, 0 ) )
	{
		trap_makevectors( other->s.v.angles );
		if ( DotProduct( g_globalvars.v_forward, self->s.v.movedir ) < 0 )
			return;	// not facing the right way
	}

	self->s.v.enemy = EDICT_TO_PROG( other );
	multi_trigger(  );
}
Exemplo n.º 3
0
void trigger_push_touch(  )
{
	gedict_t *te;

	if ( !Activated( self, other ) )
	{
		if ( self->else_goal )
		{
			te = Findgoal( self->else_goal );
			if ( te )
				AttemptToActivate( te, other, self );
		}
		return;
	}
	if ( streq( other->s.v.classname, "grenade" ) )
	{
		other->s.v.velocity[0] = self->speed * self->s.v.movedir[0] * 10;
		other->s.v.velocity[1] = self->speed * self->s.v.movedir[1] * 10;
		other->s.v.velocity[2] = self->speed * self->s.v.movedir[2] * 10;
	} else if ( other->s.v.health > 0 )
	{
//  other->s.v.velocity = self->speed  * self->s.v.movedir * 10;
		other->s.v.velocity[0] = self->speed * self->s.v.movedir[0] * 10;
		other->s.v.velocity[1] = self->speed * self->s.v.movedir[1] * 10;
		other->s.v.velocity[2] = self->speed * self->s.v.movedir[2] * 10;

		if ( streq( other->s.v.classname, "player" ) )
		{
			if ( other->fly_sound < g_globalvars.time )
			{
				other->fly_sound = g_globalvars.time + 1.5;
				sound( other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM );
			}
		}
	}
	if ( ( int ) ( self->s.v.spawnflags ) & PUSH_ONCE )
		ent_remove( self );
}
Exemplo n.º 4
0
void hurt_touch(  )
{
	gedict_t *te;

	if ( other->s.v.takedamage )
	{
		if ( !Activated( self, other ) )
		{
			if ( self->else_goal )
			{
				te = Findgoal( self->else_goal );
				if ( te )
					AttemptToActivate( te, other, self );
			}
			return;
		}
		self->s.v.solid = SOLID_NOT;
		tf_data.deathmsg = DMSG_TRIGGER;
		TF_T_Damage( other, self, self, self->dmg, 1, 0 );
		self->s.v.think = ( func_t ) hurt_on;
		self->s.v.nextthink = g_globalvars.time + 1;
	}
}
Exemplo n.º 5
0
// jumppad (engbatxr, etc)
void trigger_jumper_touch ( )
{
    gedict_t *finder;

    if ( !Activated( self, other ) )
    {
        if ( self->else_goal )
        {
            finder = Findgoal( self->else_goal );
            if ( finder)
                DoResults ( finder, other, ( self->goal_result & 2));
        }
        return;
    }

    if ( other->s.v.classname == "grenade" || !streq( other->s.v.classname, "player" ) )
        return;
    else
    {
        if ( other->s.v.health > 0 && !self->armorclass )
        {
            other->s.v.velocity[2] = self->speed * 7;
            if ( streq( other->s.v.classname, "player" ) )
            {
                if ( other->fly_sound < g_globalvars.time )
                {
                    other->fly_sound = g_globalvars.time + 1.5;
                    if ( !( ( int ) self->s.v.spawnflags & 2 ) )
                        sound ( other, 0, "misc/boing.wav", 1, 1);
                }
            }
        }
    }
    if ( (int) self->s.v.spawnflags & 1 )
        dremove ( self );
}
Exemplo n.º 6
0
void teleport_touch(  )
{
	gedict_t *t, *te;
	vec3_t  org;

	if ( self->s.v.targetname )
	{
		if ( self->s.v.nextthink < g_globalvars.time )
		{
			return;	// not fired yet
		}
	}
	if ( ( int ) ( self->s.v.spawnflags ) & PLAYER_ONLY )
	{
		if ( strneq( other->s.v.classname, "player" ) )
			return;
	}
	if ( !Activated( self, other ) )
	{
		if ( self->else_goal )
		{
			te = Findgoal( self->else_goal );
			if ( te )
				AttemptToActivate( te, other, self );
		}
		return;
	}
// only teleport living creatures
	if ( other->s.v.health <= 0 || other->s.v.solid != SOLID_SLIDEBOX )
		return;

//        activator = other;
	SUB_UseTargets(  );

	//put a tfog where the player was
	spawn_tfog( other->s.v.origin );

	t = trap_find( world, FOFS( s.v.targetname ), self->s.v.target );
	if ( !t )
		G_Error( "couldn't find target" );

// spawn a tfog flash in front of the destination
	trap_makevectors( t->mangle );
	org[0] = t->s.v.origin[0] + 32 * g_globalvars.v_forward[0];
	org[1] = t->s.v.origin[1] + 32 * g_globalvars.v_forward[1];
	org[2] = t->s.v.origin[2] + 32 * g_globalvars.v_forward[2];

	spawn_tfog( org );
	spawn_tdeath( t->s.v.origin, other );

// move the player and lock him down for a little while
	if ( !other->s.v.health )
	{
		VectorCopy( t->s.v.origin, other->s.v.origin );
		other->s.v.velocity[0] =
		    ( g_globalvars.v_forward[0] * other->s.v.velocity[0] ) +
		    ( g_globalvars.v_forward[0] * other->s.v.velocity[1] );
		other->s.v.velocity[1] =
		    ( g_globalvars.v_forward[1] * other->s.v.velocity[0] ) +
		    ( g_globalvars.v_forward[1] * other->s.v.velocity[1] );
		other->s.v.velocity[2] =
		    ( g_globalvars.v_forward[2] * other->s.v.velocity[0] ) +
		    ( g_globalvars.v_forward[2] * other->s.v.velocity[1] );

		//other->s.v.velocity = (v_forward * other->s.v.velocity[0]) + (v_forward * other->s.v.velocity[1]);
		return;
	}
	setorigin( other, PASSVEC3( t->s.v.origin ) );
	VectorCopy( t->mangle, other->s.v.angles );
// other.angles = t.mangle;
	if ( streq( other->s.v.classname, "player" ) )
	{
		if ( other->s.v.weapon == 1 && other->hook_out )
		{
			sound( other, 1, "weapons/bounce2.wav", 1, 1 );
			other->on_hook = 0;
			other->hook_out = 0;
			other->fire_held_down = 0;
			other->s.v.weaponframe = 0;
			other->attack_finished = g_globalvars.time + 0.75;
		}
		other->s.v.fixangle = 1;	// turn this way immediately
		other->s.v.teleport_time = g_globalvars.time + 0.7;
		if ( ( int ) other->s.v.flags & FL_ONGROUND )
			other->s.v.flags = other->s.v.flags - FL_ONGROUND;
		VectorScale( g_globalvars.v_forward, 300, other->s.v.velocity );
//  other->s.v.velocity = v_forward * 300;
	}
	other->s.v.flags -= ( int ) other->s.v.flags & FL_ONGROUND;
}