Timber Commons - ihsoft/TimberbornMods GitHub Wiki
Overview
This mod allows other mods to create custom buildings that add, drop or move water.
Water simulation extension
A universal utility class that injects itself into the game's water simulation layer and runs custom water moving logic inside the main physics thread.
The custom behavior is described via WaterMover
. Add an instance to the DirectWaterServiceAccessor
and the logic will start affecting the water flow. Read more info in the relevant xml docs.
The mover can be setup in three modes:
- Water dump. It will be dropping the specified amounts of water at the output tile.
- Water consumer. It will be taking the specified amounts of water from the input tile.
- Water mover. It will be taking water from the input and dropping it at the output. Based on the settings, it can simulate a free water flow (valve mode) or forcibly move water, regardless to the level differences (pump mode).
See example of the usage in the WaterVlave
component that implements a configurable one way water valve.
Water valve
A Unity component that can be used to build a building prefab for one way water valve. This valve only moves water if the water level at the output is lower than the level at the input. Extra limits can be specified.
- Show UI panel. If set to false, then no UI will be presented if the valve building is selected.
- Input coordinates. Relative coordinates of the tile to get the water from.
- Output coordinates. Relative coordinates of the tile to drop the water at.
- Water flow per second. Maximum allowed flow of moving water in "cubic metres per second" units.
- Can change flow in game. If set to true and the UI panel is allowed, the players can select the valve and adjust the flow rate during the game.
- Minimum in game flow. If flow rate is allowed to be changed in game, then this value specifies the lower boundary. The upper boundary will be "Water flow per second".
- Minimum water level at intake. Relative water depth below which the water must not be taken. The level is measured relative to the building's base Z. The value will be disregarded if it's zero or negative. See notes below.
- Maximum water level at outtake. Relative water depth above which the water must not be dumped. The level is measured relative to the building's base Z. The value will be disregarded if it's zero or negative. See notes below.
- Allow disabling output level check. If set to true, then players will be able to disable output level check during the game via UI panel.
NOTES. If both the minimum and maximum levels are not provided, then the valve will completely ignore its Z position and will only work with the absolute water heights on the 2D water map. This may be handy in some cases, but for a regular valve is unlikely a desirable behavior. If you don't want this behavior, but also don't want to define any input/output limits, just set the minimum level to a value close to zero, but not zero (like 0.0001
).
Irrigation towers
This content is coming soon...