Skip to content

Developer Quick Reference

Daemon Forge edited this page Jan 10, 2022 · 3 revisions

The Controller for Basic Map

BasicMapController BasicMap()
class BasicMapController

Party Key

The plan for this is to allow party mod to override then and allow for the swapping of markers from client markers to party markers

static string PARTY_KEY = "";

Register Group for GUI

void RegisterGroup(string id, BasicMapGroupMetaData metaData, BasicMapMarkerFactory factory)

GetMarkers

Return the markers for a specified group

array<autoptr BasicMapMarker> GetMarkers(string id)

Add Markers

void AddMarker(string groupId, autoptr BasicMapMarker marker)
void CreateMarker(string group, string name, vector pos, bool overrideSettings = false)

Change Group

This doesn't work yet but should allow you to move markers from one group to another once I finish

void ChangeGroups(string from, string to, BasicMapMarker marker)

SetMarkers

Sets the marker array to a new array

void SetMarkers(string groupId, array<ref BasicMapMarker> markers)

Remove Markers

//Remove marker with the key (can do it without the key but theoretically would be harder on performance)
void RemoveMarker(string key, ref BasicMapMarker marker)		
bool RemoveMarker(ref BasicMapMarker marker)
//If you know the index you can remove by index
void RemoveMarkerByIndex(string key, int index)

ClearMarkers

Clears the array but keeps the map entry

void ClearMarkers(string key)

Remove All Markers

Removes the full group from the map

void RemoveAllMarkers(string key)

Sending Markers from server side

Set Markers Remote

void SetMarkersRemote(string group, array<autoptr BasicMapMarker> markers, PlayerIdentity toPlayer = NULL )

Sample

array<autoptr BasicMapMarker> markers = new array<autoptr BasicMapMarker> markers;
markers.Insert(new BasicMapMarker("MarkerName", position, "path\\to\\icon", {255,255,255}));
BasicMap().SetMarkersRemote("MODNAME", markers, PlayerIdentity); //Or Null to send to all players

Update an already Defined group

void UpdateGroupRemote(string group, PlayerIdentity toPlayer = NULL ) //Broken right now

Client Side Request marker update

void RequestGroupUpdate(string group)

Get Marker at a Vector

overrideSettings override the CanEdit Setting in the marker to allow you to hard code changes

BasicMapMarker GetMarkerByVector(vector pos, float distance = 10, bool overrideSettings = false)

Removes Marker by Vector

overrideSettings override the CanEdit Setting in the marker to allow you to hard code changes

bool RemoveMarkerByVector(vector pos, float distance = 10, bool overrideSettings = false)

Calls and Call Backs

Init

Called on the Initizliation of the Controller

void Init()

Server First Run

void ServerFirstRun()

On Marker Save

//Markers are updated live this is more just on marker editor close or marker created
void OnMarkerSave(BasicMapMarker marker)

On Marker Delete

When a marker is deleted or removed

void OnMarkerDelete(BasicMapMarker marker)

Stuff you might not need

void SetMarkersOnHUD(bool onHUD)
void ToggleMarkersOnHUD()
bool ShowMarkersOnHUD()
bool ShouldShowOnHUD(string group)
bool ShouldShowOnMap(string group)

Stuff you generally don't need

BasicMapGroupMetaData GetGroup(string id)
string GetGroupName(string id)

Get Groups Returns the Group Map of all the Groups

map< string, ref BasicMapGroupMetaData> GetGroups()

Allows for looping through all markers

int Count()

BasicMapMarker Marker(int i)
static string GetInfoText()
array<autoptr BasicMapMarker> ClientMarkers()
int AddClientMarker(BasicMapMarker marker)
BasicMapMarker ClientMarker(int i)