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

Engine.Door


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
00129
/*=============================================================================
 Door.
 Used to mark a door on the Navigation network (a door is a mover that may act
 as an obstruction).
=============================================================================
*/
class Door extends NavigationPoint
    placeable
    native;

#exec Texture Import File=Textures\Door.pcx Name=S_Door Mips=Off MASKED=1

var() name DoorTag;             // tag of mover associated with this node
var  mover MyDoor;
var() name DoorTrigger;         // recommended trigger to use (if door is triggerable)
var actor RecommendedTrigger;
var() bool bInitiallyClosed;    // if true, means that the initial position of the mover blocks navigation
var() bool bBlockedWhenClosed;  // don't even try to go through this path if door is closed
var bool bDoorOpen;
var bool bTempNoCollide;        // used during path building

function PostBeginPlay()
{
    local vector Dist;

    if ( DoorTrigger != '' )
    {
        ForEach AllActors(class'Actor', RecommendedTrigger, DoorTrigger )
            break;
        // ignore recommended trigger if door is within its radius
        // (DoorTrigger shouldn't have been set)
        if ( RecommendedTrigger != None )
        {
            Dist = Location - RecommendedTrigger.Location;
            if ( abs(Dist.Z) < RecommendedTrigger.CollisionHeight )
            {
                Dist.Z = 0;
                if ( VSize(Dist) < RecommendedTrigger.CollisionRadius )
                    RecommendedTrigger = None;
            }
        }       
    }
    bBlocked = ( bInitiallyClosed && bBlockedWhenClosed );
    bDoorOpen = !bInitiallyClosed;
    Super.PostBeginPlay();
}

function MoverOpened()
{
    bBlocked = ( !bInitiallyClosed && bBlockedWhenClosed );
    bDoorOpen = bInitiallyClosed;
}

function MoverClosed()
{
    bBlocked = ( bInitiallyClosed && bBlockedWhenClosed );
    bDoorOpen = !bInitiallyClosed;
}

/* 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)
{
    if ( MyDoor == None )
        return self;

    if ( MyDoor.BumpType == BT_PlayerBump && !Other.IsPlayerPawn() )
        return None;

    if ( bInitiallyClosed == (bDoorOpen || MyDoor.bOpening || MyDoor.bDelaying) )
        return self;

    if ( RecommendedTrigger != None )
    {
        if ( Trigger(RecommendedTrigger) != None )
            return RecommendedTrigger.SpecialHandling(Other);
        return RecommendedTrigger;
    }
    
    return self;
}

function bool ProceedWithMove(Pawn Other)
{
    if ( MyDoor.bDamageTriggered && (Other.Controller.Focus == MyDoor) )
        Other.Controller.StopFiring();

    if ( bDoorOpen || !MyDoor.bDamageTriggered )
        return true;

    // door still needs to be shot
    Other.ShootSpecial(MyDoor);
    MyDoor.Trigger(Other,Other);
    Other.Controller.WaitForMover(MyDoor);
    return false;
}

event bool SuggestMovePreparation(Pawn Other)
{
    if ( bDoorOpen )
        return false;
    if ( MyDoor.bOpening || MyDoor.bDelaying )
    {
        Other.Controller.WaitForMover(MyDoor);
        return true;
    }
    if ( MyDoor.bDamageTriggered )
    {
        // handle shootable doors
        Other.ShootSpecial(MyDoor);
        MyDoor.Trigger(Other,Other);
        Other.Controller.WaitForMover(MyDoor);
        return true;
    }

    return false;
}

defaultproperties
{
     bInitiallyClosed=True
     bSpecialMove=True
     ExtraCost=100
     RemoteRole=ROLE_None
     Texture=Texture'Engine.S_Door'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 20:25:18.000 - Creation time: Wed 7/2/2007 19:16:37.390 - Created with UnCodeX