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

Botpack.JumpSpot


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
00117
00118
00119
//=============================================================================
// JumpSpot.
// specifies positions that can be reached in jumpmatch or with jumpboots or translocator
//=============================================================================
class JumpSpot extends LiftCenter;

var() bool bImpactJump, bAlwaysAccel;
var Bot PendingBot;

event int SpecialCost(Pawn Seeker)
{
    local Bot B;

    B = Bot(Seeker);
    if ( B == None )
        return 100000000;
        
    if ( B.bCanTranslocate || (B.JumpZ > 1.5 * B.Default.JumpZ) 
        || (B.Region.Zone.ZoneGravity.Z >= 0.8 * B.Region.Zone.Default.ZoneGravity.Z) )
        return 300;

    if ( bImpactJump && B.bHasImpactHammer && (B.Health > 85) && (!B.bNovice || (B.Skill > 2.5)) 
        && (B.DamageScaling < 1.4) )
        return 1100;

    return 100000000;
}

/* SpecialHandling is called by the navigation code when the next path has been found.  
It gives that path an opportunity to modify the result based on any special considerations
*/
function Actor SpecialHandling(Pawn Other)
{
    local Bot B;

    if ( !Other.IsA('Bot') )
        return None;

    if ( (VSize(Location - Other.Location) < 200) 
         && (Abs(Location.Z - Other.Location.Z) < Other.CollisionHeight) )
        return self;

    B = Bot(Other);
    if ( (Other.JumpZ <= 1.5 * Other.Default.JumpZ) && (B.Region.Zone.ZoneGravity.Z < 0.8 * B.Region.Zone.Default.ZoneGravity.Z) )
    {
        if ( (B.MyTranslocator == None) || (B.MyTranslocator.TTarget != None) 
            || (Level.Game.IsA('DeathMatchPlus') && !DeathMatchPlus(Level.Game).CanTranslocate(B)) )
        {
            if ( bImpactJump && B.CanImpactJump() )
            {
                PendingBot = B;
                GotoState('PendingImpact');
                Return self;
            }
            return None;
        }
        B.TranslocateToTarget(self);
        return self;    
    }

    PendingBot = B;
    GotoState('PendingJump');

    return self;
}


// don't do jumps right away because a state change here could be dangerous during navigation
State PendingJump
{
    function Actor SpecialHandling(Pawn Other)
    {
        if ( PendingBot != None )
        {
            PendingBot.BigJump(self);
            PendingBot = None;
        }
        return Super.SpecialHandling(Other);
    }

    function Tick(float DeltaTime)
    {
        if ( PendingBot != None )
        {
            PendingBot.BigJump(self);
            PendingBot = None;
        }
        GotoState('');
    }
}

State PendingImpact
{
    function Actor SpecialHandling(Pawn Other)
    {
        if ( PendingBot != None )
        {
            PendingBot.ImpactJump(self);
            PendingBot = None;
        }
        return Super.SpecialHandling(Other);
    }

    function Tick(float DeltaTime)
    {
        if ( PendingBot != None )
        {
            PendingBot.ImpactJump(self);
            PendingBot = None;
        }
        GotoState('');
    }
}

defaultproperties
{
     bSpecialCost=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 19.5.2005 19:42:14.000 - Creation time: Fr 7.6.2013 13:15:48.018 - Created with UnCodeX