Add New Category for FS22?
Posted: Wed Jun 21, 2023 12:34 pm
I'm searching for mod to add a new category to Farming Simulator 22?
You are a mod maker, right? You can help with this. I am looking for the same mod below for FS 22.
Code: Select all
<storeCategories>
<storeCategory name="vehicle" title="$l10n_vehicle" image="icons/icon.dds" type="VEHICLE" />
<storeCategory name="tool" title="$l10n_tool" image="icons/icon2.dds" type="TOOL" />
<storeCategory name="object" title="$l10n_object" image="icons/icon3.dds" type="OBJECT"/>
<storeCategory name="placeable" title="$l10n_placeable" image="icons/icon4.dds" type="PLACEABLE" />
</storeCategories>
Ah yes, unfortunately Giants blocked these new features only for DLC, it is possible to bypass this “block” through a rather short script, because the features themselves and the layout of the lines is already available in general, you just need to tell the game to look for them in modDesc mod too, not just DLC.SeanBeales29 wrote: ↑Sun Apr 28, 2024 7:02 pm I tried this yesterday and today ziuta and it won't work for placeables maybe I am doing something wrong
Code: Select all
--[[
========================================================================================================================================================================
Store Categories
========================================================================================================================================================================
Enables loading of store categories from modDesc (basegame only allows this from dlc)
]]
StoreCategoryLoader = {
once = 0
}
function StoreCategoryLoader:loadCategories(xmlHandle, key, isDLCFile, modDir, modName)
if once == 1 then
return
end
local xmlFile = XMLFile.load("ModFile", modDir .. "/modDesc.xml")
xmlFile:iterate("modDesc.storeCategories.storeCategory", function (_, key)
g_storeManager:loadCategoryFromXML(xmlFile, key, modDir, modName)
end)
print(" Loaded store categories!")
xmlFile:delete()
once = 1
end
TypeManager.loadTypeFromXML = Utils.prependedFunction(TypeManager.loadTypeFromXML, StoreCategoryLoader.loadCategories)
Code: Select all
--[[
========================================================================================================================================================================
Store Categories
========================================================================================================================================================================
Enables loading of store categories from modDesc (basegame only allows this from dlc)
Additionally loads new construction categories and tabs from modDesc
]]
StoreCategoryLoader = {
once = 0
}
function StoreCategoryLoader:loadCategories(xmlHandle, key, isDLCFile, modDir, modName)
if once == 1 then
return
end
local xmlFile = XMLFile.load("ModFile", modDir .. "/modDesc.xml")
xmlFile:iterate("modDesc.storeCategories.storeCategory", function (_, key)
g_storeManager:loadCategoryFromXML(xmlFile, key, modDir, modName)
end)
local xmlHandle = xmlFile:getHandle()
if hasXMLProperty(xmlHandle, "modDesc.constructionCategories") then
local defaultIconFilename = xmlFile:getString("modDesc.constructionCategories#defaultIconFilename")
local defaultRefSize = xmlFile:getVector("modDesc.constructionCategories#refSize", {1024, 1024}, 2)
xmlFile:iterate("modDesc.constructionCategories.category", function(_, key)
local categoryName = xmlFile:getString(key .. "#name")
local title = g_i18n:convertText(xmlFile:getString(key .. "#title"), modName)
local iconFilename = xmlFile:getString(key .. "#iconFilename") or defaultIconFilename
local refSize = xmlFile:getVector(key .. "#refSize", defaultRefSize, 2)
local iconUVs = GuiUtils.getUVs(xmlFile:getString(key .. "#iconUVs", "0 0 1 1"), refSize)
g_storeManager:addConstructionCategory(categoryName, title, iconFilename, iconUVs, "")
xmlFile:iterate(key .. ".tab", function(_, tKey)
local tabName = xmlFile:getString(tKey .. "#name")
local tabTitle = g_i18n:convertText(xmlFile:getString(tKey .. "#title"), modName)
local tabIconFilename = xmlFile:getString(tKey .. "#iconFilename") or defaultIconFilename
local tabRefSize = xmlFile:getVector(tKey .. "#refSize", defaultRefSize, 2)
local tabIconUVs = GuiUtils.getUVs(xmlFile:getString(tKey .. "#iconUVs", "0 0 1 1"), tabRefSize)
g_storeManager:addConstructionTab(categoryName, tabName, tabTitle, tabIconFilename, tabIconUVs, "")
end)
end)
end
print(" Loaded store categories!")
xmlFile:delete()
once = 1
end
TypeManager.loadTypeFromXML = Utils.prependedFunction(TypeManager.loadTypeFromXML, StoreCategoryLoader.loadCategories)
Code: Select all
<constructionCategories defaultIconFilename="ui_construction_icons.png" refSize="256 256">
<category name="lowerSaxony" title="$l10n_construction_category_LS_lowerSaxony" iconUVs="0 0 32px 32px">
<tab name="roads" title="$l10n_construction_tab_LS_roads" iconUVs="41px 0 32px 32px" />
<tab name="paths" title="$l10n_construction_tab_LS_paths" iconUVs="80px 0 32px 32px" />
<tab name="bridges" title="$l10n_construction_tab_LS_bridges" iconUVs="200px 0 32px 32px" />
<tab name="contructionProjects" title="$l10n_construction_tab_LS_contructionProjects" iconUVs="120px 0 32px 32px" />
<tab name="buildings" title="$l10n_construction_tab_LS_buildings" iconUVs="160px 0 32px 32px" />
<tab name="other" title="$l10n_construction_tab_LS_other" iconUVs="41px 120px 32px 32px" />
</category>
</constructionCategories>