void misc_model_use (gentity_t *self, gentity_t *other, gentity_t *activator) { if ( self->health <= 0 && self->max_health > 0) {//used while broken fired target3 G_UseTargets2( self, activator, self->target3 ); return; } G_ActivateBehavior( self, BSET_USE ); //Don't explode if they've requested it to not if ( self->spawnflags & 64 ) {//Usemodels toggling if ( self->spawnflags & 32 ) { if( self->s.modelindex == self->sound1to2 ) { self->s.modelindex = self->sound2to1; } else { self->s.modelindex = self->sound1to2; } } return; } misc_model_breakable_die( self, other, activator, self->health, MOD_UNKNOWN ); }
void misc_model_use (gentity_t *self, gentity_t *other, gentity_t *activator) { if ( self->target4 ) {//throw me at my target! misc_model_throw_at_target4( self, activator ); return; } if ( self->health <= 0 && self->max_health > 0) {//used while broken fired target3 G_UseTargets2( self, activator, self->target3 ); return; } // Become solid again. if ( !self->count ) { self->count = 1; self->activator = activator; self->svFlags &= ~SVF_NOCLIENT; self->s.eFlags &= ~EF_NODRAW; } G_ActivateBehavior( self, BSET_USE ); //Don't explode if they've requested it to not if ( self->spawnflags & 64 ) {//Usemodels toggling if ( self->spawnflags & 32 ) { if( self->s.modelindex == self->sound1to2 ) { self->s.modelindex = self->sound2to1; } else { self->s.modelindex = self->sound1to2; } } return; } self->e_DieFunc = dieF_misc_model_breakable_die; misc_model_breakable_die( self, other, activator, self->health, MOD_UNKNOWN ); }
void misc_model_cargo_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod, int dFlags, int hitLoc ) { int flags; vec3_t org, temp; gitem_t *health = NULL, *shields = NULL, *bacta = NULL, *batteries = NULL; // copy these for later flags = self->spawnflags; VectorCopy( self->currentOrigin, org ); // we already had spawn flags, but we don't care what they were...we just need to set up the flags we want for misc_model_breakable_die self->spawnflags = 8; // NO_DMODEL // pass through to get the effects and such misc_model_breakable_die( self, inflictor, attacker, damage, mod ); // now that the model is broken, we can safely spawn these in it's place without them being in solid temp[2] = org[2] + 16; // annoying, but spawn each thing in its own little quadrant so that they don't end up on top of each other if (( flags & DROP_MEDPACK )) { health = FindItem( "item_medpak_instant" ); if ( health ) { temp[0] = org[0] + crandom() * 8 + 16; temp[1] = org[1] + crandom() * 8 + 16; LaunchItem( health, temp, vec3_origin, NULL ); } } if (( flags & DROP_SHIELDS )) { shields = FindItem( "item_shield_sm_instant" ); if ( shields ) { temp[0] = org[0] + crandom() * 8 - 16; temp[1] = org[1] + crandom() * 8 + 16; LaunchItem( shields, temp, vec3_origin, NULL ); } } if (( flags & DROP_BACTA )) { bacta = FindItem( "item_bacta" ); if ( bacta ) { temp[0] = org[0] + crandom() * 8 - 16; temp[1] = org[1] + crandom() * 8 - 16; LaunchItem( bacta, temp, vec3_origin, NULL ); } } if (( flags & DROP_BATTERIES )) { batteries = FindItem( "item_battery" ); if ( batteries ) { temp[0] = org[0] + crandom() * 8 + 16; temp[1] = org[1] + crandom() * 8 - 16; LaunchItem( batteries, temp, vec3_origin, NULL ); } } }