Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

XWeapons.AssaultAttachment


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
class AssaultAttachment extends xWeaponAttachment;

var byte OldSpawnHitCount;
var class<xEmitter>     mMuzFlashClass;
var xEmitter            mMuzFlash3rd;
var xEmitter            mMuzFlash3rdAlt;
var bool bDualGun;
var AssaultAttachment TwinGun;
var float AimAlpha;

replication
{
    reliable if ( Role == ROLE_Authority )
        bDualGun, TwinGun;
}

simulated function Hide(bool NewbHidden)
{
    bHidden = NewbHidden;
    if ( TwinGun != None )
        TwinGun.bHidden = bHidden;
}

simulated function Destroyed()
{
    if ( bDualGun )
    {
        if ( Instigator != None )
        {
            Instigator.SetBoneDirection(AttachmentBone, Rotation,, 0, 0);
            Instigator.SetBoneDirection('lfarm', Rotation,, 0, 0);
        }
    }
    if (mMuzFlash3rd != None)
        mMuzFlash3rd.Destroy();
    if (mMuzFlash3rdAlt != None)
        mMuzFlash3rdAlt.Destroy();
    Super.Destroyed();
}

simulated function SetOverlayMaterial( Material mat, float time, bool bOverride )
{
    Super.SetOverlayMaterial(mat, time, bOverride);
    if ( !bDualGun && (TwinGun != None) )
        TwinGun.SetOverlayMaterial(mat, time, bOverride);
}

simulated function Tick(float deltatime)
{
    local rotator newRot;

    if ( !bDualGun || (Level.NetMode == NM_DedicatedServer) )
    {
        Disable('Tick');
        return;
    }
    
    AimAlpha = AimAlpha * ( 1 - 2*DeltaTime);
        
    // point in firing direction
    if ( Instigator != None )
    {
        newRot = Instigator.Rotation;
        if ( AimAlpha < 0.5 )
            newRot.Yaw += 4500 * (1 - 2*AimAlpha);
        Instigator.SetBoneDirection('lfarm', newRot,, 1.0, 1);
        
        newRot.Roll += 32768;
        Instigator.SetBoneDirection(AttachmentBone, newRot,, 1.0, 1);
    }
}

/* UpdateHit
- used to update properties so hit effect can be spawn client side
*/
function UpdateHit(Actor HitActor, vector HitLocation, vector HitNormal)
{
    SpawnHitCount++;
    mHitLocation = HitLocation;
    mHitActor = HitActor;
    mHitNormal = HitNormal;
}

simulated function MakeMuzzleFlash()
{
    local rotator r;

    AimAlpha = 1;
    if ( TwinGun != None )
        TwinGun.AimAlpha = 1;
    if (mMuzFlash3rd == None)
    {
        mMuzFlash3rd = Spawn(mMuzFlashClass);
        AttachToBone(mMuzFlash3rd, 'tip');
    }
    mMuzFlash3rd.mStartParticles++;
    r.Roll = Rand(65536);
    SetBoneRotation('Bone_Flash', r, 0, 1.f);
}

simulated event ThirdPersonEffects()
{
    local rotator r;
    local PlayerController PC;
    
    if ( Level.NetMode != NM_DedicatedServer )
    {
        AimAlpha = 1;
        if ( TwinGun != None )
            TwinGun.AimAlpha = 1;
        if (FiringMode == 0)
        {
            WeaponLight();
            if ( OldSpawnHitCount != SpawnHitCount )
            {
                OldSpawnHitCount = SpawnHitCount;
                GetHitInfo();
                PC = Level.GetLocalPlayerController();
                if ( ((Instigator != None) && (Instigator.Controller == PC)) || (VSize(PC.ViewTarget.Location - mHitLocation) < 4000) )
                {
                    Spawn(class'HitEffect'.static.GetHitEffect(mHitActor, mHitLocation, mHitNormal),,, mHitLocation, Rotator(mHitNormal));
                    CheckForSplash();
                }
            }
            MakeMuzzleFlash();
            if ( !bDualGun && (TwinGun != None) )
                TwinGun.MakeMuzzleFlash();
        }
        else if (FiringMode == 1 && FlashCount > 0)
        {
            WeaponLight();
            if (mMuzFlash3rdAlt == None)
            {
                mMuzFlash3rdAlt = Spawn(mMuzFlashClass);
                AttachToBone(mMuzFlash3rdAlt, 'tip2');
            }
            mMuzFlash3rdAlt.mStartParticles++;
            r.Roll = Rand(65536);
            SetBoneRotation('Bone_Flash02', r, 0, 1.f);
        }
    }

    Super.ThirdPersonEffects();
}

defaultproperties
{
     mMuzFlashClass=Class'XEffects.AssaultMuzFlash3rd'
     bRapidFire=Wahr
     SplashEffect=Class'XGame.BulletSplash'
     LightType=LT_Pulse
     LightEffect=LE_NonIncidence
     LightHue=30
     LightSaturation=150
     LightBrightness=255.000000
     LightRadius=4.000000
     LightPeriod=3
     Mesh=SkeletalMesh'NewWeapons2004.NewAssaultRifle_3rd'
     RelativeLocation=(X=-20.000000,Y=-5.000000)
     RelativeRotation=(Pitch=32768)
     DrawScale=0.300000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:44.000 - Creation time: Mo 16.4.2007 11:20:44.453 - Created with UnCodeX