Table of Contents

Class PortalGate

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

The one place a portal use is decided: open → travel; closed and the player qualifies → activate, then travel; otherwise refuse with a toast. Server only.

public static class PortalGate
Inheritance
PortalGate
Inherited Members

Remarks

Called by TeleportAction (a Teleporter interaction) and SceneTeleporter (walking into a scene portal) just before they move the player. An object without a PortalActivation is not gated at all, so every teleporter that existed before portals keeps working unchanged.

Activation IS the use: there is no separate "activate" interaction. A player who meets a condition walks straight through, and the portal stays open for whoever its scope says. Every refusal answers the owner with the general ToastBroadcast, the same path every other teleport refusal takes.

Fields

NotReadyMessage

Told to a player whose record the server has not finished reading.

public const string NotReadyMessage = "The portal does not answer yet. Try again in a moment."

Field Value

string

Methods

FormatDuration(float)

"2 hours", "45 minutes", "30 seconds".

public static string FormatDuration(float seconds)

Parameters

seconds float

Returns

string

TryPass(IPlayerCharacter, PortalActivation, EventData, PortalActivationStore)

public static bool TryPass(IPlayerCharacter player, PortalActivation portal, EventData eventData, PortalActivationStore store)

Parameters

player IPlayerCharacter
portal PortalActivation
eventData EventData
store PortalActivationStore

Returns

bool

TryPass(IPlayerCharacter, GameObject, EventData)

Decides a use of the portal on portalObject, activating it when the player qualifies.

public static bool TryPass(IPlayerCharacter player, GameObject portalObject, EventData eventData = null)

Parameters

player IPlayerCharacter

The player using it.

portalObject GameObject

The teleporter's GameObject.

eventData EventData

The interaction's event data, if any; conditions read it.

Returns

bool

True when the player may travel.

Use(ICharacter, PortalActivation, EventData, PortalActivationStore, out string)

The use itself, without the network: decides, activates when the verdict says so (spending the key first when the key opened it and the portal spends keys), and says what the player should be told. TryPass(IPlayerCharacter, PortalActivation, EventData, PortalActivationStore) sends that line; tests read it.

public static PortalActivationVerdict Use(ICharacter character, PortalActivation portal, EventData eventData, PortalActivationStore store, out string message)

Parameters

character ICharacter

The character using the portal.

portal PortalActivation

The portal.

eventData EventData

Conditions read it; may be null.

store PortalActivationStore

The activation store.

message string

What to tell the player, or null for nothing.

Returns

PortalActivationVerdict

The verdict that applied. An ActivateWithKey whose key could not be spent comes back as Locked.