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

Engine.Projectile


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
//=============================================================================
// Projectile.
//
// A delayed-hit projectile moves around for some time after it is created.
// An instant-hit projectile acts immediately. 
//=============================================================================
class Projectile expands Actor
    abstract
    intrinsic;

#exec Texture Import File=Textures\S_Camera.pcx Name=S_Camera Mips=Off Flags=2

//-----------------------------------------------------------------------------
// Projectile variables.

// Motion information.
var() float    Speed;               // Initial speed of projectile.
var() float    MaxSpeed;            // Limit on speed of projectile (0 means no limit)

// Damage attributes.
var() float    Damage;         
var() int      MomentumTransfer; // Momentum imparted by impacting projectile.

// Projectile sound effects
var() sound    SpawnSound;      // Sound made when projectile is spawned.
var() sound    ImpactSound;     // Sound made when projectile hits something.
var() sound    MiscSound;       // Miscellaneous Sound.

var() float     ExploWallOut;   // distance to move explosions out from wall

//==============
// Encroachment
function bool EncroachingOn( actor Other )
{
    if ( (Other.Brush != None) || (Brush(Other) != None) )
        return true;
        
    return false;
}

//==============
// Touching
simulated singular function Touch(Actor Other)
{
    local actor HitActor;
    local vector HitLocation, HitNormal, TestLocation;
    
    if ( Other.IsA('BlockAll') )
    {
        HitWall( Normal(Location - Other.Location), Other);
        return;
    }
    if ( Other.bProjTarget || (Other.bBlockActors && Other.bBlockPlayers) )
    {
        //get exact hitlocation
        HitActor = Trace(HitLocation, HitNormal, Location, OldLocation, true);
        if (HitActor == Other)
        {
            if ( (Pawn(Other) != None) 
                && !Pawn(Other).AdjustHitLocation(HitLocation, Velocity) )
                    return;
            ProcessTouch(Other, HitLocation); 
        }
        else 
            ProcessTouch(Other, Other.Location + Other.CollisionRadius * Normal(Location - Other.Location));
    }
}

simulated function ProcessTouch(Actor Other, Vector HitLocation)
{
    //should be implemented in subclass
}

simulated function HitWall (vector HitNormal, actor Wall)
{
    if ( Role == ROLE_Authority )
    {
        if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
            Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), '');

        MakeNoise(1.0);
    }
    Explode(Location + ExploWallOut * HitNormal, HitNormal);
}

simulated function Explode(vector HitLocation, vector HitNormal)
{
    Destroy();
}

simulated final function RandSpin(float spinRate)
{
    DesiredRotation = RotRand();
    RotationRate.Yaw = spinRate * 2 *FRand() - spinRate;
    RotationRate.Pitch = spinRate * 2 *FRand() - spinRate;
    RotationRate.Roll = spinRate * 2 *FRand() - spinRate;   
}

defaultproperties
{
     MaxSpeed=2000.000000
     bDirectional=True
     bNetTemporary=True
     Physics=PHYS_Projectile
     LifeSpan=140.000000
     DrawType=DT_Mesh
     Texture=Texture'Engine.S_Camera'
     bGameRelevant=True
     SoundVolume=0
     CollisionRadius=0.000000
     CollisionHeight=0.000000
     bCollideActors=True
     bCollideWorld=True
     NetPriority=6.000000
}

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