PDA

View Full Version : How to influence new sidebar categories and icons



Valarian
January 1st, 2022, 15:17
I'm currently creating a new unofficial ruleset for the Dune roleplaying game. I've added three new reference data categories for the ruleset in the scripts/data_library_dune.lua file and called the LibraryData.overrideRecordTypes function.



aRecordOverrides = {
-- CoreRPG overrides


-- New record types
["talent"] = {
bExport = true,
aDataMap = { "talent", "reference.talents" },
sRecordDisplayClass = "reference_talent",
},
["concept"] = {
bExport = true,
aDataMap = { "concept", "reference.concepts" },
sRecordDisplayClass = "reference_concept",
},
["archetype"] = {
bExport = true,
aDataMap = { "archetype", "reference.archetypes" },
sRecordDisplayClass = "reference_archetype",
},
};


function onInit()
LibraryData.overrideRecordTypes(aRecordOverrides);
end


Two of the new reference types appear under the Character category. The other appears under the Campaign category.

Ideally, I want to have all of the new reference types under the Character sidebar category. Is there a way to influence this in the data?
While the default icons are okay, is there a way to set the sidebar icon to use? Where are the sidebar icons located?

Valarian
January 1st, 2022, 17:37
Answered in part on the Discord #ruleset_wizard channel.

The local table _tDefaultRecordTypeCategories (CoreRPG) sets the categories other than campaign. The table is in the DesktopManager (manager_desktop.lua) class.

There's a reference to CampaignRegistry.sidebarexpand in the loadSidebarCategoryState function, but there doesn't currently seem to be a way to register an entry to the _tSidebarCategoriesExpanded table.

Workaround at the moment is to use one of the pre-registered values for the Concept/Faction information.


aRecordOverrides = {
-- CoreRPG overrides


-- New record types
["talent"] = {
bExport = true,
aDataMap = { "talent", "reference.talents" },
sRecordDisplayClass = "reference_talent",
},
["background"] = {
bExport = true,
aDataMap = { "faction", "reference.factions" },
sRecordDisplayClass = "reference_faction",
},
["archetype"] = {
bExport = true,
aDataMap = { "archetype", "reference.archetypes" },
sRecordDisplayClass = "reference_archetype",
},
};


function onInit()
LibraryData.overrideRecordTypes(aRecordOverrides);
end

Moon Wizard
January 1st, 2022, 19:23
For a unique category, Just add a unique .sSidebarCategory value to a record; and a new category will be created automatically below the others. You’ll also need to define the string resource for the label.

I would recommend adding those to the “create” category, as that already exists in other rulesets and creates consistency.

Regards,
JPG

Valarian
January 1st, 2022, 21:42
Thanks. That's got it.


["talent"] = {
bExport = true,
aDataMap = { "talent", "reference.talents" },
sRecordDisplayClass = "reference_talent",
sSidebarCategory = "create",
},
["faction"] = {
bExport = true,
aDataMap = { "faction", "reference.factions" },
sRecordDisplayClass = "reference_faction",
sSidebarCategory = "create",
},
["archetype"] = {
bExport = true,
aDataMap = { "archetype", "reference.archetypes" },
sRecordDisplayClass = "reference_archetype",
sSidebarCategory = "create",
},
};


function onInit()
LibraryData.overrideRecordTypes(aRecordOverrides);
end

Moon Wizard
January 1st, 2022, 21:43
Great. Glad you got it working.

JPG