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

DruidsRPGcvs.FreezeBombCharger


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
class FreezeBombCharger extends Actor;

var xEmitter ChargeEmitter;
var AvoidMarker Fear;
var Controller InstigatorController;

var float ChargeTime;
var float MaxFreezeTime;
var float FreezeRadius;

function Freeze(float Radius)
{
    local float damageScale, dist;
    local vector dir;
    local Controller C, NextC;
    Local NullEntropyInv Inv;

    if (Instigator == None && InstigatorController != None)
        Instigator = InstigatorController.Pawn;

    C = Level.ControllerList;
    while (C != None)
    {
        // get next controller here because C may be destroyed if it's a nonplayer and C.Pawn is killed
        NextC = C.NextController;
        if ( C.Pawn != None && C.Pawn != Instigator && C.Pawn.Health > 0 && !C.SameTeamAs(Instigator.Controller)
             && VSize(C.Pawn.Location - Location) < Radius && FastTrace(C.Pawn.Location, Location) )
        {
            dir = C.Pawn.Location - Location;
            dist = FMax(1,VSize(dir));
            damageScale = 1 - FMax(0,dist/Radius);

            if(!C.Pawn.isA('Vehicle') && class'RW_Freeze'.static.canTriggerPhysics(C.Pawn) 
                && (C.Pawn.FindInventoryType(class'NullEntropyInv') == None))
            {
                Inv = spawn(class'NullEntropyInv', C.Pawn,,, rot(0,0,0));
                if(Inv != None)
                {
                    Inv.LifeSpan = (damageScale * MaxFreezeTime * 3);   
                    Inv.Modifier = (damageScale * MaxFreezeTime * 3);   // *3 because the NullEntropyInv divides by 3
                    Inv.GiveTo(C.Pawn);
                }
            }
        }

        C = NextC;
    }
}

simulated function PostBeginPlay()
{
    if (Level.NetMode != NM_DedicatedServer)
        ChargeEmitter = spawn(class'FreezeBombChargeEmitter');

    if (Role == ROLE_Authority)
        InstigatorController = Controller(Owner);

    Super.PostBeginPlay();
}

simulated function Destroyed()
{
    if (ChargeEmitter != None)
        ChargeEmitter.Destroy();

    Super.Destroyed();
}

auto state Charging
{
Begin:
    if (Instigator == None)
        Destroy();

    Fear = spawn(class'AvoidMarker');
    Fear.SetCollisionSize(FreezeRadius, 200);
    Fear.StartleBots();

    Sleep(ChargeTime);
    spawn(class'FreezeBombExplosion');
    bHidden = true; //for netplay - makes it irrelevant
    if (ChargeEmitter != None)
        ChargeEmitter.Destroy();
    MakeNoise(1.0);
    PlaySound(sound'WeaponSounds.redeemer_explosionsound');

    Freeze(FreezeRadius);

    if (Fear != None)
        Fear.Destroy();
    Destroy();
}

defaultproperties
{
     DrawType=DT_None
     TransientSoundVolume=1.000000
     TransientSoundRadius=5000.000000

     MaxFreezeTime=15.000000
     FreezeRadius=2000.000000
     ChargeTime=2.0
}


Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sat 30/9/2006 20:30:50.000 - Creation time: Wed 7/2/2007 19:16:39.562 - Created with UnCodeX