void script_mover_blocked(gentity_t *ent, gentity_t *other) { // remove it, we must not stop for anything or it will screw up script timing if (!other->client && other->s.eType != ET_CORPSE) { // /me slaps nerve // except CTF flags!!!! if (other->s.eType == ET_ITEM && other->item->giType == IT_TEAM) { Team_DroppedFlagThink(other); return; } G_TempEntity(other->s.origin, EV_ITEM_POP); G_FreeEntity(other); return; } // FIXME: we could have certain entities stop us, thereby "pausing" movement // until they move out the way. then we can just call the GotoMarker() again, // telling it that we are just now calling it for the first time, so it should // start us on our way again (theoretically speaking). // kill them G_Damage(other, ent, ent, NULL, NULL, 9999, 0, MOD_CRUSH); }
/* ================ Blocked_Door ================ */ void Blocked_Door( gentity_t *ent, gentity_t *other ) { // remove anything other than a client if ( !other->client ) { // except CTF flags!!!! if( other->s.eType == ET_ITEM && other->item->giType == IT_TEAM ) { Team_DroppedFlagThink( other ); return; } G_TempEntity( other->s.origin, EV_ITEM_POP ); G_FreeEntity( other ); return; } if ( ent->damage ) { if(g_awardpushing.integer) G_Damage( other, ent, ent->activator, NULL, NULL, ent->damage, 0, MOD_CRUSH ); else G_Damage( other, ent, ent, NULL, NULL, ent->damage, 0, MOD_CRUSH ); } if ( ent->spawnflags & 4 ) { return; // crushers don't reverse } // reverse direction Use_BinaryMover( ent, ent, other ); }
void Blocked_Tramcar( gentity_t *ent, gentity_t *other ) { // remove anything other than a client if ( !other->client ) { // except CTF flags!!!! if ( other->s.eType == ET_ITEM && other->item->giType == IT_TEAM ) { Team_DroppedFlagThink( other ); return; } G_TempEntity( other->s.origin, EV_ITEM_POP ); G_FreeEntity( other ); return; } if ( other->flags & FL_GODMODE ) { other->flags &= ~FL_GODMODE; other->client->ps.stats[STAT_HEALTH] = other->health = 0; } G_Damage( other, ent, ent, NULL, NULL, 99999, 0, MOD_CRUSH ); }
/* ================ G_SetEntState sets the entstate of an entity. ================ */ void G_SetEntState( gentity_t *ent, entState_t state ) { if ( ent->entstate == state ) { G_DPrintf( "entity %i already in desired state [%i]\n", ent->s.number, state ); return; } switch ( state ) { case STATE_DEFAULT: if ( ent->entstate == STATE_UNDERCONSTRUCTION ) { ent->clipmask = ent->realClipmask; ent->r.contents = ent->realContents; if ( !ent->realNonSolidBModel ) { ent->s.eFlags &= ~EF_NONSOLID_BMODEL; } } ent->entstate = STATE_DEFAULT; ent->s.powerups = STATE_DEFAULT; if ( ent->s.eType == ET_WOLF_OBJECTIVE ) { char cs[MAX_STRING_CHARS]; trap_GetConfigstring( ent->count, cs, sizeof( cs ) ); ent->count2 &= ~256; Info_SetValueForKey( cs, "t", va( "%i", ent->count2 ) ); trap_SetConfigstring( ent->count, cs ); } if ( ent->s.eType != ET_COMMANDMAP_MARKER ) { trap_LinkEntity( ent ); } // deal with any entities in the solid { int listedEntities, e; int entityList[MAX_GENTITIES]; gentity_t *check, *block; listedEntities = trap_EntitiesInBox( ent->r.absmin, ent->r.absmax, entityList, MAX_GENTITIES ); for ( e = 0; e < listedEntities; e++ ) { check = &g_entities[entityList[e]]; // ignore everything but items, players and missiles (grenades too) if ( check->s.eType != ET_MISSILE && check->s.eType != ET_ITEM && check->s.eType != ET_PLAYER && !check->physicsObject ) { continue; } if ( ( block = G_TestEntityPosition( check ) ) == NULL ) { continue; } if ( block != ent ) { // the entity is blocked by another entity - that block this should take care of this itself continue; } if ( check->client || check->s.eType == ET_CORPSE ) { // gibs anything player like G_Damage( check, ent, ent, NULL, NULL, 9999, DAMAGE_NO_PROTECTION, MOD_CRUSH_CONSTRUCTIONDEATH_NOATTACKER ); } else if ( check->s.eType == ET_ITEM && check->item->giType == IT_TEAM ) { // see if it's a critical entity, one that we can't just simply kill (basically flags) Team_DroppedFlagThink( check ); } else { // remove the landmine from both teamlists if ( check->s.eType == ET_MISSILE && check->methodOfDeath == MOD_LANDMINE ) { mapEntityData_t *mEnt; if ( ( mEnt = G_FindMapEntityData( &mapEntityData[0], check - g_entities ) ) != NULL ) { G_FreeMapEntityData( &mapEntityData[0], mEnt ); } if ( ( mEnt = G_FindMapEntityData( &mapEntityData[1], check - g_entities ) ) != NULL ) { G_FreeMapEntityData( &mapEntityData[1], mEnt ); } } // just get rid of it G_TempEntity( check->s.origin, EV_ITEM_POP ); G_FreeEntity( check ); } } } // if this is an mg42, then we should try and calculate mg42 spots again BotCalculateMg42Spots(); break; case STATE_UNDERCONSTRUCTION: ent->entstate = STATE_UNDERCONSTRUCTION; ent->s.powerups = STATE_UNDERCONSTRUCTION; ent->realClipmask = ent->clipmask; if ( ent->s.eType != ET_CONSTRUCTIBLE ) { // don't make nonsolid as we want to make them partially solid for staged construction ent->clipmask = 0; } ent->realContents = ent->r.contents; if ( ent->s.eType != ET_CONSTRUCTIBLE ) { ent->r.contents = 0; } if ( ent->s.eFlags & EF_NONSOLID_BMODEL ) { ent->realNonSolidBModel = qtrue; } else if ( ent->s.eType != ET_CONSTRUCTIBLE ) { ent->s.eFlags |= EF_NONSOLID_BMODEL; } if ( !Q_stricmp( ent->classname, "misc_mg42" ) ) { // stop using the mg42 mg42_stopusing( ent ); } if ( ent->s.eType == ET_COMMANDMAP_MARKER ) { mapEntityData_t *mEnt; if ( ( mEnt = G_FindMapEntityData( &mapEntityData[0], ent - g_entities ) ) != NULL ) { G_FreeMapEntityData( &mapEntityData[0], mEnt ); } if ( ( mEnt = G_FindMapEntityData( &mapEntityData[1], ent - g_entities ) ) != NULL ) { G_FreeMapEntityData( &mapEntityData[1], mEnt ); } } trap_LinkEntity( ent ); break; case STATE_INVISIBLE: if ( ent->entstate == STATE_UNDERCONSTRUCTION ) { ent->clipmask = ent->realClipmask; ent->r.contents = ent->realContents; if ( !ent->realNonSolidBModel ) { ent->s.eFlags &= ~EF_NONSOLID_BMODEL; } } ent->entstate = STATE_INVISIBLE; ent->s.powerups = STATE_INVISIBLE; if ( !Q_stricmp( ent->classname, "misc_mg42" ) ) { mg42_stopusing( ent ); } else if ( ent->s.eType == ET_WOLF_OBJECTIVE ) { char cs[MAX_STRING_CHARS]; trap_GetConfigstring( ent->count, cs, sizeof( cs ) ); ent->count2 |= 256; Info_SetValueForKey( cs, "t", va( "%i", ent->count2 ) ); trap_SetConfigstring( ent->count, cs ); } if ( ent->s.eType == ET_COMMANDMAP_MARKER ) { mapEntityData_t *mEnt; if ( ( mEnt = G_FindMapEntityData( &mapEntityData[0], ent - g_entities ) ) != NULL ) { G_FreeMapEntityData( &mapEntityData[0], mEnt ); } if ( ( mEnt = G_FindMapEntityData( &mapEntityData[1], ent - g_entities ) ) != NULL ) { G_FreeMapEntityData( &mapEntityData[1], mEnt ); } } trap_UnlinkEntity( ent ); break; } }
virtual void execute() { Team_DroppedFlagThink(self_); }