Modding:C Sharp Scripting: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 42: Line 42:
#Find the Mods.json file in your CoQ Saves folder.
#Find the Mods.json file in your CoQ Saves folder.
#Move it to your main modding directory you intend to work from. It is not recommended that this be a mod folder itself, as that will include both this JSON and additional VSCode generated files in the mod itself - it is a better idea to keep mods in their own folders and place the JSON and other exterior files into a parent folder. If you want to keep your Mods folder tidy, you can create your individual Mod folder elsewhere and then create a hardlink/junction to that folder inside of the Mods folder.
#Move it to your main modding directory you intend to work from. It is not recommended that this be a mod folder itself, as that will include both this JSON and additional VSCode generated files in the mod itself - it is a better idea to keep mods in their own folders and place the JSON and other exterior files into a parent folder. If you want to keep your Mods folder tidy, you can create your individual Mod folder elsewhere and then create a hardlink/junction to that folder inside of the Mods folder.
#Open VSCode in the folder that contains the Mods.json, you should now be able to reverence Qud namespaces, classes and methods from your own code. As this just links directly to the DLL's, however, you will only get metadata information about those classes and such, which tends to include function signatures, variable names and similar, but not the actual code within those functions. You can look at the actual code using a decompiler as mentioned above, or if you want your code to directly reference the decompiled code follow the optional step 5.
#Open VSCode in the folder that contains the Mods.json, you should now be able to reference Qud namespaces, classes and methods from your own code. As this just links directly to the DLL's, however, you will only get metadata information about those classes and such, which tends to include function signatures, variable names and similar, but not the actual code within those functions. You can look at the actual code using a decompiler as mentioned above, or if you want your code to directly reference the decompiled code follow the optional step 5.
#(Optional) In order to reference the decompiled code rather than the real DLL's, take save the decompiled code into a folder in the same directory as your mods then, to prevent conflicts, delete the "Assembly-CSharp.dll" line from your Mods.json
#(Optional) In order to reference the decompiled code rather than the real DLL's, take save the decompiled code into a folder in the same directory as your mods then, to prevent conflicts, delete the "Assembly-CSharp.dll" line from your Mods.json. You will have to repeat this step each time the game updates if you want to be working with the most recent code, whereas the DLL links should stay updated.


Note: I sometimes have issues with VSCode or Visual Studio attempting to pull in additional dependencies, which often leads to errors and are not necessary for Qud modding. I do not recommend clicking the "Resolve Dependencies" button if it appears, and if it does you may have to delete the generated ".vs" and "bin" folders in order to get it to work properly again.  
Note: I sometimes have issues with VSCode or Visual Studio attempting to pull in additional dependencies, which often leads to errors and are not necessary for Qud modding. I do not recommend clicking the "Resolve Dependencies" button if it appears, and if it does you may have to delete the generated ".vs" and "bin" folders in order to get it to work properly again.  
Anonymous user

Navigation menu