Modding:Liquids: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
m (Teamtoto moved page Modding/Liquids to Modding:Liquids)
m (add modding navbox)
Line 35: Line 35:


[[Category:Modding]][[Category:Guides]]
[[Category:Modding]][[Category:Guides]]
{{Modding Navbox}}

Revision as of 16:10, 2 May 2020

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.
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.