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

UT2k4Assault.Trigger_ASUseAndRespawn


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
//=============================================================================
// Trigger_ASUseAndRespawn
//=============================================================================
// Triggered using the "Use" key and respawns Player.
// Optionnal PSM_Override_Tag allows to force player to respawn is a specific
// Spawning Area (overriding its bEnabled status)
//=============================================================================

class Trigger_ASUseAndRespawn extends SVehicleTrigger
    placeable;

var()   enum AT_AssaultTeam
{
    AT_All,
    AT_Attackers,
    AT_Defenders,
} AssaultTeam;

var()   name    PSM_Override_Tag; // To force Player to use a specific PlayerSpawnManager
var float LastFailTime; //used by AI

// Check if a Team is valid
function bool ApprovePlayerTeam(byte Team)
{
    if ( AssaultTeam == AT_All )
        return true;

    if ( Level.Game.IsA('ASGameInfo') )
    {
        if ( AssaultTeam == AT_Attackers ) { 
            if ( ASGameInfo(Level.Game).IsAttackingTeam(Team) ) return true; }
        else if ( !ASGameInfo(Level.Game).IsAttackingTeam(Team) ) return true;
    }   

    return false;
}


function Touch( Actor Other )
{
    local xPawn         User;
    local Controller    C;

    User = xPawn(Other);

    if ( !bEnabled || (User == None) || (User.Controller == None) )
        return;
        
    C = User.Controller;

    if ( ((C.RouteGoal == self) || (C.Movetarget == self)) && (AIController(C) != None) )
    {
        if ( (C.PlayerReplicationInfo != None) && !C.PlayerReplicationInfo.bOnlySpectator 
            && ApprovePlayerTeam(C.PlayerReplicationInfo.Team.TeamIndex) )
            UsedBy(User);

        return;
    }

    // Send a string message to the toucher.
    User.ReceiveLocalizedMessage(class'Vehicles.BulldogMessage', 0);
}


function UsedBy( Pawn user )
{
    if ( !bEnabled || (User == None) || (User.Controller == None) )
        return;

    if ( !Level.Game.IsA('ASGameInfo') )
        return;

    User.PlayTeleportEffect(true, true);

    // Force player to use a specific Spawn area
    if ( PSM_Override_Tag != '' && PSM_Override_Tag != 'None' )
        User.Controller.Event = PSM_Override_Tag;

    ASGameInfo(Level.Game).RespawnPlayer( User.Controller, false );
}


//=============================================================================
// defaultproperties
//=============================================================================

defaultproperties
{
     bNoDelete=Wahr
     bCollideActors=Wahr
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:52.000 - Creation time: Mo 16.4.2007 11:20:55.140 - Created with UnCodeX