Shop Directories

Directories are a new content type added to the WRS2 Shop menu. This content types will create directories to organise mods in the shop menu. A directory can help keeping the shop menu clean and tidy.
Players can find your mod much faster by navigating inside directories instead of scrolling through hundreds of mods in every shop category.

Especially useful for modders that plan to bring big modpacks into the game that might fill the shop menu with a lot of content.

Create a directory

ModLoader.addContent("directory", {
	contentName			= "Dir1",
	shopCategory			= "vehicles",
	title 				= "Vehicles folder",
	description			= "This folder contains a lot of vehicles",
	previewFilename			= "$image/folderIcon",
});

To create a directory, use the addContent function of the ModLoader. (don't forget to use “directory” as first parameter)

  • The title, description and previewFilename can and must be used like in every other mod. (previewFilename can be empty and will show a folder icon as fallback)
  • The attribute shopCategory defines the shop category where the directory will be.
  • Now the contentName is the most important attribute to control the behaviour of directories. It works with a similar approach like a file system does to locate files.

Example directory for mod

So if we want to create a directory for our mod, that contains a vehicle, we define a directory as seen above and set the contentName = "ExampleVehiclesDir". To put the desired mods inside our directory, we modify it's contentName = "ExampleVehiclesDir.ExampleVehicle1".

ModLoader.addContent("directory", {
	contentName			= "ExampleVehiclesDir",
	shopCategory			= "vehicles",
	title 				= "Vehicles folder",
	description			= "This folder contains a lot of vehicles",
	previewFilename			= "$image/folderIcon",
});
 
ModLoader.addContent("vehicle", {
	contentName			= "ExampleVehiclesDir.ExampleVehicle1",
	shopCategory			= "vehicles",
	title 				= "Example vehicle",
	description			= "Example vehicle description",
	previewFilename			= "$image/vehicle",
});

Nesting of directories

It's also possible to nest directories inside other directories. When creating a directory with contentName = "ExampleDir1" and creating another directory with contentName = "ExampleDir1.ExampleDir2", the second directory will be nested inside the first.
To put mods inside nested directories, just modify the mod's contentName = "ExampleDir1.ExampleDir2.ExampleMod".

ModLoader.addContent("directory", {
	contentName			= "ExampleDir1",
	shopCategory			= "vehicles",
	title 				= "Folder 1",
	description			= "This folder contains another folder",
	previewFilename			= "$image/folderIcon",
});
 
ModLoader.addContent("directory", {
	contentName			= "ExampleDir1.ExampleDir2",
	shopCategory			= "vehicles",
	title 				= "Folder 2",
	description			= "This folder contains a vehicle",
	previewFilename			= "$image/folderIcon",
});
 
ModLoader.addContent("vehicle", {
	contentName			= "ExampleDir1.ExampleDir2.ExampleMod",
	shopCategory			= "vehicles",
	title 				= "Example vehicle",
	description			= "Example vehicle description",
	previewFilename			= "$image/vehicle",
});

Attention: "ExampleDir1.ExampleDir2.ExampleMod" will be shown in the lowest directory level in the shop, when either "ExampleDir1.ExampleDir2" or "ExampleDir1" are not existing.

If you already have a modpack, your mods contentName probably looks like this contentName = "exampleModPackName.exampleMod". You can create a directory with contentName = "exampleModPackName". So every mod with the prefix "exampleModPackName." will automatically be found in this directory.