FLidarScanService
The scan loop between a scanner and the clouds. Every machine holds its OWN cloud (what this player scanned, owner slot 0) and a SHARED cloud (what the others scanned, re-traced locally from their shots, tinted by a per-player slot 1..7) — and nothing else: there is no global cloud on any machine, the host included. Shots, not points, cross the network: a shot fired in a session goes out through FNetSession::ReportLidarShot, which applies it here at once and relays it to everyone, whose services re-trace it into their shared cloud.
- Module
- Game
- Header
#include "PointCloud/LidarScanService.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using TraceFn = std::function<uint32_t(const FLidarShot&, std::vector<FLidarHit>&)> | |
using FScanGateFn = bool (*)(World& world, EntityID scanner) | Whether scanner may fire this frame. The engine knows nothing about what occupies a player's hands; a gameplay plugin installs the rule (the carry system refuses while a Medium or heavier object is held) and the scanner system asks before every shot. No gate = every scanner fires. |
Constructors
| Signature | Name | Description |
|---|---|---|
FLidarScanService() = default | FLidarScanService | |
~FLidarScanService() | ~FLidarScanService | |
FLidarScanService(const FLidarScanService&) = delete | FLidarScanService |
Public functions
| Returns | Name | Description |
|---|---|---|
FLidarScanService& | operator= | |
void | Attach | Finds or creates the two cloud entities ("ScanCloud.Own" and "ScanCloud.Shared") and takes over the session's shot delegate. |
void | Detach | |
bool | IsAttached | |
void | Fire | A shot from this machine's player. |
void | ApplyNetShot | A shot the session delivered: this player's own (the local echo) goes to the own cloud, anyone else's to the shared cloud under their slot. |
uint8_t | OwnerSlotFor | Stable per session: the first other player seen gets slot 1, the next 2, and so on round to 7. |
void | Tick | Advances every Fill wave still spreading, releasing the hits the front has reached. |
uint32_t | GetActiveWaveCount | |
FPointCloudAccumulator* | GetOwnCloud | |
FPointCloudAccumulator* | GetSharedCloud | |
EntityID | GetOwnCloudEntity | |
EntityID | GetSharedCloudEntity | |
uint32_t | GetShotsApplied | |
FNetLidarShot | ToNet | |
FLidarShot | FromNet | |
void | SetScanGate | |
FScanGateFn | GetScanGate | |
bool | IsScanAllowed |
Function details
FLidarScanService
FLidarScanService() = default~FLidarScanService
~FLidarScanService()FLidarScanService
FLidarScanService(const FLidarScanService&) = deleteoperator=
FLidarScanService& operator=(const FLidarScanService&) = deleteAttach
void Attach(Scene& scene, const FLidarScanConfig& config, TraceFn trace)Finds or creates the two cloud entities ("ScanCloud.Own" and "ScanCloud.Shared") and takes over the session's shot delegate.
Detach
void Detach()IsAttached
bool IsAttached() constFire
void Fire(const FLidarShot& shot)A shot from this machine's player. In a session it is reported and comes back through ApplyNetShot; outside one it is applied directly.
ApplyNetShot
void ApplyNetShot(const FNetLidarShot& shot)A shot the session delivered: this player's own (the local echo) goes to the own cloud, anyone else's to the shared cloud under their slot.
OwnerSlotFor
uint8_t OwnerSlotFor(uint32_t shooterPlayerId)Stable per session: the first other player seen gets slot 1, the next 2, and so on round to 7. Player ids are never reused and run past 7, so the slot is a mapping, not the id.
Tick
void Tick(float deltaSeconds)Advances every Fill wave still spreading, releasing the hits the front has reached. The scanner system calls it every frame.
GetActiveWaveCount
uint32_t GetActiveWaveCount() constGetOwnCloud
FPointCloudAccumulator* GetOwnCloud() constGetSharedCloud
FPointCloudAccumulator* GetSharedCloud() constGetOwnCloudEntity
EntityID GetOwnCloudEntity() constGetSharedCloudEntity
EntityID GetSharedCloudEntity() constGetShotsApplied
uint32_t GetShotsApplied() constToNet
static FNetLidarShot ToNet(const FLidarShot& shot)FromNet
static FLidarShot FromNet(const FNetLidarShot& shot)SetScanGate
static void SetScanGate(FScanGateFn gate)GetScanGate
static FScanGateFn GetScanGate()IsScanAllowed
static bool IsScanAllowed(World& world, EntityID scanner)