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

DruidsRPGcvs.AbilityWheeledVehicleStunts


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
class AbilityWheeledVehicleStunts extends RPGAbility
    abstract
    config(UT2004RPG);

var config float MaxForce;
var config float ForceLevelMultiplier;
var config float MaxSpin;
var config float SpinLevelMultiplier;
var config float JumpChargeTime;
var config float ChargeLevelMultiplier; //really a divisor, since it will be fractional

static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
    local int x;
    local bool engineer;

    if(CurrentLevel == 0)
        return super.Cost(Data, CurrentLevel);
    else
    {
        for (x = 0; x < Data.Abilities.length && !engineer; x++)
            if (Data.Abilities[x] == class'ClassEngineer')
                engineer = true;
                
        if(engineer)
            return super.Cost(Data, CurrentLevel);
        else
            return 0;
    }

    return super.Cost(Data, CurrentLevel);
}

/* Modify the owning player's current vehicle. Called by MutUT2004RPG.DriverEnteredVehicle() serverside
 * and RPGStatsInv.ClientEnteredVehicle() clientside.
 */
static simulated function ModifyVehicle(Vehicle V, int AbilityLevel)
{
    local ONSWheeledCraft wheels;
    local VehicleStuntsInv inv;
    
    if(V.Level.NetMode == NM_Client)
        return; //none of this on the client

    wheels = ONSWheeledCraft(V);
    if (wheels == None)
        return;
    
    inv = VehicleStuntsInv(wheels.FindInventoryType(class'VehicleStuntsInv'));
    if(Inv != None)
    {
        //woah
        UnModifyVehicle(V, AbilityLevel);
    }
    
    inv = wheels.spawn(class'VehicleStuntsInv', wheels,,, rot(0,0,0));
    if(inv == None)
        return; //shouldn't happen, but this is a checkertrap in case it does.
    inv.giveTo(wheels);
    
    inv.bAllowAirControl = wheels.bAllowAirControl;
    inv.bAllowChargingJump = wheels.bAllowChargingJump;
    inv.bSpecialHUD = wheels.bSpecialHUD;
    inv.MaxJumpForce = wheels.MaxJumpForce;
    inv.MaxJumpSpin = wheels.MaxJumpSpin;
    inv.JumpChargeTime = wheels.JumpChargeTime;
    inv.bHasHandbrake = wheels.bHasHandbrake;

    wheels.bAllowAirControl = true;
    wheels.bAllowChargingJump = true;
    wheels.bSpecialHUD = true;
    wheels.MaxJumpForce = default.MaxForce * ((float(AbilityLevel - 1) * default.ForceLevelMultiplier) + 1.000000);
    wheels.MaxJumpSpin = default.MaxSpin * ((float(AbilityLevel - 1) * default.SpinLevelMultiplier) + 1.000000);
    wheels.JumpChargeTime = default.JumpChargeTime * ((float(AbilityLevel - 1) * default.SpinLevelMultiplier) + 1.000000);
    wheels.bHasHandbrake = false;
}

/* Remove any modifications to this vehicle, because the player is no longer driving it.
 */
static simulated function UnModifyVehicle(Vehicle V, int AbilityLevel)
{
    local ONSWheeledCraft wheels;
    local VehicleStuntsInv inv;

    if(V.Level.NetMode == NM_Client)
        return; //none of this on the client

    wheels = ONSWheeledCraft(V);
    if (wheels == None)
        return;

    inv = VehicleStuntsInv(wheels.FindInventoryType(class'VehicleStuntsInv'));
    if(inv == None)
        return; //nothing to unmodify.
        
    wheels.bAllowAirControl = inv.bAllowAirControl;
    wheels.bAllowChargingJump = inv.bAllowChargingJump;
    wheels.bSpecialHUD = inv.bSpecialHUD;
    wheels.MaxJumpForce = inv.MaxJumpForce;
    wheels.MaxJumpSpin = inv.MaxJumpSpin;
    wheels.JumpChargeTime = inv.JumpChargeTime;
    wheels.bHasHandbrake = inv.bHasHandbrake;

    wheels.deleteInventory(inv);
    inv.destroy();
}

defaultproperties
{
    MaxForce=200000.000000
    ForceLevelMultiplier=1.500000
    MaxSpin=80.000000
    SpinLevelMultiplier=1.250000
    JumpChargeTime=1.000000
    ChargeLevelMultiplier=0.800000
    AbilityName="Stunt Vehicles"
    Description="With this skill, you can make wheeled vehicles jump.|Hold down the crouch key to charge up and then release to jump.|This ability also grants control of wheeled vehicles in mid-air.|Additional levels provide more spin, momentum, and less charge time.|(Max Level 1. Max Level Engineer 3.)|Cost (per level): 5,10,15"
    StartingCost=5
    CostAddPerLevel=5
    MaxLevel=3
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sun 29/10/2006 15:22:20.000 - Creation time: Wed 7/2/2007 19:16:32.328 - Created with UnCodeX