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

UT2k4Assault.ASTurret_Base


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
//=============================================================================
// ASTurret_Base
//=============================================================================

class ASTurret_Base extends Actor
    Abstract;

var float LastUpdateFreq;

simulated event PostBeginPlay()
{
    super.PostBeginPlay();

    if ( bMovable || (Level.NetMode != NM_DedicatedServer && DrawType == DT_Mesh) )
        SetTimer( 0.02 + FRand()*0.1, false);
}

simulated function UpdateSwivelRotation( Rotator TurretRotation );

function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) 
{
    // Defer damage to Turret...
    if ( Owner.Role == Role_Authority && InstigatedBy != Owner )
    {
        //log("ASTurret_Base::TakeDamage - Deferring damage to Pawn...");
        Owner.TakeDamage(Damage, instigatedBy, hitlocation, momentum, damageType) ;
    }
}

simulated event Timer()
{
    local float     UpdateFreq;

    UpdateFreq = 0.15;

    // hack to fix a hack :)
    if ( PlayerController(Vehicle(Owner).Controller) != None && PlayerController(Vehicle(Owner).Controller).ViewTarget != Owner )
        Vehicle(Owner).Controller = None;

    if ( Vehicle(Owner).Controller == None || PlayerController(Vehicle(Owner).Controller) == None 
        || !Vehicle(Owner).IsLocallyControlled() )
    {
        if ( Level.NetMode != NM_DedicatedServer && DrawType == DT_Mesh )
            UpdateOverlay();

        if ( bMovable )
            UpdateSwivelRotation( Owner.Rotation );

        if ( EffectIsRelevant(Location, true) )
            UpdateFreq = 0.02;
        else
            UpdateFreq = 0.1;

        if ( Level.bDropDetail || Level.DetailMode == DM_Low )
            UpdateFreq += 0.02;
    }
    // else Update is performed every frame from ASTurret.UpdateRocketAcceleration()
        
    LastUpdateFreq = UpdateFreq;
    SetTimer( UpdateFreq, false );
}

simulated function UpdateOverlay()
{
    if ( Owner.OverlayMaterial != OverlayMaterial || Owner.OverlayTimer != OverlayTimer )
        SetOverlayMaterial( Owner.OverlayMaterial, Owner.OverlayTimer, false );
}

//=============================================================================
// defaultproperties
//=============================================================================

defaultproperties
{
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'AS_Weapons_SM.Turret.ASTurret_Base'
     bIgnoreEncroachers=True
     RemoteRole=ROLE_None
     DrawScale=5.000000
     AmbientGlow=64
     bMovable=False
     bCollideActors=True
     bBlockActors=True
     bBlockKarma=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 17:00:14.000 - Creation time: Wed 7/2/2007 19:16:34.171 - Created with UnCodeX