Maprevealer
Based on game build 714014 | Last updated: 2026-03-03
Overview
MapRevealer manages incremental map revelation for players in the world. When active, it cycles through all connected players, revealing the area around its entity's position to each player in sequence over a fixed time window. This prevents client-side overload from simultaneous large map updates. The component adds the maprevealer tag while active and coordinates with each player's MapExplorer component to perform revelation.
Usage example
local inst = CreateEntity()
inst:AddPosition()
inst:AddComponent("maprevealer")
inst.components.maprevealer:Start(0) -- Immediate start
-- Later, to stop:
inst.components.maprevealer:Stop()
Dependencies & tags
Components used: None (uses only global functions and AllPlayers, POSTACTIVATEHANDSHAKE, and player-owned components like player_classified.MapExplorer).
Tags: Adds maprevealer when started; removes it when stopped.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
revealperiod | number | 5 | Total time in seconds over which all players will be revealed (i.e., the time interval per player scales with player count). |
task | Task or nil | nil | Reference to the scheduled task for revelation pacing; nil when idle. |
Main functions
Start(delay)
- Description: Starts the map revelation cycle. Waits
delayseconds (or up to0.5seconds randomly ifdelayisnil), then begins revealing the map to all connected players in rotation. - Parameters:
delay(number?, optional) — delay before starting, in seconds. If omitted, defaults to a random value between0and0.5. - Returns: Nothing.
- Error states: If a task is already running (
self.task ~= nil), this function does nothing.
Stop()
- Description: Immediately cancels any pending revelation task, removes the
maprevealertag, and halts further map revelation. - Parameters: None.
- Returns: Nothing.
RevealMapToPlayer(player)
- Description: Reveals the area around the entity's position to a single player. Only proceeds if the player is fully initialized (post-handshake) and has a valid
MapExplorercomponent. - Parameters:
player(Entity) — the player entity to reveal the map to. - Returns: Nothing.
- Error states: Returns early (no effect) if
player._PostActivateHandshakeState_Serveris notPOSTACTIVATEHANDSHAKE.READY, or ifplayer.player_classifiedorplayer.player_classified.MapExplorerisnil.
Events & listeners
- Listens to: None (event handling is implemented via scheduled
DoTaskInTimecallbacks:OnStart,OnRevealing,OnRestart). - Pushes: None.
- Cleans up on removal:
MapRevealer.OnRemoveFromEntityis aliased toMapRevealer.Stop, ensuring the task is canceled and tag is removed when the component is removed from the entity.