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

DruidsRPGcvs.DruidArtifactSpider


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
00120
00121
00122
00123
00124
00125
00126
00127
00128
class DruidArtifactSpider extends RPGArtifact;

var Emitter FlightTrail;
var localized string NotInVehicleMessage;
var int retry;

function BotConsider()
{
    if 
    (
        !bActive && Instigator.Controller.RouteGoal != None && 
        Instigator.Controller.RouteGoal.Location.Z - 100 > Instigator.Location.Z &&
        Instigator.Controller.Adrenaline > 5 * VSize(Instigator.Controller.RouteGoal.Location - Instigator.Location) / Instigator.AirSpeed 
    )
    {
        Activate();
    }
    else if 
    (
        bActive && 
        Instigator.Controller.RouteGoal.Location.Z - 100 < Instigator.Location.Z && 
        !FastTrace(Instigator.Location + vect(0,0,-200), Instigator.Location)
    )
    {
        Activate();
    }
}

function Activate()
{
    if (Vehicle(Instigator) == None)
        Super.Activate();
    else if (Instigator != None)
        Instigator.ReceiveLocalizedMessage(MessageClass, 2, None, None, Class);
}

static function string GetLocalString(optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2)
{
    if (Switch == 2)
        return Default.NotInVehicleMessage;

    return Super.GetLocalString(Switch, RelatedPRI_1, RelatedPRI_2);
}

state Activated
{
    function BeginState()
    {
        if(Instigator.Physics != PHYS_Walking)
        {
            bActive = false;
            GotoState('');
        }
        else if (Instigator.Base == None)
        {
            bActive = false;
            GotoState('');
        }
        else if (Instigator.Base.IsA('BlockingVolume') && !Instigator.Base.bBlockZeroExtentTraces)
        {
            bActive = false;
            GotoState('');
        }
        else
        {
            if (PlayerController(Instigator.Controller) != None)
                Instigator.Controller.GotoState('PlayerSpidering');
            else
                Instigator.SetPhysics(PHYS_Spider);
            bActive = true;
            FlightTrail = Instigator.spawn(class'FlightEffect', Instigator);
            retry = 0;
            SetTimer(0.15, true);
        }
    }

    function Timer()
    {
        if (Instigator.Physics != PHYS_Spider)
        {
            retry++;
            if(retry > 2)
            {
                bActive = false;
                GotoState('');
            }
        }
        else if (Instigator.Base != None )
        {
            if (Instigator.Base.IsA('BlockingVolume') && !Instigator.Base.bBlockZeroExtentTraces)
            {
                retry++;
                if(retry > 2)
                {
                    bActive = false;
                    GotoState('');
                }
            }
        }
        else
            retry = 0;
    }

    function EndState()
    {
        SetTimer(0, true);
        retry = 0;
        if (Instigator != None && Instigator.Controller != None && Instigator.DrivenVehicle == None)
        {
            Instigator.SetPhysics(PHYS_Falling);
            if (PlayerController(Instigator.Controller) != None)
                Instigator.Controller.GotoState(Instigator.LandMovementState);
        }
        bActive = false;
        if (FlightTrail != None)
            FlightTrail.Kill();
    }
}

defaultproperties
{
     NotInVehicleMessage="Sorry, vehicles can't use an Electro-Magnet around."
     CostPerSec=2
     PickupClass=Class'DruidSpiderPickup'
     IconMaterial=Texture'XGameShaders.BRShaders.BRBall'
     ItemName="Electro-Magnet"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Thu 20/7/2006 16:37:22.000 - Creation time: Wed 7/2/2007 19:16:37.562 - Created with UnCodeX