Jump to content

Turning player postinits on/off with configuration?


Recommended Posts

Hey everyone. My custom chester mod seems to be working besides a few bugs. However, I have a postinit borrowed from another mod that I want to be optional for this mod. I've seen some mods with similar codes, but I don't have enough time to try to figure out how to code something like that.

 

Basically, is there a way to make a function that either applies or disables a postinit based on the configuration options I set? and if so, how would I set it up?

Link to comment
Share on other sites

configuration_options =
{
    {
        name = "somevariable_enabled",
        label = "Label:",
        options =
        {
            {
                description = "ON",
                data = 1
            },
            {
                description = "OFF",
                data = 0
            }
        },
        default = 1,
    },
}
if(GetModConfigData("somevariable_enabled")==1)
then
    AddPrefabPostInit("wilson", function(inst) end)
end

 

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...