ItemWaterAsset — Water Consumables
ItemWaterAsset is an empty subclass of ItemConsumeableAsset. It defines no fields, properties, or methods — all behavior is inherited from the base class and keyed off the EItemType.WATER enum. At 11 lines, it is structurally identical to ItemFoodAsset and ItemMedicalAsset, differing only in its type assignment and the specific stat patterns used by vanilla water items.
Source code location: Unturned/Bundles/ItemWaterAsset.cs
Inheritance Chain
ItemAsset
→ ItemWeaponAsset
→ ItemConsumeableAsset
→ ItemWaterAsset (empty)Class Definition
csharp
public class ItemWaterAsset : ItemConsumeableAsset
{
}The class is entirely empty. The EItemType.WATER assignment happens during ItemAsset.PopulateAsset from the .dat file's Type key. This type assignment is what triggers water-specific behavior in the UseableConsumeable runtime, inventory filtering, spawning, and crafting.
Inherited Behavior from ItemConsumeableAsset
All water items inherit the complete consumable pipeline. The key inherited systems relevant to water are:
Stat Modifiers
| Field | .dat Key | Typical Water Values | Effect |
|---|---|---|---|
_water | Water | 25-50 | Primary water stat restoration |
_food | Food | 0-5 | Incidental food gain (if any) |
_health | Health | 0-10 | Minor health restoration |
_virus | Virus | 0-15 | Contamination risk |
_disinfectant | Disinfectant | 0 | Not typical for water |
_energy | Energy | 0-10 | Minor stamina restoration |
oxygen | Oxygen | 0 | Not typical for water |
_warmth | Warmth | 0 | Not typical for water (see hot drinks) |
Consumption Properties
| Field | Default | Description |
|---|---|---|
shouldDeleteAfterUse | true | Water container is consumed (deleted) after drinking |
_hasAid | false | Water cannot be force-fed to other players |
foodConstrainsWater | food >= water | Usually false for water items (water > food) |
Quality and Purity
showQuality returns true for EItemType.WATER, enabling the quality bar in the item description tooltip. For water items, quality represents purity:
- Quality ≥ 50: Safe to drink. Full water restoration.
- Quality < 50: Contaminated. Reduced water gain, increased virus.
- Quality = 0: Heavily contaminated. Minimal water, maximum virus.
The Water Stat Pipeline
When a water item is consumed, the water stat follows the same tick-based pipeline as food:
csharp
// Each tick (32 ticks/second):
float tickFraction = 1.0f / totalTicks;
float waterGain = _water * tickFraction;
player.water = Mathf.Min(player.water + waterGain, 100.0f);Water-Food Constraint Interaction
Water items usually have water > food, so foodConstrainsWater is false by default. This means water items add water independently without checking the food stat. However, if a water item also carries significant food (e.g., a soup), the constraint may activate:
csharp
foodConstrainsWater = food >= water;When the constraint is active, water gain is clamped when food + water would exceed 100.
Dehydration Thresholds
| Water Level | Status | Effects |
|---|---|---|
| 90-100 | Hydrated | No effects |
| 60-89 | Normal | No effects |
| 30-59 | Thirsty | Minor health loss |
| 0-29 | Dehydrated | Significant health loss, reduced stamina regen |
Water decays at the same rate as food by default. Players must balance both stats to survive.
Vanilla Water Items
Vanilla water items span a range from pure hydration to extremely dangerous contaminated sources:
| Item | Water | Food | Health | Virus | Notes |
|---|---|---|---|---|---|
| Bottled Water | 45 | 0 | 0 | 0 | Standard pure water |
| Purified Water | 50 | 0 | 10 | 0 | Crafted from purification tablets |
| Canteen (full) | 45 | 0 | 0 | 0 | Refillable container |
| River Water | 25 | 0 | 0 | 5 | Mild contamination |
| Moldy Water | 15 | 0 | 0 | 15 | High contamination |
| Salty Water | 20 | 0 | 0 | 10 | Ocean water, dehydrating |
| Dirty Water | 15 | 0 | 0 | 10 | Puddle water |
| Apple Juice | 20 | 5 | 5 | 0 | Minor food + health |
| Soda | 25 | 5 | 0 | 2 | Caffeine/sugar, minor virus |
| Milk | 20 | 10 | 5 | 3 | Spoils quickly (higher mold chance) |
Contamination Risk
Water contamination is the primary balancing lever for water items:
- Clean water (bottled, purified): No virus, high water value.
- Slightly contaminated (soda, river): Small virus values (2-5).
- Moderately contaminated (dirty, salty): Medium virus values (5-10).
- Heavily contaminated (moldy): Large virus values (10-15).
Virus from contaminated water can be mitigated by:
- Disinfectants (antibiotics, purification tablets).
- Cooking (boiling water at a campfire).
- Immunity skills (reduced virus gain from the Immunity skill tree).
Water Purity and the Mold System
The mold/quality system is especially relevant for water items because contamination and spoilage are core survival mechanics:
Mold Effects on Water
When quality drops below 50:
- Water gain is reduced to
floor(water * quality / 100). - Virus gain is amplified by
virusBonus * (100 - quality) / 50. - The "Moldy" warning appears in the description.
Quality Decay
Water quality degrades:
- Over time at room temperature (configurable rate).
- Faster in warm environments.
- Slower in refrigerated storage.
- When combined with food (mold from food transfers to water).
Refilling and Quality
When a water container is refilled:
- Quality does not increase — the container retains its existing quality.
- Newly crafted water items start at 100 quality.
- Emptying and refilling a moldy canteen keeps the moldy quality.
Water vs Food Constraint Dynamics
The foodConstrainsWater system creates several edge cases with water items:
When Water Has Food
Items like apple juice (Food=5, Water=20) have foodConstrainsWater = false (5 < 20). The water gain is independent.
When Food Has High Water
Items like soup (Food=80, Water=80) processed as food have foodConstrainsWater = true (80 ≥ 80). This clamps water to prevent overflow. A water item with the same stats processed as EItemType.WATER would also have the constraint active.
Pure Water Items
Water items with zero food (Food=0, Water=45) always have foodConstrainsWater = false (0 < 45). They add water without constraint.
Water and Other Survival Systems
Water from Environment
Players can obtain water from environmental sources bypassing items entirely:
- Rain: Standing in rain slowly fills water stat.
- Swimming: Being in clean water slowly fills water stat.
- Plants: Harvesting certain plants provides water.
Water Loss from Activity
Water decays faster during:
- Sprinting: Increased water consumption.
- Combat: Melee attacks drain water.
- Hot biomes: Desert and volcanic maps increase water decay.
- Fever/infection: Virus status accelerates water loss.
Water and Temperature
Water items interact with the temperature system:
- Cold water: Provides warmth reduction in hot biomes.
- No inherent temperature modification: Unlike food items with warmth, water items typically don't affect body temperature directly.
Interaction with ItemRefillAsset
ItemRefillAsset (covered separately) provides refillable water containers with per-water-type stat modifiers. Regular ItemWaterAsset items are consumed on use and deleted. ItemRefillAsset items persist and can be refilled at water sources. Both use the same UseableConsumeable pipeline for stat application but differ in item lifecycle.
Common Issues
- Water type assignment critical — An
ItemWaterAssetconfigured withType=FOODin the.datwill be treated as food by the mold system, show the food UI icon, and filter into food crafting categories. The empty subclass relies entirely on correctEItemTypeassignment. - Mold display on pure water — The mold warning appears when quality < 50 and food + water > 0. A purified water item at quality 49 will show "Moldy" even if virus is 0. This is a UI issue — the item may still be safe to drink at quality 49 but the warning triggers at the 50 threshold.
- Virus without mold — A water item can have
Virus=5at quality 100 (fresh but naturally contaminated). The UI shows the virus line in red but does not show the mold warning. Players may drink it expecting it to be safe because it's not moldy. - foodConstrainsWater edge case — A water item with
Food=5andWater=5triggers the constraint (5 ≥ 5). Both stats are clamped together, potentially reducing effective hydration. - Refillable vs disposable — Standard
ItemWaterAssetitems are deleted after use.ItemRefillAssetitems persist. A mod that creates a water bottle asItemWaterAssetwill not be refillable — the player must useItemRefillAssetfor refillable containers.
