OldUnreal / UnrealTournamentPatches

Other
999 stars 29 forks source link

can we add ability for SPecs to go through Teleporters please #1486

Open no0nehere opened 10 months ago

no0nehere commented 10 months ago

just wandering if we can allow spectators to go through teleporters while spectating.

SeriousBuggie commented 10 months ago

You can't allow spectators exactly teleports, since it make side effects, like teport efect, and toggle unknown amount of code in case of usage custom teleports.

However this can be solved by custom mutator. Which spawn near every teleporter trigger, for spectator class. and if teleporter touch such trigger, spectator moved to related target of this teleporter. This will not work with some custom fancy teleports, but works with most know teleporters, include stock ones. There must be check for prevent teleport back, in case if teleport linked back.

SeriousBarbie commented 10 months ago

I "misused" the GRAB() function in my custom class SpectatorSB expands CHSpectator:

exec function Grab() {
local Teleporter NearbyTeleporter;
local bool bTeleFound;

    bTeleFound = false;
    foreach RadiusActors(class'Teleporter', NearbyTeleporter, class'PlayerPawn'.Default.CollisionRadius, Location)
    {
        UseTeleporter(NearbyTeleporter);
        bTeleFound = true;
        break;
    }
    if ( ! bTeleFound)
        ClientMessage("no teleporter is close to you");
}

function UseTeleporter(Teleporter SrcTele) {
/******************************************************************************
Searches Teleporter with the given *WhatTag* and returns TRUE if one ore more
were found. If multiple exist, a random one is returned. (See also code in stock
Teleporter.uc)
******************************************************************************/
local int i;
local Teleporter DestTele;

    if (Role < ROLE_Authority)
        return;

    foreach AllActors(class'Teleporter', DestTele)
        if (string(DestTele.tag) ~= SrcTele.URL && SrcTele != DestTele)
            i++;
    if (i <= 0)
    {
        ClientMessage("Teleport destination for" @ SrcTele @ "not found!");
        return;
    }
    i = rand(i);
    foreach AllActors(class'Teleporter', DestTele)
        if (string(DestTele.tag) ~= SrcTele.URL && SrcTele != DestTele && i-- == 0)
            break;
    SetLocation(DestTele.Location);
}
t3r6 commented 1 month ago

Looks like this issue is related: https://github.com/OldUnreal/UnrealTournamentPatches/issues/1618