Modding:Liquids

From Caves of Qud Wiki
Jump to navigation Jump to search
This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.
For best results, it's recommended to have read the following topics before this one:
This article is a stub. You can help Caves of Qud Wiki by expanding it.
This article is a stub. You can help Caves of Qud Wiki by expanding it.

Adding a new liquid

A new liquid is implemented by a C# class that inherits from XRL.Liquids.BaseLiquid and has the XRL.World.Parts.IsLiquid attribute. A trivial liquid might be implemented, say, in a file called MyLiquid.cs directly inside the mod's directory, as follows:

using XRL.Liquids;

[IsLiquid]
public class MyLiquid : BaseLiquid {
    public MyLiquid () : base ("myliquid") {}
}

This creates a liquid with largely uninteresting properties whose internal identifier is myliquid. The easiest way is to see it in-game is to spawn it in some container, so let's create an ObjectBlueprints.xml as well:

<objects>
    <object Name="MyLiquidPool" Inherits="Water">
        <part Name="LiquidVolume" MaxVolume="-1" Volume="10" StartVolume="10d10" InitialLiquid="myliquid-1000"></part>
    </object>
</objects>

Now you can wish it into existence with MyLiquidPool.

Modifying an existing liquid

This article has information that is missing or not up to par.
Reason: This section has yet to be written.

Properties that a liquid can implement

This article has information that is missing or not up to par.
Reason: This section has yet to be written.