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

XGame.UDamageReward


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
//==============================================================================
//  Created on: 12/29/2003
//  A UDamage pickup that has been dropped by a dead player
//  When picked up, gives player any UDamage time that was left when the original player died
//
//  Written by Ron Prestenback
//  © 2003, Epic Games, Inc. All Rights Reserved
//==============================================================================

class UDamageReward extends UDamagePack;

var() float FadeTime;

// This is a modified version of InitDroppedPickupFor - since UDamagePacks don't have associated inventory,
// we don't care about that here....but I *do* need to know how much time is remaining to the UDamage charge
function InitDrop( float RemainingCharge )
{
    // This is when the original UDamage time will expire
    FadeTime = RemainingCharge + Level.TimeSeconds;

    // We're falling
    SetPhysics(PHYS_Falling);
    GotoState('FallingPickup');

    // Only need to know about me if I'm in your area
    bAlwaysRelevant = false;

    // set this flag to indicate that this pickup is not on a pickup base (and thus should be destroyed when picked up)
    bDropped = true;

    bIgnoreEncroachers = false; // handles case of dropping stuff on lifts etc
    bIgnoreVehicles = true;

    // Bots care less about pickups with less udamage time remaining
    MaxDesireability *= (RemainingCharge / 30);

    // TODO - what does these do (or why do we need them in dropped pickups)
    NetUpdateFrequency = RemainingCharge;
    bUpdateSimulatedPosition = true;
    bOnlyReplicateHidden = false;
    LifeSpan = RemainingCharge * 2;
}

// Simple overrides that modify the amount of UDamage time given to a pawn that runs over this pickup
auto state Pickup
{
    function Touch( actor Other )
    {
        local Pawn P;
        local float NewTime;

        if ( ValidTouch(Other) )
        {
            NewTime = FadeTime - Level.TimeSeconds;
            P = Pawn(Other);

            // Add this pickup's remaining time to any UDamage time the pawn already had
            if ( xPawn(P) != None )
                NewTime += Max( xPawn(P).UDamageTime - Level.TimeSeconds, 0);

            P.EnableUDamage(NewTime);
            AnnouncePickup(P);
            SetRespawn();
        }
    }

    function BeginState()
    {
        if ( bDropped )
        {
            AddToNavigation();
            SetTimer(FadeTime - Level.TimeSeconds, false);
        }
    }
}

state FallingPickup
{
    function BeginState()
    {
        SetTimer(FadeTime - Level.TimeSeconds,false);
    }
}

defaultproperties
{
     RespawnTime=0.000000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 20:35:10.000 - Creation time: Wed 7/2/2007 19:16:55.187 - Created with UnCodeX