Table of Contents

Class TeleportCasterAction

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Blinks the caster up to MaxDistance metres the way it faces, stopping short of whatever is in the way, and plays ArriveFX where it lands.

[Serializable]
public class TeleportCasterAction : BaseAction, IAction
Inheritance
TeleportCasterAction
Implements
Inherited Members

Remarks

Wire it to the OnSpawn of a PointBlank ability (an invisible object at the caster's feet). The departure effect is an ordinary PlayFXAction before this one in the same event, played at the object, which stays where the caster stood. Because the object is what observers are sent, every client sees both ends of the blink.

One destination on every peer. It is measured from the cast's spawn pose (the caster's feet and facing on the tick it cast, which the server sends observers exactly), or from the caster's own pose on a replayed tick, where the object is not made again and the pose is the same one. A capsule the size of the caster's is swept along the ground a step high, so a blink stops at a wall rather than passing it, and then dropped onto the ground there.

The move runs on the server and the owner (TeleportTo(Vector3)) and again on a replayed tick (ReappliesOnReplay): the caster's position is motor state, so a correction for an earlier tick takes the blink back and the replay of the cast's tick must put it back. Refused while rooted or incapacitated. Players only: an NPC's body belongs to its NavMesh agent.

Fields

ArriveFX

The effect played where the caster lands.

[Tooltip("The effect played where the caster lands.")]
public GameObject ArriveFX

Field Value

GameObject

ArriveFXHeight

Metres above the landing point to play the arrival effect.

[Tooltip("Metres above the landing point to play the arrival effect.")]
public float ArriveFXHeight

Field Value

float

ArriveFXSize

The arrival effect's size in metres (effects are authored to a 1 m cube).

[Tooltip("The arrival effect's size in metres (effects are authored to a 1 m cube).")]
public float ArriveFXSize

Field Value

float

MaxDistance

The furthest the blink goes, metres.

[Tooltip("The furthest the blink goes, metres.")]
public float MaxDistance

Field Value

float

Skin

Kept between the capsule and what stopped it.

public const float Skin = 0.05

Field Value

float

StepHeight

How high a step the blink rises over: a kerb or a stair does not stop it, a wall does.

public const float StepHeight = 0.35

Field Value

float

Properties

ReappliesOnReplay

True when this action must run again on a REPLAYED tick for an effect on the caster itself to survive a correction: what it changes is state the correction has just set back (a resource, a buff), and running it again from that state gives what the prediction had.

public override bool ReappliesOnReplay { get; }

Property Value

bool

Remarks

Asked only for an event marked TickEventData.ReapplyOnly (a self-cast ability's effects, re-dispatched on replay by AbilityObject.RunSelfTargetEffects). False by default, and that is the safe answer: an action whose effect a correction does NOT take back (it grants an item, summons, teleports, plays something) would do it a second time.

Methods

Execute(ICharacter, EventData)

Executes the action. Must be implemented by derived classes.

public override void Execute(ICharacter initiator, EventData eventData)

Parameters

initiator ICharacter

The character initiating the action.

eventData EventData

Event data for the action.

ResolveDestination(PhysicsScene, Vector3, Vector3, float, float, float, int)

Where a blink from start (the feet) along forward lands: as far as maxDistance goes before a capsule of the caster's size, raised a step, meets anything, then dropped onto the ground beneath (or left at the start's height over a drop, to fall from there).

public static Vector3 ResolveDestination(PhysicsScene physics, Vector3 start, Vector3 forward, float maxDistance, float radius, float height, int layers)

Parameters

physics PhysicsScene
start Vector3
forward Vector3
maxDistance float
radius float
height float
layers int

Returns

Vector3