Skip to content

Commit

Permalink
beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
chadvandy committed May 31, 2022
1 parent 8d745b7 commit 1e7dbb9
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 140 deletions.
3 changes: 3 additions & 0 deletions db/help_page_index_records_tables/van_mct.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
key display_order inset_level is_battle enabled
#help_page_index_records_tables;2;db/help_page_index_records_tables/van_mct
mct_profiles 1900 0 false true
2 changes: 1 addition & 1 deletion script/_lib/mod/!vlib_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function VLib.LoadModules(path, search_override, func_for_each)
end

local module = VLib.LoadModule(filename, string.gsub(filename_for_out, filename..".lua", ""))
if is_function(func_for_each) then
if func_for_each and is_function(func_for_each) then
func_for_each(filename_for_out, module)
end
end
Expand Down
274 changes: 137 additions & 137 deletions script/mct/settings/mct.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@ local mct = get_mct()

local mct_mod = mct:register_mod("mct_mod")

mct_mod:set_tooltip_text("Testing this tooltip text out!")

local section = mct_mod:add_new_section("my_section", "This Is My Section")
section:set_tooltip_text("My Section||This section is all about cool stuff.")

mct_mod:create_patch("v2.6.98.12-a078\nJuly 17th, 2021", [[
This is a relatively small patch to incorporate a few more fixes and some new functionality.
New Stuff!
- Section headers can now have tooltip texts for when they're hovered upon.
Changes for Modders!
- Localisation has changed fundamentally. There will be continued support for the old method, but now you can provide multiple loc-keys to any localised text. Instead of using `mct_mod:set_title("loc_key", true)`, you can now use `mct_mod:set_title("{{loc:loc_key}}:{{loc:loc_key_for_more_text}}")`. It'll add in more flexibility with how you use localised keys, hopefully!
- I changed how the text_input_add_validity_test() function operates, as well. Now the function takes in the supplied text, but it'll return first true/false for if it was valid, and then the error message if invalid. Ie.:
text_input_add_validity_test(function(text)
if text == "Bloop" then return false, "Bloop is not accepted!" end
return true
end
- As always, backwards compatibility for both of the above remains - but change over to the newer system as early as you can!
- Added `mct_section:set_tooltip_text("text")` and `mct_section:get_tooltip_text()`. As with other localisation, it defaults to searching for a localisation key at `mct_[section_key]_section_tooltip_text`. NOTE: This IS NOT backwards compatible because it's new!
Bug Squashed!
- The settings rows no longer grow wildly large as you scroll down a big mod. Oopsie!
- Tabs on mods will be set invisible if they're not valid for that mod - no logging button without logs, no patch notes button without patch notes.
- Fixed a small bug with mod description text.
- Visually added in the section names within the Finalize Settings popup, fixed the spacing a bit, and added in tooltips so it's more readable.
- Change patch notes text to left-aligned, just reads better.
Known Issues
- Left-aligned text on the patch notes (here) looks kinda weird if you try to indent. Gotta fix gotta fix.
]],
2,
false
)

mct_mod:create_patch("Brass Bull & Blowpipe\nJuly 14th, 2021", [[
New Feature!
- Added in this Patch Notes functionality that you're reading this note on.
- Added in backend support to expand similar functionality via tabs or external UI.
- Beginning iteration of the "VLib", for Vandy Library - a collection of shared functions I have written up that can make a lot of stuff easier for modders (hopefully!)
-- mct_mod:set_tooltip_text("Testing this tooltip text out!")

-- local section = mct_mod:add_new_section("my_section", "This Is My Section")
-- section:set_tooltip_text("My Section||This section is all about cool stuff.")

-- mct_mod:create_patch("v2.6.98.12-a078\nJuly 17th, 2021", [[
-- This is a relatively small patch to incorporate a few more fixes and some new functionality.

-- New Stuff!
-- - Section headers can now have tooltip texts for when they're hovered upon.

-- Changes for Modders!
-- - Localisation has changed fundamentally. There will be continued support for the old method, but now you can provide multiple loc-keys to any localised text. Instead of using `mct_mod:set_title("loc_key", true)`, you can now use `mct_mod:set_title("{{loc:loc_key}}:{{loc:loc_key_for_more_text}}")`. It'll add in more flexibility with how you use localised keys, hopefully!
-- - I changed how the text_input_add_validity_test() function operates, as well. Now the function takes in the supplied text, but it'll return first true/false for if it was valid, and then the error message if invalid. Ie.:
-- text_input_add_validity_test(function(text)
-- if text == "Bloop" then return false, "Bloop is not accepted!" end
-- return true
-- end

-- - As always, backwards compatibility for both of the above remains - but change over to the newer system as early as you can!
-- - Added `mct_section:set_tooltip_text("text")` and `mct_section:get_tooltip_text()`. As with other localisation, it defaults to searching for a localisation key at `mct_[section_key]_section_tooltip_text`. NOTE: This IS NOT backwards compatible because it's new!

-- Bug Squashed!
-- - The settings rows no longer grow wildly large as you scroll down a big mod. Oopsie!
-- - Tabs on mods will be set invisible if they're not valid for that mod - no logging button without logs, no patch notes button without patch notes.
-- - Fixed a small bug with mod description text.
-- - Visually added in the section names within the Finalize Settings popup, fixed the spacing a bit, and added in tooltips so it's more readable.
-- - Change patch notes text to left-aligned, just reads better.

-- Known Issues
-- - Left-aligned text on the patch notes (here) looks kinda weird if you try to indent. Gotta fix gotta fix.
-- ]],
-- 2,
-- false
-- )

-- mct_mod:create_patch("Brass Bull & Blowpipe\nJuly 14th, 2021", [[
-- New Feature!
-- - Added in this Patch Notes functionality that you're reading this note on.
-- - Added in backend support to expand similar functionality via tabs or external UI.
-- - Beginning iteration of the "VLib", for Vandy Library - a collection of shared functions I have written up that can make a lot of stuff easier for modders (hopefully!)

Changes for Modders!
- Overwrote the CA Script Launcher - the path `./pack/script/mod/` will now load all .lua files within, *after* everything else. This is for scripts that aren't necessarily libraries, but are available in every game mod.
- I also fix up ModLog(), so it doesn't break whenever a non-string is passed to it, and it now has multiple-arg support - so you can use ModLog("My", "Message"), and both will print.
- Added in `mct_mod:create_patch(name, description, position, is_important)`. Docs may have to wait a bit to update, with the changed backend.
- Name is the big name, description is the body, position is where it goes compared to other patches (lower number is lower on the list), is_important determines whether a popup should be triggered. Use sparingly!
- Easy to add MCT functionality, if you wanted. Any file in `.pack/script/vlib/modules/mod_configuration_tool/modules/` will be loaded within the MCT body, and you can overwrite anything I add in. I'll be moving as much of the mod into separate modules, so it's easier to digest piecemeal and add new stuff.
- Increased support for new tabs and arbitrarily run UI. You can now tell the UI to open up whenever, and open up to any mod page and any tab, and it'll respond accordingly (see mct/modules/patch_notes for an example). You can also create new tabs - but for right now, they're available on all mods. That'll be changed in the future!
Bug Fixes!
- The Profiles dropdown will now properly display the currently selected Profile, every time you open up the panel.
- Small other bug fixes.
Known Issues!
- If there's more than one popup at a time, ie. two mods with a new Patch, and you press "Yes" to view the first one, the second popup will immediately be triggered, annoyingly. This is going to be resolved next patch.
Most importantly, this patch comes with a big backend update that has allowed me to conglomerate a large amount of my mods into one single .pack. This .pack file currently contains a load of stuff, a lot of it in the early or middle stages of development. I'll be taking the next few chunks of time to start grinding out some of these features, more news on that in the future.
]],
1,
true
)

-- --- TODO new section for specifically logging!
-- local logging = mct_mod:add_new_option("enable_logging", "checkbox")
-- --test:set_default_value(false)
-- logging:set_read_only(false)
-- logging:set_text("[DISABLED]") -- Logging: Vanilla/Mods
-- logging:set_tooltip_text("This option doesn't do anything right now, I have to fix it. :)")
-- logging:set_local_only(true)
-- Changes for Modders!
-- - Overwrote the CA Script Launcher - the path `./pack/script/mod/` will now load all .lua files within, *after* everything else. This is for scripts that aren't necessarily libraries, but are available in every game mod.
-- - I also fix up ModLog(), so it doesn't break whenever a non-string is passed to it, and it now has multiple-arg support - so you can use ModLog("My", "Message"), and both will print.
-- - Added in `mct_mod:create_patch(name, description, position, is_important)`. Docs may have to wait a bit to update, with the changed backend.
-- - Name is the big name, description is the body, position is where it goes compared to other patches (lower number is lower on the list), is_important determines whether a popup should be triggered. Use sparingly!
-- - Easy to add MCT functionality, if you wanted. Any file in `.pack/script/vlib/modules/mod_configuration_tool/modules/` will be loaded within the MCT body, and you can overwrite anything I add in. I'll be moving as much of the mod into separate modules, so it's easier to digest piecemeal and add new stuff.
-- - Increased support for new tabs and arbitrarily run UI. You can now tell the UI to open up whenever, and open up to any mod page and any tab, and it'll respond accordingly (see mct/modules/patch_notes for an example). You can also create new tabs - but for right now, they're available on all mods. That'll be changed in the future!

-- Bug Fixes!
-- - The Profiles dropdown will now properly display the currently selected Profile, every time you open up the panel.
-- - Small other bug fixes.

-- Known Issues!
-- - If there's more than one popup at a time, ie. two mods with a new Patch, and you press "Yes" to view the first one, the second popup will immediately be triggered, annoyingly. This is going to be resolved next patch.

-- Most importantly, this patch comes with a big backend update that has allowed me to conglomerate a large amount of my mods into one single .pack. This .pack file currently contains a load of stuff, a lot of it in the early or middle stages of development. I'll be taking the next few chunks of time to start grinding out some of these features, more news on that in the future.
-- ]],
-- 1,
-- true
-- )

--- TODO new section for specifically logging!
local logging = mct_mod:add_new_option("enable_logging", "checkbox")
--test:set_default_value(false)
logging:set_read_only(true)
logging:set_text("[DISABLED]") -- Logging: Vanilla/Mods
logging:set_tooltip_text("This option doesn't do anything right now, I have to fix it. :)")
logging:set_local_only(true)

-- local mct_logging = mct_mod:add_new_option("mct_logging", "checkbox")
-- mct_logging:set_default_value(true)
Expand All @@ -90,71 +90,71 @@ mct_mod:create_patch("Brass Bull & Blowpipe\nJuly 14th, 2021", [[
-- check:set_text("Checkbox")
-- check:set_tooltip_text("Test checkbox")

---@type MCT.Option.Dropdown
local drop = mct_mod:add_new_option("dropdown", "dropdown")
drop:set_text("Dropdown")
drop:add_dropdown_values({
{
key = "Test",
text = "Testing text!",
is_default = false,
},
{
key = "Other Test",
text = "Use this!",
is_default = true,
},
{
key = "test",
text = "Hello",
}
})
-- drop:add_drop

---@type MCT.Option.Slider
local slider = mct_mod:add_new_option("slider", 'slider')
slider:set_text("Test Slider")
slider:set_tooltip_text("This is my Test Slider.")
slider:set_default_value(200)
slider:slider_set_min_max(50, 500)

---@type MCT.Option.TextInput
local input = mct_mod:add_new_option("input", "text_input")
input:set_text("Text Input")
input:set_tooltip_text("This is my test text input.")
input:add_validity_test(
function(t)
if t == "Dummy" then
return false, "What did you call me?!"
end

if string.find(t, "butt") then
return false, "Get that out of here"
end
end
)

---@type MCT.Option.TextInput
local input = mct_mod:add_new_option("double_imput", "text_input")
input:set_text("Other Text Input")
input:set_tooltip_text("This is my test text input.")
input:add_validity_test(
function(t)
if t == "fuck" then
return false, "NO CUSSING"
end

if t:len() > 10 then
return false, "Must be 10 characters or less!"
end
end
)

local my_dummy = mct_mod:add_new_option("dummy", "dummy")
my_dummy:set_text("This is a Dummy object!")
my_dummy:set_tooltip_text("Yallooooo")


local second_mod = mct:register_mod("my_test_mod")
second_mod:set_author("")
second_mod:set_title("bloop")
-- ---@type MCT.Option.Dropdown
-- local drop = mct_mod:add_new_option("dropdown", "dropdown")
-- drop:set_text("Dropdown")
-- drop:add_dropdown_values({
-- {
-- key = "Test",
-- text = "Testing text!",
-- is_default = false,
-- },
-- {
-- key = "Other Test",
-- text = "Use this!",
-- is_default = true,
-- },
-- {
-- key = "test",
-- text = "Hello",
-- }
-- })
-- -- drop:add_drop

-- ---@type MCT.Option.Slider
-- local slider = mct_mod:add_new_option("slider", 'slider')
-- slider:set_text("Test Slider")
-- slider:set_tooltip_text("This is my Test Slider.")
-- slider:set_default_value(200)
-- slider:slider_set_min_max(50, 500)

-- ---@type MCT.Option.TextInput
-- local input = mct_mod:add_new_option("input", "text_input")
-- input:set_text("Text Input")
-- input:set_tooltip_text("This is my test text input.")
-- input:add_validity_test(
-- function(t)
-- if t == "Dummy" then
-- return false, "What did you call me?!"
-- end

-- if string.find(t, "butt") then
-- return false, "Get that out of here"
-- end
-- end
-- )

-- ---@type MCT.Option.TextInput
-- local input = mct_mod:add_new_option("double_imput", "text_input")
-- input:set_text("Other Text Input")
-- input:set_tooltip_text("This is my test text input.")
-- input:add_validity_test(
-- function(t)
-- if t == "fuck" then
-- return false, "NO CUSSING"
-- end

-- if t:len() > 10 then
-- return false, "Must be 10 characters or less!"
-- end
-- end
-- )

-- local my_dummy = mct_mod:add_new_option("dummy", "dummy")
-- my_dummy:set_text("This is a Dummy object!")
-- my_dummy:set_tooltip_text("Yallooooo")


-- local second_mod = mct:register_mod("my_test_mod")
-- second_mod:set_author("")
-- second_mod:set_title("bloop")
17 changes: 17 additions & 0 deletions script/vlib/mct/objects/mod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,23 @@ function mct_mod:get_settings()
return mct.settings:get_settings_for_mod(self)
end


function mct_mod:get_settings_by_section(section_key)
local retval = {}

if not self:get_section_by_key(section_key) then
VLib.Error("Trying to get settings within section %s of mod %s, but there is no section with that name!", section_key, self:get_key())
return retval
end

local options = self:get_options_by_section(section_key)
for key,option in pairs(options) do
retval[key] = option:get_finalized_setting()
end

return retval
end

--- Enable localisation for this mod's title. Accepts either finalized text, or a localisation key.
---@param title_text string The text supplied for the title. You can supply the text - ie., "My Mod", or a loc-key, ie. "ui_text_replacements_my_dope_mod". Please note you can also skip this method, and just make a loc key called: `mct_[mct_mod_key]_title`, and MCT will automatically read that.
---@param is_localised boolean True if the title_text supplied is a loc key.
Expand Down
4 changes: 3 additions & 1 deletion script/vlib/mct/option_types/slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,9 @@ core:add_listener(
option_obj:set_selected_setting(option_obj:get_finalized_setting())

local uic = option_obj:get_uic_with_key("error_popup")
uic:SetVisible(false)
if uic then
uic:SetVisible(false)
end
end


Expand Down
4 changes: 3 additions & 1 deletion text/db/mct_ui_text.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mct_new_settings_created_start [[col:red]]MCT - New Options Created![[/col]] tru
mct_new_settings_created_end Press the check mark to open up the MCT panel. Press the x to set to the default values for the new options. true
mct_button_revert_to_default_tt Change all the settings for the currently selected mod back to the modder-specified defaults. true
mct_button_finalize_settings_tt Save and apply all changed settings. There will be a pop-up to confirm your changes. true
mct_profiles_delete_tt Delete Profile||Delete the currently selected MCT Profile. Non-reversible! true
mct_profiles_delete_tt Delete Profile||Delete the currently selected MCT Profile. Irreversible! true
mct_finalize_settings_popup_mod_header Mods & Options true
mct_finalize_settings_popup_old_value_header Previous Value true
mct_finalize_settings_popup_new_value_header New Value true
Expand All @@ -45,3 +45,5 @@ mct_profiles_export_tt TODO true
mct_profiles_edit_tt_inactive [[col:red]]Can't edit the Default Profile![[/col]] true
mct_profiles_new_tt Create Profile||Add a new Profile, with all the same settings as the currently selected Profile to start. true
mct_profiles_new_tt_inactive [[col:red]]Maximum amount of Profiles reached![[/col]] true
mct_profiles_delete_popup Are you sure you would like to delete your Profile with the key [%s]? This action is irreversible! true
mct_profiles_change_popup Are you sure you want to change profiles? There are pending changes on [%s] that will be lost if you continue. true

0 comments on commit 1e7dbb9

Please sign in to comment.