Skip to main content

Landmark

A class in Root.Township, Alta.Map.

A point of interest that can appear on a map once a player is aware of it or has discovered it. Server side; registers itself with LandmarkManager after spawning and is saved with its icons and state.

Constructors​

MemberWhat it is
Landmark()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected bool isKeptAfterUnloadWhether the landmark stays registered (and keeps its saved index) while its chunk is unloaded.
6 private and internal fields
MemberWhat it is
private LandmarkIcon awareIconBacking field for AwareIcon, the icon shown once a player knows of the landmark. Saved with the landmark.
private DiscoveryState defaultStateBacking field for DefaultState. Defaults to Aware; Discovered makes DiscoverFor do nothing.
private LandmarkIcon discoveredIconBacking field for DiscoveredIcon, the icon shown once a player has discovered the landmark. Saved.
private GameAchievement findActionAchievement the server completes for a player when they discover this landmark.
private bool isMaskedBacking field for IsMasked. Defaults to true. Saved with the landmark.
private Map mapBacking field for Map, the map this landmark belongs to. Saved with the landmark.

Properties​

MemberWhat it is
LandmarkIcon AwareIcon { get; set; }Icon shown while a player is only aware of the landmark. Setting it resyncs the landmark.
DiscoveryState DefaultState { get; }Discovery state every player starts with for this landmark.
LandmarkIcon DiscoveredIcon { get; set; }Icon shown once a player has discovered the landmark. Setting it resyncs the landmark.
uint Index { get; protected set; }The index LandmarkManager gave this landmark, or 0 when not registered.
bool IsMasked { get; }Whether map boards draw this marker below the map's mask layer (probably hidden by unrevealed areas) instead of on top.
Map Map { get; }Which map this landmark belongs to.
Vector2 Position { get; }The landmark's XZ position as a Vector2.

Methods​

MemberWhat it is
void AwareFor(IPlayer player)Makes the landmark known (but not discovered) for a player. Only does anything when the default state is None.
virtual void CustomizeIcon(MarkerInfo info, Player target)Hook to change the marker info for a specific player before it is sent. Does nothing by default.
void Deregister()Removes the landmark from LandmarkManager and clears its Index.
void DiscoverFor(IPlayer player)Marks the landmark discovered for a player, registering first if needed. On the server it also completes the find achievement.
void ForceSync()Asks LandmarkManager to resend this landmark to players.
override void Initialize()Server: registers the landmark on the next frame and hooks deregistering on destroy.
void SetIcons(LandmarkIcon aware, LandmarkIcon discovered)Sets both icons at once and resyncs.
protected virtual void Destroyed(NetworkEntity entity, bool isUnload)Deregisters the landmark when its entity is destroyed (not when it is only unloaded).
protected virtual void Register()Registers with LandmarkManager and stores the index, unless the entity is being destroyed.
2 private and internal methods
MemberWhat it is
private void AwareForLocal()Editor context-menu helper: calls AwareFor for the local Player.Current.
private void DiscoverForLocal()Editor context-menu helper: calls DiscoverFor for the local Player.Current.

Used in​

Members of other types that take, return or hold a Landmark: