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

KFMod.KFTraderTeleporter


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
// This will kick you out of the Trader's room when the Wave is in progress (and assuming you were naughty, and didn't just leave)

class KFTraderTeleporter extends Teleporter;

var	localized string	CantStayInShopAfterClose;

function Trigger( actor Other, pawn EventInstigator )
{
    local KFHumanPawn A;
    Log("Trigger Call");
   // Log("Am I enabled? : "$bEnabled);

    //bEnabled = !bEnabled;
    if ( bEnabled ) //teleport any pawns already in my radius
        ForEach TouchingActors(class'KFHumanPawn', A)
            PostTouch(A);
}

// Let's add a Bitchy message to let the player know that hanging around after closing is a no-no

simulated function PostTouch( actor Other )
{
    local Teleporter D,Dest[16];
    local int i;



 if (KFGameReplicationInfo(Level.Game.GameReplicationInfo).bWaveInProgress)
 {
    //Log("REMOVING SHOP HOG!");

    PlayerController(Pawn(Other).Controller).ClientMessage(CantStayInShopAfterClose, 'KFCriticalEvent');
    PlayerController(Pawn(Other).Controller).ClientCloseMenu(true, true);

    if( (InStr( URL, "/" ) >= 0) || (InStr( URL, "#" ) >= 0) )
    {
        // Teleport to a level on the net.
        if( (Role == ROLE_Authority) && (Pawn(Other) != None)
            && Pawn(Other).IsHumanControlled() )
            Level.Game.SendPlayer(PlayerController(Pawn(Other).Controller), URL);
    }
    else
    {
        // Teleport to a random teleporter in this local level, if more than one pick random.

        foreach AllActors( class 'Teleporter', D )
            if( string(D.tag)~=URL && D!=Self )
            {
                Dest[i] = D;
                i++;
                if ( i > arraycount(Dest) )
                    break;
            }

        i = rand(i);
        if( Dest[i] != None )
        {
            // Teleport the actor into the other teleporter.
            if ( Other.IsA('Pawn') )
                Other.PlayTeleportEffect(false, true);
            Dest[i].Accept( Other, self );
            if ( Pawn(Other) != None )
                TriggerEvent(Event, self, Pawn(Other));
        }
    }
  }
}

defaultproperties
{
     CantStayInShopAfterClose="You cannot stay in the shop after closing"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:26.000 - Creation time: Fri 13-10-2023 03:19:04.350 - Created with UnCodeX