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

DruidsRPGcvs.RW_Knockback


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
class RW_Knockback extends OneDropRPGWeapon
    HideDropDown
    CacheExempt
    config(UT2004RPG);

var Sound KnockbackSound;

var config float DamageBonus;

function NewAdjustTargetDamage(out int Damage, int OriginalDamage, Actor Victim, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
{
    local Pawn P;
    Local KnockbackInv Inv;
    Local Vector newLocation;

    if (!class'OneDropRPGWeapon'.static.CheckCorrectDamage(ModifiedWeapon, DamageType))
        return;

    super.NewAdjustTargetDamage(Damage, OriginalDamage, Victim, HitLocation, Momentum, DamageType);
    if (!bIdentified)
        Identify();

    if(damage > 0)
    {
        Damage = Max(1, Damage * (1.0 + DamageBonus * Modifier));

        if(Instigator == None)
            return;

        P = Pawn(Victim);
        if(P == None || !class'RW_Freeze'.static.canTriggerPhysics(P))
            return;

        if(P.FindInventoryType(class'KnockbackInv') != None)
            return ;

        Inv = spawn(class'KnockbackInv', P,,, rot(0,0,0));
        if(Inv == None)
            return; //wow
    
        Inv.LifeSpan = (MaxModifier + 1) - Modifier;
        Inv.Modifier = Modifier;
        Inv.GiveTo(P);

        // if they're not walking, falling, or hovering, 
        // the momentum won't affect them correctly, so make them hover.
        // this effect will end when the KnockbackInv expires.
        if(P.Physics != PHYS_Walking && P.Physics != PHYS_Falling && P.Physics != PHYS_Hovering)
            P.SetPhysics(PHYS_Hovering);

        //I check the x,y, and z to see if this projectile has no momentum (some weapons have none)
        if
        (
            (
                Momentum.X == 0 && 
                Momentum.Y == 0 && 
                Momentum.Z == 0
            ) || 
            ClassIsChildOf(DamageType, class'DamTypeSniperShot') || 
            ClassIsChildOf(DamageType, class'DamTypeClassicSniper') ||
            ClassIsChildOf(DamageType, class'DamTypeLinkShaft') ||
            ClassIsChildOf(DamageType, class'DamTypeONSAVRiLRocket') ||
            instr(caps(string(DamageType)), "AVRIL") > -1 //hack for vinv avril
        )
        {
            if(Instigator == Victim)
                 Momentum = Instigator.Location - HitLocation;
            else
                 Momentum = Instigator.Location - Victim.Location;
            Momentum = Normal(Momentum);
            Momentum *= -200;

            // if they're walking, I need to bump them up 
            // in the air a bit or they won't be knocked back 
            // on no momentum weapons.
            if(P.Physics == PHYS_Walking)
            {
                newLocation = P.Location;
                newLocation.z += 10;
                P.SetLocation(newLocation);
            }
        }

        Momentum *= Max(2.0, Max(Modifier * 0.5, Damage * 0.1)); //kawham!
        P.SetOverlayMaterial(ModifierOverlay, 1.0, false);
        if(PlayerController(P.Controller) != None)
                PlayerController(P.Controller).ReceiveLocalizedMessage(class'KnockbackConditionMessage', 0);
        P.PlaySound(KnockbackSound,,1.5 * Victim.TransientSoundVolume,,Victim.TransientSoundRadius);
    }
}

defaultproperties
{
    DamageBonus=0.030000
    KnockbackSound=Sound'WeaponSounds.Misc.ballgun_launch'
    ModifierOverlay=Shader'DruidsRPGShaders1.DomShaders.PulseRedShader'
    MinModifier=2
    MaxModifier=6
    PostfixPos=" of Knockback"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 4/9/2006 17:43:08.000 - Creation time: Wed 7/2/2007 19:16:50.640 - Created with UnCodeX