void script_mover_spawn(gentity_t *ent) { if (ent->spawnflags & 128) { if(!ent->tagBuffer) { ent->nextTrain = ent; } else { gentity_t* tent = G_FindByTargetname( NULL, ent->tagBuffer); if(!tent) { ent->nextTrain = ent; } else { ent->nextTrain = tent; } } ent->s.effect3Time = ent->nextTrain-g_entities; } if (ent->spawnflags & 2) { ent->clipmask = CONTENTS_SOLID; ent->r.contents = CONTENTS_SOLID; } else { ent->s.eFlags |= EF_NONSOLID_BMODEL; ent->clipmask = 0; ent->r.contents = 0; } script_linkentity(ent); // now start thinking process which controls AAS interaction script_mover_set_blocking( ent ); ent->think = script_mover_aas_blocking; ent->nextthink = level.time + 200; }
void script_mover_aas_blocking( gentity_t *ent ) { if( ent->timestamp <= level.time ) { // are we moving? if (ent->s.pos.trType != TR_STATIONARY /*VectorLengthSquared( ent->s.pos.trDelta )*/) { // never block while moving if (ent->AASblocking) { G_SetAASBlockingEntity( ent, AAS_AREA_ENABLED ); } } else if (!VectorCompare( ent->s.pos.trBase, ent->botAreaPos )) { script_mover_set_blocking( ent ); VectorCopy( ent->s.pos.trBase, ent->botAreaPos ); } ent->timestamp = level.time + 500; } if( ent->spawnflags & 128 ) { if( !ent->tankLink ) { if( ent->mg42weapHeat ) { ent->mg42weapHeat -= int(300.0f * FRAMETIME * 0.001f); if( ent->mg42weapHeat < 0 ) ent->mg42weapHeat = 0; } if( ent->backupWeaponTime ) { ent->backupWeaponTime -= FRAMETIME; if( ent->backupWeaponTime < 0 ) ent->backupWeaponTime = 0; } } } ent->nextthink = level.time + FRAMETIME; }