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

UnrealShare.Grenade


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
//=============================================================================
// Grenade.
//=============================================================================
class Grenade expands Projectile;

#exec MESH IMPORT MESH=GrenadeM ANIVFILE=MODELS\rocket_a.3D DATAFILE=MODELS\rocket_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=GrenadeM X=0 Y=0 Z=0 YAW=-64

#exec MESH SEQUENCE MESH=GrenadeM SEQ=All       STARTFRAME=0   NUMFRAMES=6
#exec MESH SEQUENCE MESH=GrenadeM SEQ=Still     STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=GrenadeM SEQ=WingIn    STARTFRAME=1   NUMFRAMES=1
#exec MESH SEQUENCE MESH=GrenadeM SEQ=Armed     STARTFRAME=1   NUMFRAMES=3
#exec MESH SEQUENCE MESH=GrenadeM SEQ=SpinCCW   STARTFRAME=4   NUMFRAMES=1
#exec MESH SEQUENCE MESH=GrenadeM SEQ=SpinCW    STARTFRAME=5   NUMFRAMES=1

#exec TEXTURE IMPORT NAME=JRocket1 FILE=MODELS\Rocket.PCX
#exec MESHMAP SCALE MESHMAP=GrenadeM X=0.025 Y=0.025 Z=0.05 YAW=128
#exec MESHMAP SETTEXTURE MESHMAP=GrenadeM NUM=1 TEXTURE=JRocket1

#exec AUDIO IMPORT FILE="Sounds\EightBal\grenflor.wav" NAME="GrenadeFloor" GROUP="Eightball"

var bool bCanHitOwner, bHitWater;
var float Count, SmokeRate;
var ScriptedPawn WarnTarget;    // warn this pawn away
var int NumExtraGrenades;

simulated function PostBeginPlay()
{
    local vector X,Y,Z;
    local rotator RandRot;

    Super.PostBeginPlay();
    if ( Level.NetMode != NM_DedicatedServer )
        PlayAnim('WingIn');
    SetTimer(2.5+FRand()*0.5,false);                  //Grenade begins unarmed

    if ( Role == ROLE_Authority )
    {
        GetAxes(Instigator.ViewRotation,X,Y,Z); 
        Velocity = X * (Instigator.Velocity Dot X)*0.4 + Vector(Rotation) * (Speed +
            FRand() * 100);
        Velocity.z += 210;
        RandRot.Pitch = FRand() * 1400 - 700;
        RandRot.Yaw = FRand() * 1400 - 700;
        RandRot.Roll = FRand() * 1400 - 700;
        MaxSpeed = 1000;
        Velocity = Velocity >> RandRot;
        RandSpin(50000);    
        bCanHitOwner = False;
        if (Instigator.HeadRegion.Zone.bWaterZone)
        {
            bHitWater = True;
            Disable('Tick');
            Velocity=0.6*Velocity;          
        }
    }   
}

simulated function BeginPlay()
{
    if (Level.bHighDetailMode) SmokeRate = 0.03;
    else SmokeRate = 0.15;
}

simulated function ZoneChange( Zoneinfo NewZone )
{
    local waterring w;
    
    if (!NewZone.bWaterZone || bHitWater) Return;

    bHitWater = True;
    w = Spawn(class'WaterRing',,,,rot(16384,0,0));
    w.DrawScale = 0.2;
    w.RemoteRole = ROLE_None;
    Velocity=0.6*Velocity;
}

simulated function Timer()
{
    Explosion(Location+Vect(0,0,1)*16);
}

simulated function Tick(float DeltaTime)
{
    local BlackSmoke b;

    if (bHitWater) 
    {
        Disable('Tick');
        Return;
    }
    Count += DeltaTime;
    if ( (Count>Frand()*SmokeRate+SmokeRate+NumExtraGrenades*0.03) && (Level.NetMode!=NM_DedicatedServer) ) 
    {
        b = Spawn(class'BlackSmoke');
        b.RemoteRole = ROLE_None;       
        Count=0;
    }
}

simulated function Landed( vector HitNormal )
{
    HitWall( HitNormal, None );
}

simulated function ProcessTouch( actor Other, vector HitLocation )
{
    if ( (Other!=instigator) || bCanHitOwner )
        Explosion(HitLocation);
}

simulated function HitWall( vector HitNormal, actor Wall )
{
    bCanHitOwner = True;
    Velocity = 0.8*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);   // Reflect off Wall w/damping
    RandSpin(100000);
    speed = VSize(Velocity);
    if ( Level.NetMode != NM_DedicatedServer )
        PlaySound(ImpactSound, SLOT_Misc, FMax(0.5, speed/800) );
    if ( Velocity.Z > 400 )
        Velocity.Z = 0.5 * (400 + Velocity.Z);  
    else if ( speed < 20 ) 
    {
        bBounce = False;
        SetPhysics(PHYS_None);
    }
}

///////////////////////////////////////////////////////
function BlowUp(vector HitLocation)
{
    HurtRadius(damage, 200, 'exploded', MomentumTransfer, HitLocation);
    MakeNoise(1.0);
}

simulated function Explosion(vector HitLocation)
{
    local SpriteBallExplosion s;

    BlowUp(HitLocation);
    s = spawn(class'SpriteBallExplosion',,,HitLocation);
    s.RemoteRole = ROLE_None;
    Destroy();
}

defaultproperties
{
     speed=600.000000
     MaxSpeed=1000.000000
     Damage=100.000000
     MomentumTransfer=50000
     ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor'
     Physics=PHYS_Falling
     RemoteRole=ROLE_SimulatedProxy
     AnimSequence=WingIn
     Mesh=Mesh'UnrealShare.GrenadeM'
     AmbientGlow=64
     bUnlit=True
     bMeshCurvy=False
     bBounce=True
     bFixedRotationDir=True
     DesiredRotation=(Pitch=12000,Yaw=5666,Roll=2334)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sun 21/2/2010 23:48:40.000 - Creation time: Sun 21/2/2010 23:49:52.008 - Created with UnCodeX