Skip to content

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 KeyTypical Water ValuesEffect
_waterWater25-50Primary water stat restoration
_foodFood0-5Incidental food gain (if any)
_healthHealth0-10Minor health restoration
_virusVirus0-15Contamination risk
_disinfectantDisinfectant0Not typical for water
_energyEnergy0-10Minor stamina restoration
oxygenOxygen0Not typical for water
_warmthWarmth0Not typical for water (see hot drinks)

Consumption Properties

FieldDefaultDescription
shouldDeleteAfterUsetrueWater container is consumed (deleted) after drinking
_hasAidfalseWater cannot be force-fed to other players
foodConstrainsWaterfood >= waterUsually 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 LevelStatusEffects
90-100HydratedNo effects
60-89NormalNo effects
30-59ThirstyMinor health loss
0-29DehydratedSignificant 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:

ItemWaterFoodHealthVirusNotes
Bottled Water45000Standard pure water
Purified Water500100Crafted from purification tablets
Canteen (full)45000Refillable container
River Water25005Mild contamination
Moldy Water150015High contamination
Salty Water200010Ocean water, dehydrating
Dirty Water150010Puddle water
Apple Juice20550Minor food + health
Soda25502Caffeine/sugar, minor virus
Milk201053Spoils quickly (higher mold chance)

Contamination Risk

Water contamination is the primary balancing lever for water items:

  1. Clean water (bottled, purified): No virus, high water value.
  2. Slightly contaminated (soda, river): Small virus values (2-5).
  3. Moderately contaminated (dirty, salty): Medium virus values (5-10).
  4. 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:

  1. Water gain is reduced to floor(water * quality / 100).
  2. Virus gain is amplified by virusBonus * (100 - quality) / 50.
  3. 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

  1. Water type assignment critical — An ItemWaterAsset configured with Type=FOOD in the .dat will 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 correct EItemType assignment.
  2. 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.
  3. Virus without mold — A water item can have Virus=5 at 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.
  4. foodConstrainsWater edge case — A water item with Food=5 and Water=5 triggers the constraint (5 ≥ 5). Both stats are clamped together, potentially reducing effective hydration.
  5. Refillable vs disposable — Standard ItemWaterAsset items are deleted after use. ItemRefillAsset items persist. A mod that creates a water bottle as ItemWaterAsset will not be refillable — the player must use ItemRefillAsset for refillable containers.