示例#1
0
文件: engineer.c 项目: MrPnut/QHome
void DispenserThink(  )
{
    CheckBelowBuilding( self );
    if ( self->hook_out > 3 ) 
    {
        // dispenser refilling itself 5%
	self->s.v.ammo_shells = self->s.v.ammo_shells + ( int ) ( BUILD_DISPENSER_MAX_SHELLS / 20 );
	self->s.v.ammo_cells = self->s.v.ammo_cells + ( int ) ( BUILD_DISPENSER_MAX_CELLS / 20 );
	self->s.v.ammo_nails = self->s.v.ammo_nails + ( int ) ( BUILD_DISPENSER_MAX_NAILS / 20 );
	self->s.v.ammo_rockets = self->s.v.ammo_rockets + ( int ) ( BUILD_DISPENSER_MAX_ROCKETS / 20 );
	self->s.v.armorvalue = self->s.v.armorvalue + ( int ) ( BUILD_DISPENSER_MAX_ARMOR / 20 );
	if ( self->s.v.ammo_shells > BUILD_DISPENSER_MAX_SHELLS )
	    self->s.v.ammo_shells = BUILD_DISPENSER_MAX_SHELLS;
	if ( self->s.v.ammo_nails > BUILD_DISPENSER_MAX_NAILS )
	    self->s.v.ammo_nails = BUILD_DISPENSER_MAX_NAILS;
	if ( self->s.v.ammo_rockets > BUILD_DISPENSER_MAX_ROCKETS )
	    self->s.v.ammo_rockets = BUILD_DISPENSER_MAX_ROCKETS;
	if ( self->s.v.ammo_cells > BUILD_DISPENSER_MAX_CELLS )
	    self->s.v.ammo_cells = BUILD_DISPENSER_MAX_CELLS;
	if ( self->s.v.armorvalue > BUILD_DISPENSER_MAX_ARMOR )
	    self->s.v.armorvalue = BUILD_DISPENSER_MAX_ARMOR;
	self->hook_out = 0;
    }
    self->hook_out = self->hook_out + 1;
    self->s.v.nextthink = g_globalvars.time + 3;
}
示例#2
0
//=============
void Sentry_Rotate(  )
{
    float   ay;

    self->s.v.effects = ( int ) self->s.v.effects - ( ( int ) self->s.v.effects & EF_DIMLIGHT );
    CheckSentry( self );
    if ( tfset(sg_newfind))
    {
        if ( Sentry_FindTarget_Angel(  ) )
            return;
    } else
    {
        if ( Sentry_FindTarget(  ) )
            return;
    }
    if ( !self->heat )
    {
        self->s.v.ideal_yaw = self->waitmin;
        changeyaw( self );
        ay = ( int ) anglemod( self->s.v.angles[1] );
        if ( ay == ( int ) self->waitmin )
        {
            CheckBelowBuilding( self->trigger_field );
            self->heat = 1;
            if ( g_random(  ) < 0.1 )
                sound( self, 3, "weapons/turridle.wav", 1, 1 );
        }
    } else
    {
        self->s.v.ideal_yaw = self->waitmax;
        changeyaw( self );
        ay = ( int ) anglemod( self->s.v.angles[1] );
        if ( ay == ( int ) self->waitmax )
        {
            CheckBelowBuilding( self->trigger_field );
            self->heat = 0;
        }
    }
}