User Tools

Site Tools


dependencies

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dependencies [2020/07/14 13:15] – created - external edit 127.0.0.1dependencies [2026/10/05 16:38] (current) – maxime
Line 1: Line 1:
-====== Dependencies ======+====== Dependencies on DLCs and mods ======
  
 ===== Hard dependency ===== ===== Hard dependency =====
  
-If your mod depends on features/content created in another mod, you can declare this other mod as a hard dependency of yours. Doing so will warn players if they try to use your mod without its dependencies.+If your mod depends on features/content created in another mod or a DLC, you can declare this DLC or other mod as a hard dependency of yours. Doing so will warn players if they try to use your mod without its dependencies.
  
-To declare dependencies for your mod, add a ''"Dependencies"'' table in your ''mod.json''. Each entry in this table requires the name of the dependency mod (''"Name"''), and its ID (''"Id"'', you can find it in the dependency's ''generated_ids.lua'' file).+To declare mod dependencies for your mod, add a ''"Dependencies"'' table in your ''mod.json''. Each entry in this table requires the name of the dependency mod (''"Name"''), and its ID (''"Id"'', you can find it in the dependency's ''generated_ids.lua'' file).
  
-<file json mod.json [enable_line_numbers="true", highlight_lines_extra="9,10,13,14"]>+The same is done to declare DLC dependencies, by providing the [[dlc|DLC's codename]]. 
 + 
 +<file json mod.json [enable_line_numbers="true", highlight_lines_extra="7,11,12,15,16"]>
 { {
  "Name": "Mod Name",  "Name": "Mod Name",
Line 13: Line 15:
  "Description": "Description of the mod",  "Description": "Description of the mod",
  "Version": "1.0.0",  "Version": "1.0.0",
 +
 +        "DlcDependencies": [ "guivre_garden", "agriculture" ],
  
  "Dependencies": [  "Dependencies": [
Line 30: Line 34:
 ===== Soft dependency ===== ===== Soft dependency =====
  
-If your mod uses another mod's content but can still work without it, this other mod is considered as a soft dependency. In this case, you can test in your script if this mod is already loaded with ''[[foundation-library-functions#isModLoaded|foundation.isModLoaded]]'':+If your mod uses a DLC's or another mod's content but can still work without it, this DLC or other mod is considered as a soft dependency. In this case, you can test in your script if this DLC/mod is already loaded with ''[[foundation-library-functions#isDlcEnabled|foundation.isDlcEnabled]]'' and ''[[foundation-library-functions#isModLoaded|foundation.isModLoaded]]'': 
  
 +<file json mod.json [enable_line_numbers="true", highlight_lines_extra="2,9"]>
 +-- Test if the DLC I depend on is loaded
 +if (foundation.isDlcEnabled("agriculture")) then
 +    ....
 +else
 +    ....
 +end
  
-<file json mod.json [enable_line_numbers="true"]> 
 -- Test if the mod I depend on is loaded -- Test if the mod I depend on is loaded
 if (foundation.isModLoaded("5d2565f1-3083-4a53-8366-8f2a2e1c4690")) then if (foundation.isModLoaded("5d2565f1-3083-4a53-8366-8f2a2e1c4690")) then
dependencies.1594746929.txt.gz · Last modified: 2020/07/14 13:15 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki