User Tools

Site Tools


dependencies

Differences

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

Link to this comparison view

Last revisionBoth sides next revision
dependencies [2019/05/30 10:34] – external edit 127.0.0.1dependencies [2020/07/14 13:14] maxime
Line 1: Line 1:
 ====== Dependencies ====== ====== Dependencies ======
  
-If your mod uses features/content created in another mod, you can declare this other mod as a dependency of yours. Doing so will warn players if they try to use your mod without its dependencies.+===== 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.
  
 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 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).
Line 25: Line 27:
 } }
 </file> </file>
 +
 +===== 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'']]:
 +
 +
 +<file json mod.json [enable_line_numbers="true"]>
 +-- Test if the mod I depend on is loaded
 +if (foundation.isModLoaded("5d2565f1-3083-4a53-8366-8f2a2e1c4690")) then
 +    ....
 +else
 +    ....
 +end
 +</file>
 +
dependencies.txt · Last modified: 2020/07/14 13:15 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki