Skip to content
Snippets Groups Projects
Forked from tome / Tales of MajEyal
5030 commits behind the upstream repository.
grayswandir's avatar
Grayswandir authored
This lets addons specify extra options on a player's birth. These are
treated as normal options, so they are saved in the player's
profile. However, the value of this option at the player's birth is
stored on the player itself.

This is to prevent needing to switch options if you switch between save
files that are using different options.

Adds the ToME:extraBirthOptions hook, as well as a generic OptionTree
dialog.

Example addon:

function hook(self, data)
	local options = {
		{type = "group", path = {"basic"}, name = "Basic", desc = "DESC"},
		{type = "group", path = {"basic", "basic2"}, name = "Basic 2", desc = "DESC 2"},
		{type = "boolean", path = {"basic", "basic2", "test"}, id = "test_boolean", name = "Boolean", desc = "Test Option"},
		{type = "cycling", path = {"basic", "basic2", "test8"}, id = "test_cycle", name = "Cycle", desc = "A cycling test option.", values = {"hello", "goodbye", "???"}},
		{type = "group", path = {"advanced"}, name = "Advancded", desc = "GROUP DESC"},
		{type = "numeric", path = {"advanced", "something"}, id = "test_numeric",
		 name = "Numeric", desc = "A numeric test option.", min = 0, default = 7, max = 10}}
	for _, option in ipairs(options) do
		table.insert(data.options, option)
	end
end
self:bindHook("ToME:extraBirthOptions", hook)
f2517090
History