Modding:C Sharp Scripting

From Caves of Qud Wiki
Revision as of 15:04, 8 June 2019 by imported>CaptainTechnicality54384
Jump to navigation Jump to search

Overview

Caves of Qud loads a majority of it's content via reflection. You may add new files to it's database of reflectable objects by including .cs files in your mod. These files are compiled at runtime into an assembly and the type resolver will first check for types in the mod assembly before checking the Caves of Qud game assembly, thus you may add new types or override existing types by including classes with the right naming convention in your mod.

Since your mod runs with full privileges, users must approve mods each time they change, to allow any changes in code to be screened before they execute. This approval mechanism is currently only available via the overlay UI so it either must be enabled or mod approval must be disabled for scripting mods to work properly. If your mod scripts are not approved, no files in your mod will be loaded, to prevent definitions from not having the appropriate classes available in the mod's assembly.

Nosing Around

There's no official DLL to assemble against or open source project but if you want to dig around in the source code you can use https://www.jetbrains.com/decompiler/ or some other tool: http://stackoverflow.com/questions/2646707/something-better-than-net-reflector on Caves of Qud\CoQ_Data\Managed\Assembly-CSharp.dll

The XRL.World.Parts namespace contains all the part definitions in the game, so it's a good place to start digging.

Detailed Scripting Topics