Game landmarks
This page uses Vector3 from Unity. The glossary says what each one is.
This is the full list of what the API gives you. The game has landmark definitions, and the player owns a landmark once it has been added to their map. Landmarks reads those and unlocks or places one, and a position is a point in the game world (world coordinates).
Landmarks the game's landmarks
Call Unlock(id) to give the player a game landmark, and Has(id) to check. Added fires when one reaches the map.
public static class Landmarks
{
public static List<LandmarkInfo> All();
public static bool Has(string id);
public static bool Unlock(string id);
public static bool Place(string modId, string id, Vector3 position, bool showNotification = true);
public static event Action<LandmarkArgs> Added;
public static bool IsAvailable { get; }
}
| Method | Returns | What it does |
|---|---|---|
All() | List<LandmarkInfo> | Every landmark the game has loaded. |
Has(id) | bool | true when the player owns this landmark. |
Unlock(id) | bool | Adds the landmark to the map, with the game’s notification. |
Place(modId, id, position, showNotification) | bool | Adds an existing landmark at a spot you choose. |
| Property | Type | What it means |
|---|---|---|
IsAvailable | bool | false when the framework could not set up landmarks. |
| Event | Gives you | When it fires |
|---|---|---|
Added | LandmarkArgs, the landmark’s id and title | A landmark has just been added to the map. |
LandmarkInfo one landmark
All() gives you one of these for each landmark the game has loaded. (It is built from the game’s Landmark assets.)
public sealed class LandmarkInfo
{
public string Id { get; }
public string Title { get; }
public bool Owned { get; }
}
| Property | Type | What it means |
|---|---|---|
Id | string | The landmark’s id in the game. |
Title | string | The name shown on the map. |
Owned | bool | true when the player has this landmark. |
LandmarkArgs what Added tells you
Added gives you one of these each time a landmark reaches the map. It has the id and title only, so use All() for more.
public sealed class LandmarkArgs
{
public string Id { get; }
public string Title { get; }
}
| Property | Type | What it means |
|---|---|---|
Id | string | The landmark’s id. |
Title | string | The name shown on the map. |
Things to know
All()lists the landmarks the game has loaded so far. One the game has not loaded yet is not listed. (It reads theLandmarkassets fromResources.FindObjectsOfTypeAll<Landmark>().)Has(id)istruewhen the player has the landmark on any of their maps. It isfalsewhen there is no map. (The save keeps ownership for each map, soHaschecks every map in the save, not only the one that is loaded. It isfalsewhen noMapControllerexists.)Unlock(id)adds the landmark to the map the player is on, with the game’s own notification, at the landmark’s own position. It gives backtruewhen the landmark is on that map afterwards, so a landmark the player already has also gives backtrueand adds nothing new. (It calls the game’sLandmark.GiveLandmark(). As in the game, the entry goes to the map of the scene that is loaded, even if the landmark belongs to another map.)Place(modId, id, position, showNotification)adds a landmark the game already has, at a spot you choose. The position is in the same world coordinates the landmark’s own position uses, and the game turns it into the marker’s place on the map. The entry is saved with the map, and put back when the game loads, so it lasts like an unlock. (It calls the game’sMapController.AddLandMark. The entry is saved with the map’s data (MapController.OnSavingGame) and re-added on load. The “already on this map” check is the game’s own.)Addedfires when a landmark is added to the map. That coversUnlock, the game’s own landmark triggers, and anything else that adds one. It does not fire when a save loads. (It fires when the game’sAddLandMarkreturnstrue. This includesLandmark.GiveLandmark. A load adds entries straight to the map, so it does not fire.)IsAvailableisfalsewhen the framework could not set up landmarks. See If something fails to set up.
Limits
Unlockgives backfalsefor an id the game does not know, when there is no map, while a save is loading or being written, and when the game refuses. A landmark that is only on another map does not count, so when the game refuses (it has no map id for this scene),Unlockgives backfalse.Placegives backfalse, and changes nothing, in these cases: a save is loading or being written, the mod id is invalid, the position is not a real number, no map or map picture is loaded, no landmark has that id, or the landmark is already on this map.