Messages

Pulse Water sends messages on the message bus of PulseFoundation (UPulseMessageSubsystem), so quests, achievements, sounds or statistics can react to what happens in the water without knowing the components. The messages come from the authority only: the server, or the game without network. The components keep their own events, which also fire on clients (see below).

Channel Payload When
Pulse.Message.Water.EnteredWater FPulseWaterContactMessage A floating object (Pulse Water Buoyancy) comes into the water.
Pulse.Message.Water.LeftWater FPulseWaterContactMessage It leaves the water.
Pulse.Message.Water.Submerged FPulseWaterContactMessage It goes completely under the surface (99 % of the volume of its pontoons).
Pulse.Message.Water.Surfaced FPulseWaterContactMessage It comes back up (below 95 %).
Pulse.Message.Water.BoatWrecked FPulseWaterBoatMessage The hull of a boat loses its last health.
Pulse.Message.Water.BoatSunk FPulseWaterBoatMessage A boat sinks.
Pulse.Message.Water.WaveEvent FPulseWaterWaveMessage A ring wave is started with SpawnWaveEvent.
Pulse.Message.Water.StartedSwimming FPulseWaterSwimMessage A character starts swimming.
Pulse.Message.Water.StoppedSwimming FPulseWaterSwimMessage It stops swimming.
Pulse.Message.Water.HeadUnderWater FPulseWaterSwimMessage Its head goes under the surface.
Pulse.Message.Water.HeadAboveWater FPulseWaterSwimMessage Its head comes back up.

The payloads:

  • FPulseWaterContactMessage: Actor (the owner of the buoyancy component), Location, Velocity and LiquidType (the liquid at the object, empty in LeftWater), e.g. to burn what falls into lava.
  • FPulseWaterBoatMessage: Boat, Instigator (who caused the last damage, may be empty) and Location.
  • FPulseWaterWaveMessage: Wave, the ring wave with its start time.
  • FPulseWaterSwimMessage: Actor (the character), Location, TimeUnderWater (seconds the head was under water, in HeadAboveWater) and LiquidType.

The channels are in the channel register of the message bus (Pulse.Messages.List), so message triggers, channel pickers and checks know their payloads. The channel list of PulseFoundation shows the channels of all Pulse plugins.

Context

Every message carries a context, so listeners and message triggers can filter by it without breaking the payload. An actor of a player is a pawn or controller with a player state, or a player state.

Channels Target Player Instigator Source and tags Location Amount
EnteredWater, LeftWater, Submerged, Surfaced The object The object when it is an actor of a player – The liquid and its tags (none in LeftWater) The object Its speed in cm/s
BoatWrecked, BoatSunk The boat Who caused the last damage when it is an actor of a player, else the boat when a player possesses it Who caused the last damage – The boat 1
WaveEvent – – – – The origin of the ring The height of its crests in cm
StartedSwimming, StoppedSwimming, HeadUnderWater, HeadAboveWater The character The character when it is an actor of a player – The liquid and its tags The character Seconds under water in HeadAboveWater, else 1

A message trigger on Pulse.Message.Water.EnteredWater with the condition Compare Amount (>= 800) reacts to hard splashes only; Context Tags with Pulse.Water.Liquid.Lava to what falls into lava.

Listening

In Blueprint, Listen For Pulse Message with one of the channels fires On Message Received; break the payload with the struct of the table. In C++:

#include "Messages/PulseMessageSubsystem.h"
#include "PulseWaterMessages.h"

SunkHandle = UPulseMessageSubsystem::Get(this)->Listen<FPulseWaterBoatMessage>(Pulse::Water::Message::TAG_BoatSunk,
	[this](FGameplayTag InChannel, const FPulseWaterBoatMessage& InMessage, const FPulseContext& InContext)
	{
		// e.g. count sunk boats for an achievement
	});

PulseMessageListeners (PulseFoundation) prints who listens, PulseMessageSend <Channel> sends a test message.

Events of the components

The components have events for the same moments, as a Blueprint event and an ...Native delegate for C++. They fire wherever the component runs, also on clients:

  • Pulse Water Buoyancy: OnEnteredWater, OnLeftWater, OnSubmerged, OnSurfaced (with the velocity).
  • Pulse Water Hull: OnDamaged, OnLeaksChanged, OnWrecked, OnSunk, OnCapsized. The hull also sends the attribute messages of PulseFoundation for its health (Pulse.Message.Attribute.Changed, .Depleted when wrecked, .Restored), see Health for every Pulse plugin.
  • Pulse Water Splash: OnSplash (cosmetic, not on a dedicated server).

This site uses Just the Docs, a documentation theme for Jekyll.