Tag System

Tags are strings that can be attached to a jump to keep track of certain information, such as the source of a jump.

Tags are stored in the form of a dictionary in most cases:

Data = {
    Tags = {
        ["My cool jump tag"] = true,
        ["Your cool jump tag"] = true,
    },
}

Jumps can be checked for specific tags by using them as a key:

local function MyCoolFunction(_, entity, data)
    if data.Tags["My cool jump tag"] then
        print("This jump had the \"My cool jump tag\" tag!")
    end
end
mod:AddCallback(JumpLib.Callbacks.ENTITY_LAND, MyCoolFunction)

JumpLib's shared optional parameter for JumpLib callbacks has a tag field, allowing the function to only be called if the jump has the specified tag:

local function MyCoolFunction(_, entity, data)
    print("This jump had the \"My cool jump tag\" tag!")
end
mod:AddCallback(
    JumpLib.Callbacks.ENTITY_LAND,
    MyCoolFunction,
    {
        tag = "My cool jump tag"
    }
)

Tags are cleared upon landing.

Please use tags whenever you can, even if you do not need to inside of your own code. This helps for your mod, as well as others to only interact with the specific jumps they intend to.

Last updated