Skip to content

Custom Callbacks

Taz edited this page Mar 2, 2020 · 2 revisions

There a few custom callbacks you can make use of in your mod.

Room Display Flags Callback

MinimapAPI:AddDisplayFlagsCallback(mod, function)
  • Runs everytime the display flags of a room are needed
  • The function takes: self (the mod table), room (minimap api roomdata) and display flags (the actual display flags)
  • Return a number to override the display flags to that or return nil to do nothing. Returning a non-nil value will stop other callbacks from running.

Example:

-- This example forces all treasure rooms to be visible at all times.
MinimapAPI:AddDisplayFlagsCallback(myMod, function(self, room, dflags)
    if room.Descriptor and room.Descriptor.Data.Type == RoomType.ROOM_TREASURE then
        return dflags | 5
    end
end)

Player Position Callback

MinimapAPI:AddPlayerPositionCallback(mod, function)
  • A callback that runs everytime the player's position is modified by the API.
  • The function takes: self (the mod table), room (minimap api roomdata) and player map grid position (Vector)
  • Return a position to set the position to that or return nil to do nothing. Returning a non-nil value will stop other callbacks from running.

Clone this wiki locally