Script:Files:script/vehicles/husky.script

From Mod Wiki
Revision as of 10:00, 5 November 2007 by Wizz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
object vehicle_husky : vehicle_base {
    void            preinit();
    void            init();

    void            OnCollision( object traceObject, float velocity, vector mins, vector maxs );

    float            vGetSteerScale();

    void            OnWeaponSelected( entity p, float index );

    void            vSetDeployableOwner( entity p );
    void            vRemoveObject();

    float            steeringAngle;
}

void vehicle_husky::preinit() {
    steeringAngle            = getFloatKey( "steering_angle" );
}

void vehicle_husky::init() {
    setLightsEnabled( 0, false );
}

void vehicle_husky::OnCollision( object traceObject, float velocity, vector mins, vector maxs ) {
    OnCollision_Base( traceObject, velocity, mins, maxs );
}

void vehicle_husky::OnWeaponSelected( entity p, float index ) {
    if ( index == 0 ) {
        FireDecoy( p );
    }
}

float vehicle_husky::vGetSteerScale() {
    return getSteerAngle() / steeringAngle;
}

void vehicle_husky::vSetDeployableOwner( entity p ) {
    if ( !sys.isClient() ) {
        if ( p != $null_entity ) {
            p.binAdd( self );
        }
    }
}

void vehicle_husky::vRemoveObject() {
    if ( isEmpty() ) {
        thread DecayThread();
    }
}