//--------------------------------------------------------- void charge_stick( gentity_t *self, gentity_t *other, trace_t *trace ) //--------------------------------------------------------- { self->s.eType = ET_GENERAL; // make us so we can take damage self->clipmask = MASK_SHOT; self->contents = CONTENTS_SHOTCLIP; self->takedamage = qtrue; self->health = 25; self->e_DieFunc = dieF_WP_ExplosiveDie; VectorSet( self->maxs, 10, 10, 10 ); VectorScale( self->maxs, -1, self->mins ); self->activator = self->owner; self->owner = NULL; self->e_TouchFunc = touchF_NULL; self->e_ThinkFunc = thinkF_NULL; self->nextthink = -1; WP_Stick( self, trace, 1.0f ); }
//--------------------------------------------------------- void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace ) //--------------------------------------------------------- { // turn us into a generic entity so we aren't running missile code self->s.eType = ET_GENERAL; self->s.modelindex = G_ModelIndex("models/weapons2/golan_arms/prox_mine.md3"); self->e_TouchFunc = touchF_NULL; self->contents = CONTENTS_SOLID; self->takedamage = qtrue; self->health = 5; self->e_DieFunc = dieF_WP_ExplosiveDie; VectorSet( self->maxs, 5, 5, 5 ); VectorScale( self->maxs, -1, self->mins ); self->activator = self->owner; self->owner = NULL; WP_Stick( self, trace ); self->e_ThinkFunc = thinkF_prox_mine_think; self->nextthink = level.time + 450; // sticks for twenty seconds, then auto blows. self->delay = level.time + 20000; gi.linkentity( self ); }
//--------------------------------------------------------- void touchLaserTrap( gentity_t *ent, gentity_t *other, trace_t *trace ) //--------------------------------------------------------- { ent->s.eType = ET_GENERAL; // a tripwire so add draw line flag VectorCopy( trace->plane.normal, ent->movedir ); // make it shootable VectorSet( ent->mins, -4, -4, -4 ); VectorSet( ent->maxs, 4, 4, 4 ); ent->clipmask = MASK_SHOT; ent->contents = CONTENTS_SHOTCLIP; ent->takedamage = qtrue; ent->health = 15; ent->e_DieFunc = dieF_WP_ExplosiveDie; ent->e_TouchFunc = touchF_NULL; // so we can trip it too ent->activator = ent->owner; ent->owner = NULL; WP_Stick( ent, trace ); if ( ent->count == TRIPWIRE_STYLE ) { vec3_t mins = {-4,-4,-4}, maxs = {4,4,4};//FIXME: global these trace_t tr; VectorMA( ent->currentOrigin, 32, ent->movedir, ent->s.origin2 ); gi.trace( &tr, ent->s.origin2, mins, maxs, ent->currentOrigin, ent->s.number, MASK_SHOT, G2_RETURNONHIT, 0 ); VectorCopy( tr.endpos, ent->s.origin2 ); ent->e_ThinkFunc = thinkF_laserTrapThink; } else { ent->e_ThinkFunc = thinkF_WP_prox_mine_think; } ent->nextthink = level.time + LT_ACTIVATION_DELAY; }