Documentation; Full - SamsDRGMods/DRGLib Wiki


Welcome to the DRGLib documentation! This page is always a WIP, but I'll do my best to keep it up to date and relevant.

The source used to generate reference images can be found at the TutorialSources repo, under the Documentation project

General usage tips

Function Libraries


There are a few function libraries built in to help with specific, difficult to manage tasks, as well as interface with the game in a useful way. They are separated into categories, as listed in the image below. All of these functions should be callable from any actor


These functions relate directly to DRGLib, helping your mod interface with it


Function name GetLIB_A_MainRef
Function Library Content/DRGLib/Main/LIB_F_Main
Outputs ReturnValue(LIB_A_Main Object reference) Returns a reference to the LIB_A_Main

Many functions require a LIB_A_Main reference. This node lets you get one. Recommended usage is to store to a variable, since the reference will stay valid until the mission ends

Example usage:


Function name IsDRGLibReady
Function Library Content/DRGLib/Main/LIB_F_Main
Outputs ReturnValue(bool) Returns true if DRGLib is ready for commands relating to the managers

Any function requiring a "Lib_A_MainRef" will need to wait for DRGLib to prepare the various feature managers. This function helps simplify that process.

Example usage:


Function name ValidateLIB_A_MainRef
Function Library Content/DRGLib/Main/LIB_F_Main
Inputs LIB_A_MainRef(LIB_A_Main object reference) A reference in need of validation
Outputs ValidatedReference(LIB_A_Main object reference) A validated reference to LIB_A_Main

This node is intended for internal usage
This function will take a LIB_A_Main reference and check whether it is valid. If it is not valid, the function will create a valid reference and return it If it is valid, then the function just returns the original input

The intended usage of the function is inside a function that requires a LIB_A_MainRef. This is largely a convenience feature, making it so that you don't have to plug anything into a node's LIB_A_MainRef input. This makes prototyping faster at the cost of some performance, and it is recommended to use a saved variable reference when finalizing code

Node appearance:


These functions provide some useful interfacing with Deep Rock Galactic in specific ways


Function name GetLocalPlayerController
Function Library Content/DRGLib/DRGFunctions/LIB_F_Main
Outputs ReturnValue(PlayerController object reference) Returns the local player controller

This function gets the local player controller (i.e. the one controlled on this PC).

Note this returns the player controller, not the Dwarf actor. To get a reference to that you can use "Get Controlled Pawn" off of the PlayerController reference

Example usage:


Function name IsOnSpacerig
Function Library Content/DRGLib/DRGFunctions/LIB_F_Main
Inputs WorldContextObject(Object reference) A world context to perform the function from
Outputs IsOnSpacerig(bool) Returns true if on the Spacerig

This function can be used to determine whether the current game level is the Spacerig.

Note: "Self" is usually the WorldContextObject you want

Example usage:


Function name WidgetsAreReady
Function Library Content/DRGLib/DRGFunctions/LIB_F_Main
Outputs Ready(bool) Returns true if widgets can be placed onscreen

This function tells you whether the game is currently accepting onscreen widgets. While initially loading into a level, it is not possible to add widgets to the viewport. Using a simple loop like the recommended usage of "IsDRGLibReady" will let you wait until the viewport is ready

Example usage:


The input functions are useful to set up or read custom inputs for your mod. All inputs are handled directly through DRGLib's input manager.


Function name ActionMappingAsChord
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs ActionMapping(InputActionKeyMapping Structure) The action to be translated
Outputs Chord(InputChord Structure) The action translated into a chord

This function simply strips an action mapping of it's name in order to translate it into an input chord

Node Appearance:


Function name AddCustomActionMapping
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs LIB_A_MainRef(LIB_A_Main Object reference)ActionName(Name) The name of the custom actionDefaultChord(InputChord Structure) The key combo needed to trigger the action by defaultOverlapBehavior(LIB_E_InputOverlap Enum) Whether/how the custom action is permitted to overlap with other inputsActionDescription(String) A short description of what the action does

The meat and potatoes of the Input library. Sets up a custom input with DRGLib, avoiding a lot of the grunt work. If a custom action with the same name already exists in DRGLib, do nothing

Note: OverlapBehavior is only considered in the LIB_WT_InputKeySelector. The RemapCustomActionMapping node doesn't care

For full notes on usage refer to this tutorial:InsertLinkToInputTutorial

Node Appearance:


Function name ChordAsActionMapping
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs ActionName(Name)The name to add to the chordInputChord(InputChord Structure)The chord to convert to an action mapping
Outputs ActionMapping(InputActionMapping Structure) The translated chord

Adds a name to an Input Chord in order to translate it into an Action Mapping

Node Appearance:


Function name FindConflictingInputs
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs LIB_A_MainRef(LIB_A_Main Object reference)Ignore(Name) A single action to ignore when searchingChord(InputChord Structure) The Chord/key to search for overlapping actions
Outputs CustomActions(Array of LIB_S_CustomInputStruct Structures All custom actions that conflict with the input chordGameActions(Array of Names) All base game actions that conflict with the input chord

Searches through the input settings to find all actions that use the same or similar keys as the input chord

Behavior differs slightly between game and custom actions Game actions: Considered as overlapping if the same key is used. Modifier keys not considered Custom actions: Only considered as overlapping if the full input chord matches, modifiers included This is due to the fact that game actions do not allow modifier keys at all

Node Appearance:


Function name FindCustomAction
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs LIB_A_MainRef(LIB_A_Main Object reference)ActionName(Name) The name of the custom action
Outputs CustomActions(LIB_S_CustomInputStruct Structure The found action

Searches through the custom action settings for an action with a specific name, then returns the found action

Node Appearance:


Function name NameArrayAsStringArray
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs Array{Array of Names) The name array to be translated
Outputs StringArray(Array of Strings) The translated array

Translates an array of names into an array of strings. What else would it do with a name like that :P

Node Appearance:


Function name RefreshGameBindings
Function Library Content/DRGLib/InputFunctions/LIB_F_Input

Forces the game to refresh all input bindings. Anytime "Force rebuild keymaps" is used then you need to refresh the game mappings

Note: this node accomplishes it's goal by creating and closing an options menu widget. This probably has side effects, but whatever ¯\_(ツ)_/¯

Node Appearance:


Function name RemapCustomActionMapping
Function Library Content/DRGLib/InputFunctions/LIB_F_Input
Inputs LIB_A_MainRef(LIB_A_Main Object reference)ActionName(Name) The name of the custom actionNewMapping(InputChord Structure) The new mapping for the custom action to use

Changes a custom action mapping to use a new input chord

Node Appearance:



Function name AddLogEntry
Function Library Content/DRGLib/LoggingFunctions/LIB_F_Log
Inputs LIB_A_MainRef(LIB_A_Main Object reference)LogSeverity(LIB_E_LogSeverity Enum) The severity level of the log entryPrefix(String) A prefix to place before the log entryLogEntry(String) The log entry

Adds an entry to the log saved by DRGLib. Prefix is intended as your mod's name

Entry format: LogSeverity + ": " + Prefix + ": " + LogEntry

Node Usage:


Function name AddLogEntryRaw
Function Library Content/DRGLib/LoggingFunctions/LIB_F_Log
Inputs LIB_A_MainRef(LIB_A_Main Object reference)LogSeverity(LIB_E_LogSeverity Enum) The severity level of the log entryLogEntry(String) The log entry

Adds a log entry without any fancy formatting, outside of a newline being added. Usefull if you're dumping a lot of info all at once and don't want to worry about those dang prefixes

Node Appearance:


These functions don't deserve their own category, usually because they're one-offs without any relatives


Function name AddDraggableWindow
Function Library Content/DRGLib/DraggableWindow/LIB_F_DraggableWindow
Inputs LIB_A_MainRef(LIB_A_Main Object Reference)Widget(UserWidget object reference) The widget to put inside the windowDesiredPosition(Vector2D Structure) The position to place the window onscreenAlignment(Vector2D Structure) How to align the window against the desired positionStartingWindowSize(Vector2D Structure) How big the window should be when originally placedIsResizable(Boolean) Whether we allow the window to be resized by the end user. WindowName(Text) The name to appear in the title bar of the window
Outputs Window(LIB_W_DraggableWindow Object Reference) The generated window

This function generates and places a draggable window on screen

DesiredPosition and StartingWindowSize will both treat values from 0-1 as fractions of the total viewport size. This is per-axis, so it's possible to do something like StartingWindowSize=[200,0.5], with those values representing a window that is half of the total height of the viewport while only being 200 slate units wide

Alignment Will always treat the inputed value as a fraction of the window's initial size onscreen

IsResizable Handles whether the user is allowed to resize the window. This will not block the SetWindowSize function. Accomplished by showing/hiding the appropriate buttons

Widget is your custom widget you wish to place inside the draggable window

The below diagram explains the relations between the different variables. If you're familiar with CanvasPanels, think of DesiredPosition as the anchor point

Example usage:


Function name DateTimeToString
Function Library Content/DRGLib/Main/LIB_F_Main
Inputs Format(String) A string reflecting your desired formatDateTime(DateTime Structure) The date you wish to format
Outputs ReturnValue(String) A string with all keys replaced by the proper values from the DateTime input

This node is designed to let you easily convert a DateTime object into readable text through a key value system

Key Value
D Day of the month
M Month of the year
Y Year
h Hour of the day
m Minute of the hour
s Second of the minute
\ Escape character

For example, a string like D:M:Y h.m.s would return a result similar to 1:13:2022 2.56.35. If you want to include characters that are also keys in your output string, simply use the escape character. E.G. T\he bell dot\h toll h would return something like The bell doth toll 2

Node Appearance:


Macros are distinctly different from function libraries, but serve a similar purpose so I'm putting them here


Function name FindObjectWithClass
Function Library Content/DRGLib/Main/LIB_M_BasicMacros
Inputs Class(Object Class Reference) The class to search forArray(Array of Object references) The array to find the object in
Outputs Return(Object reference) The found object, requires casting to be usefulFound(Boolean) Whether an object was found

This macro locates an object of a specific class in an array. Useful for when an array has mixed object types.

Node Usage:



Function name PrintString
Function Library Content/DRGLib/PrintFunctions/LIB_F_Print
Inputs LIB_A_MainRef(LIB_A_Main Object Reference)Text(String) The string to printColor(LinearColor Structure) The color of the text to printLifetime(Float) How many seconds the string stays onscreen

A simple node to print out things. Note that Text(String) is a String, and not Text. Don't be fooled by the name.

Node Appearance:



Function name AddSettingsPage
Function Library Content/DRGLib/SettingsUI/LIB_F_SettingsFunctions
Inputs LIB_A_MainRef(LIB_A_Main Object Reference)SettingsPage(UserWidget Object Reference) The settings page to add

For details on how to use this node refer to the add a settings page tutorial

Node Appearance:


These functions deal with sorting arrays and keeping them sorted. Why isn't this built in for UE blueprints? Good question!


Everything in the SubFunctions category is intended for INTERNAL usage.


Function name CompareString
Function Library Content/DRGLib/Sorting/LIB_F_Sort
Inputs A(String)B(String)
Outputs A>B(Boolean)

Allows you to compare two strings alphabetically. Case sensitive.

Truth table:

Comparison Result
A="a"B="a" False
A="b"B="a" True
A="a"B="b" False
A="a"B="A" True
A="aa"B="a" True
A="Aa"B="a" False

Node Appearance:


Function name ObjectInsertIntoSortedArray
Function Library Content/DRGLib/Sorting/LIB_F_Sort
Inputs ObjectArray(Array of Object References)ObjectToInsert(Object Reference)SortInterface(LIB_I_SortInterface) Any object that utilizes the LIB_I_SortInterface

Inserts an object into a sorted array at it's proper location. If the array is unsorted there's no telling where the object will go

Implemented through a clumsy binary search. But it works so that's what matters

Node Appearance:


Function name ObjectQuickSort
Function Library Content/DRGLib/Sorting/LIB_F_Sort
Inputs ObjectArray(Array of Object References)SortInterface(LIB_I_SortInterface) Any object that utilizes the LIB_I_SortInterface

Sorts an array of objects with the quickSort algorithm

Node Appearance:


Function name StringInsertIntoSortedArrayImage
Function Library Content/DRGLib/Sorting/LIB_F_Sort
Inputs StringArray(Array of Strings)StringToInsert(String)

Inserts a String into a sorted array at it's proper location. If the array is unsorted there's no telling where the String will go

Implemented through a clumsy binary search. But it works so that's what matters

Node Appearance:


Function name StringInsertIntoSortedArrayImage
Function Library Content/DRGLib/Sorting/LIB_F_Sort
Inputs StringArray(Array of Strings)

Sorts an array of strings with the quicksort algorithm

Node Appearance:



This interface deals with communicating your settings page's name and other useful info with the Settings Feature Manager. In order for it to work properly your widget will have to implement the interface


Function name GetPageInfo
Interface Content/DRGLib/SettingsUI/LIB_I_SettingsPage
Outputs Name(String) The name of the settings pageSubtitle(String) The page's subtitle

In the example listed below, the settings page returned Page="My settings page" and Subtitle="made by ya boi Sammy Ammy"


Function name PageOpened
Interface Content/DRGLib/SettingsUI/LIB_I_SettingsPage

This function is called every time your page is opened. Useful for populating widget values or the like


Function name PageClosed
Interface Content/DRGLib/SettingsUI/LIB_I_SettingsPage

This function is called every time your page is closed. Useful for telling your page to save values


Function name GetPageCategory
Interface Content/DRGLib/SettingsUI/LIB_I_SettingsPage
Outputs Category(Array of Strings)

This function allows you to say what category your function is in. In the example below, the settings page returned Category=[Tutorial]

Categories go from most to least significant. For instance, the category for the log settings page is [DRGLib,Log]

You aren't required to return anything, a page does not have to be inside a category

It is possible for a page and a category to have the same name and be in the same place. In that case they will merge. You can observe this in the DRGLib page



Function name CompareFunction
Interface Content/DRGLib/Sorting/LIB_I_Sort
Inputs A(Object Reference)B(Object Reference)
Outputs A>B(Boolean)

This function is what lets the object sorting function lib work.

ObjectQuickSort and ObjectInsertIntoSortedArray will need an input that implements this function

The below image shows an example of how to use this to compare two objects



There are a few objects in DRGLib that your mod may interact directly with, like the LIB_A_Main or LIB_W_DraggableWindow


This object is responsible for spawning all of DRGLib's feature managers, as well as providing a single place in order to get references to those specific feature managers


Variable name Variable type Description
ManagerMasterList Array of LIB_A_ManagerParent Class references This array stores the class of each feature manager, so that LIB_A_Main knows what it needs to spawn
ActiveManagers Array of LIB_A_ManagerParent Object references This variable stores each spawned feature manager. Using FindObjectWithClass lets the function libraries use this variable effectively
DRGLibIsReady Boolean You'll never guess


Event name Inputs Description
Event BeginPlay Spawns each feature manager listed in ManagerMasterList
ChildInitComplete As each feature manager finishes its loading sequence, they'll call this event. When the final feature manager is finished loading, DRGLibIsReady is set to true and InitComplete is called

Event Dispatchers

Name Inputs Description
InitComplete Called when DRGLib has finished loading. In order to get optimal response time after DRGLib is finished it's recommended to attach to this event dispatcher (But one frame probably won't ever make a difference)


This object allows you to place a slick draggable window on screen to hold a popup widget or something like that


This table does not include widgets

Variable name Variable type Description
LIB_A_WindowManagerRef LIB_A_WindowManager Object reference
SavedPosition Vector2D Structure The previous position of the window. Usually used after collapsing an expanded window
InitialAlignment Vector2D Structure How to align the window around the starting position
SavedWindowSize Vector2D Structure The previous size of the window. Usually used after collapsing an expanded window
IsResizable Boolean Stores whether the window is allowed to be resized by the user
ActivelyResizing Boolean True while the user is resizing the window with the corner button
WindowName Text The name printed at the top of the window
MinWindowSize Vector2D Structure The minimum size of the window. Set to [200,100] by default
WidgetRef UserWidget Object reference The widget placed inside the window
WindowIsActive Boolean Whether the window is currently "Active" (Onscreen or momentarily hidden while a game menu is open)



This function is used to detect when the window has been interacted with, and also determines whether a drag has been detected on the title bar to move the window around


This function handles all the logic related to starting the window movement and ending it.


Function name RepositionWindow
Inputs TargetDesiredPosition(Vector2D Structure)Alignment(Vector2D Structure)

This function repositions the window in the viewport. When inputing a desired position from 0-1 it is treated as a fraction of the total viewport size

Alignment is how the window aligns relative to the desired position

How position and alignment are used


Function name MoveBackOnScreen
Inputs Target

Checks whether the window is off-screen, and moves it back on screen if so

Node appearance


Function name SetWindowSize
Inputs TargetNewSize(Vector2D Structure)

Resizes the window. When fed a value from 0-1, it is treated as a percentage of the total Viewport size. Otherwise, it's treated as slate units

Node appearance