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

UT2k4AssaultFull.Weapon_Turret


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

class Weapon_Turret extends Weapon
    config(user)
    HideDropDown
	CacheExempt;

#exec OBJ LOAD FILE=..\Animations\AS_VehiclesFull_M.ukx

replication
{
	reliable if ( Role == ROLE_Authority )
        ClientTakeHit;
}

function AdjustPlayerDamage( out int Damage, Pawn InstigatedBy, Vector HitLocation,
						         out Vector Momentum, class<DamageType> DamageType)
{
    local int		Drain;
	local vector	Reflect;
    local vector	HitNormal;
    local float		DamageMax;

	DamageMax = Instigator.HealthMax;

	if ( DamageType != None && !DamageType.default.bArmorStops )
        return;

    if ( CheckReflect(HitLocation, HitNormal, 0) )
    {
        Drain = Min( AmmoAmount(1)*2, Damage );
		Drain = Min(Drain,DamageMax);
	    Reflect = MirrorVectorByNormal( Normal(Location - HitLocation), Vector(Instigator.Rotation) );
        Damage -= Drain;
        Momentum *= 1.25;
        ConsumeAmmo( 1, Drain/2 );
        DoReflectEffect( Drain/2 );
    }
}

function DoReflectEffect(int Drain)
{
    //PlaySound(ShieldHitSound, SLOT_None);
    FM_Turret_AltFire_Shield(FireMode[1]).TakeHit( Drain );
    ClientTakeHit( Drain );
}

simulated function ClientTakeHit(int Drain)
{
	//ClientPlayForceFeedback( ShieldHitForce );
    FM_Turret_AltFire_Shield(FireMode[1]).TakeHit( Drain );
}

function bool CheckReflect( Vector HitLocation, out Vector RefNormal, int AmmoDrain )
{
    local Vector HitDir;
    local Vector FaceDir;

    if ( !FireMode[1].bIsFiring || AmmoAmount(0) == 0 )
		return false;

    FaceDir = Vector(Instigator.Controller.Rotation);
    HitDir = Normal(Instigator.Location - HitLocation + Vect(0,0,8));

    RefNormal = FaceDir;

    if ( FaceDir dot HitDir < -0.37 ) // 68 degree protection arc
    {
        if ( AmmoDrain > 0 )
            ConsumeAmmo( 0, AmmoDrain );
        return true;
    }
    return false;
}

simulated function bool HasAmmo()
{
    return true;
}

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

defaultproperties
{
     FireModeClass(0)=Class'UT2k4AssaultFull.FM_BallTurret_Fire'
     FireModeClass(1)=Class'UT2k4AssaultFull.FM_Turret_AltFire_Shield'
     AIRating=0.680000
     CurrentRating=0.680000
     bCanThrow=False
     bNoInstagibReplace=True
     Priority=1
     SmallViewOffset=(Z=-40.000000)
     CenteredRoll=0
     PlayerViewOffset=(Z=-40.000000)
     AttachmentClass=Class'UT2k4AssaultFull.WA_Turret'
     ItemName="Turret weapon"
     Mesh=SkeletalMesh'AS_VehiclesFull_M.SkTurretFP'
     DrawScale=3.000000
     AmbientGlow=64
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:56.000 - Creation time: sk 18-3-2018 09:50:26.131 - Created with UnCodeX