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

XWeapons.LinkProjectile


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
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
//=============================================================================
// LinkProjectile.
//=============================================================================
class LinkProjectile extends Projectile;

#exec OBJ LOAD FILE=XEffectMat.utx

var NewLinkTrail Trail;
var int Links;

replication
{
    unreliable if (bNetInitial && Role == ROLE_Authority)
        Links;
}

simulated function Destroyed()
{
    if (Trail != None)
    {
        Trail.Destroy();
    }
    Super.Destroyed();
}

simulated function PostBeginPlay()
{
    local Rotator R;

    Super.PostBeginPlay();

    Velocity = Vector(Rotation);
    Velocity *= Speed;

    R = Rotation;
    R.Roll = Rand(65536);
    SetRotation(R);
}

simulated function LinkAdjust()
{
    if (Links > 0)
    {
        if ( Trail != None )
            Trail.MakeYellow();

        MaxSpeed = default.MaxSpeed + 350*Links;
        Skins[0] = FinalBlend'XEffectMat.LinkProjYellowFB';
        LightHue = 40;
    }
}

simulated function PostNetBeginPlay()
{
    local float dist;
    local PlayerController PC;

    Acceleration = Normal(Velocity) * 3000.0;

    if ( (Level.NetMode != NM_DedicatedServer) && (Level.DetailMode != DM_Low) )
        Trail = Spawn(class'newLinkTrail',self);
    if ( (Trail != None) && (Instigator != None) && Instigator.IsLocallyControlled() )
    {
        if ( Role == ROLE_Authority )
            Trail.Delay(0.1);
        else
        {
            dist = VSize(Location - Instigator.Location);
            if ( dist < 100 )
                Trail.Delay(0.1 - dist/1000);
        }
    }

    if (Role < ROLE_Authority)
        LinkAdjust();
    if ( Level.NetMode == NM_DedicatedServer )
        return;
    if ( Level.bDropDetail || (Level.DetailMode == DM_Low) )
    {
        bDynamicLight = false;
        LightType = LT_None;
    }
    else
    {
        PC = Level.GetLocalPlayerController();
        if ( (PC == None) || (Instigator == None) || (PC != Instigator.Controller) )
        {
            bDynamicLight = false;
            LightType = LT_None;
        }
    }
}

simulated function Explode(vector HitLocation, vector HitNormal)
{
    if ( EffectIsRelevant(Location,false) )
    {
        if (Links == 0)
            Spawn(class'LinkProjSparks',,, HitLocation, rotator(HitNormal));
        else
            Spawn(class'LinkProjSparksYellow',,, HitLocation, rotator(HitNormal));
    }
    PlaySound(Sound'WeaponSounds.BioRifle.BioRifleGoo2');
    Destroy();
}

simulated function ProcessTouch (Actor Other, vector HitLocation)
{
    local Vector X, RefNormal, RefDir;

    if (Other == Instigator) return;
    if (Other == Owner) return;

    if (Other.IsA('xPawn') && xPawn(Other).CheckReflect(HitLocation, RefNormal, Damage*0.25))
    {
        if (Role == ROLE_Authority)
        {
            X = Normal(Velocity);
            RefDir = X - 2.0*RefNormal*(X dot RefNormal);
            //Log("reflecting off"@Other@X@RefDir);
            Spawn(Class, Other,, HitLocation+RefDir*20, Rotator(RefDir));
        }
        Destroy();
    }
    else if ( !Other.IsA('Projectile') || Other.bProjTarget )
    {
        if ( Role == ROLE_Authority )
        {
            if ( Instigator == None || Instigator.Controller == None )
                Other.SetDelayedDamageInstigatorController( InstigatorController );
            Other.TakeDamage(Damage * (1.0 + float(Links)),Instigator,HitLocation,MomentumTransfer * Normal(Velocity),MyDamageType);
        }
        Explode(HitLocation, vect(0,0,1));
    }
}

simulated function HitWall(vector HitNormal, Actor Wall)
{
    Damage *= 1 + Links;

    Super.HitWall(HitNormal, Wall);
}

defaultproperties
{
     Speed=1000.000000
     MaxSpeed=4000.000000
     Damage=30.000000
     DamageRadius=0.000000
     MyDamageType=Class'XWeapons.DamTypeLinkPlasma'
     ExplosionDecal=Class'XEffects.LinkBoltScorch'
     MaxEffectDistance=7000.000000
     LightType=LT_Steady
     LightEffect=LE_QuadraticNonIncidence
     LightHue=100
     LightSaturation=100
     LightBrightness=255.000000
     LightRadius=3.000000
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'WeaponStaticMesh.LinkProjectile'
     CullDistance=3500.000000
     bDynamicLight=Wahr
     AmbientSound=Sound'WeaponSounds.LinkGun.LinkGunProjectile'
     LifeSpan=3.000000
     DrawScale3D=(X=2.295000,Y=1.530000,Z=1.530000)
     PrePivot=(X=10.000000)
     AmbientGlow=217
     Style=STY_Additive
     FluidSurfaceShootStrengthMod=6.000000
     SoundVolume=255
     SoundRadius=50.000000
     bFixedRotationDir=Wahr
     RotationRate=(Roll=80000)
     ForceType=FT_Constant
     ForceRadius=30.000000
     ForceScale=5.000000
}

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:49.453 - Created with UnCodeX