Jump to content

Mod Configuration


Recommended Posts

Your config goes in modinfo.lua right under configuration_options =

This is what I have in my Smooth Camera mod.

Spoiler

 

{
    {
        name = "ROTATION_SNAP",
        label = "Rotation Snap",
        options =    {
                        {description = "1°", data = 1},
                        {description = "3°", data = 3},
                        {description = "5°", data = 5},
                        {description = "15°", data = 15},
                        {description = "45°", data = 45},
                        {description = "90°", data = 90},
                        {description = "180°", data = 180},
                    },
        default = 45,
        hover = "Default is 45°"
    },

}

 

 

ROTATION_SNAP is the variable that it's editing  local rotamount in my modmain. 

 

Spoiler

function PlayerController:RotLeft()
    if not GLOBAL.TheCamera:CanControl() then
        return
    end
    local rotamount = GetModConfigData("ROTATION_SNAP")
    if not GLOBAL.IsPaused() then
        GLOBAL.TheCamera:SetHeadingTarget(GLOBAL.TheCamera:GetHeadingTarget() - rotamount) 
    elseif self.inst.HUD ~= nil and self.inst.HUD:IsMapScreenOpen() then
        GLOBAL.TheCamera:SetHeadingTarget(GLOBAL.TheCamera:GetHeadingTarget() - rotamount) 
        GLOBAL.TheCamera:Snap()
    end
end
 

 GetModConfigData("ROTATION_SNAP") is the modinfo.lua name, and the "data" is the variable it changes to.

 

 

Label is what you want the option of the config to be. ie. "Difficulty"  and options would be "Easy, Medium, Hard"

 

This is just how I have the config for my basic mod. But is the jist of what a config does and how it does it.

 

Depending on what your mod does, or you want it to do, will effect what needs to be done in the config

Edited by SinisterHumanoid
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...