Skip to content

ItemChargeAsset — Explosive Charge Definition

Overview

ItemChargeAsset extends ItemBarricadeAsset to define explosive charges: C4, breaching charges, demolition charges, and similar. A charge is a placed barricade that detonates when triggered by a detonator item. It has a blast radius, per-type damage values (identical structure to ItemTrapAsset), explosion launch speed, and a detonation effect.

Charges have unique defaults in the barricade base class: they bypass building claims, allow placement inside clip volumes (out of bounds), and bypass pickup ownership by default. This reflects their role as demolition/raiding tools — charges need to be placeable on enemy structures and steal-able by raiders.

Despite having damage fields nearly identical to ItemTrapAsset, ItemChargeAsset inherits directly from ItemBarricadeAsset, not ItemTrapAsset. The two are separate branches in the barricade hierarchy. A charge requires a detonator to activate; a trap triggers autonomously or with power.

Source code location: Unturned/Bundles/ItemChargeAsset.cs (103 lines), inheriting from ItemBarricadeAsset.cs (605 lines), ItemPlaceableAsset.cs (454 lines), and ItemAsset.cs (base).

Inheritance Chain

ItemAsset → IArmorFalloff
  └─ ItemPlaceableAsset
       └─ ItemBarricadeAsset
            └─ ItemChargeAsset — blast radius, damage table, detonation

Note: ItemChargeAsset does NOT inherit from ItemTrapAsset. It is a separate subclass of ItemBarricadeAsset.


Class Definition

csharp
public class ItemChargeAsset : ItemBarricadeAsset
{
    protected float _range2;
    public float range2 => _range2;

    public float playerDamage;
    public float zombieDamage;
    public float animalDamage;
    public float barricadeDamage;
    public float structureDamage;
    public float vehicleDamage;
    public float resourceDamage;
    public float objectDamage;
    public float explosionLaunchSpeed;

    private System.Guid _detonationEffectGuid;
    private ushort _explosion2;

    public System.Guid DetonationEffectGuid => _detonationEffectGuid;
}

Default Barricade Overrides

Charges have three properties that default differently from standard barricades:

PropertyStandard DefaultCharge Default.dat Key
bypassClaimfalsetrueBypass_Claim
AllowPlacementInsideClipVolumesfalsetrueAllow_Placement_Inside_Clip_Volumes
shouldBypassPickupOwnershipfalsetrueBypass_Pickup_Ownership

Why Charges Bypass Claims

Charges bypass building claims by default because their purpose is raiding — destroying enemy structures. If charges respected building claims, they couldn't be placed on an enemy's base, defeating their purpose.

Placement Inside Clip Volumes

Charges can be placed inside clip volumes (out-of-bounds areas) by default. This ensures charges can be placed anywhere a player can physically reach, including at map boundaries where base walls often abut the edge.

Pickup Ownership

Charges bypass pickup ownership by default — raiders can steal a placed charge without needing to be the owner. This is a risk/reward mechanic: placing a charge makes it vulnerable to being picked up by enemies.

Override Behavior

All three defaults can be overridden in the .dat:

csharp
bypassClaim = p.data.ParseBool("Bypass_Claim", defaultValue: build == EBuild.CHARGE);
AllowPlacementInsideClipVolumes = p.data.ParseBool("Allow_Placement_Inside_Clip_Volumes",
    defaultValue: build == EBuild.CHARGE);
shouldBypassPickupOwnership = p.data.ParseBool("Bypass_Pickup_Ownership",
    defaultValue: build == EBuild.CHARGE);

The defaultValue is true when build == EBuild.CHARGE, false otherwise. You can force a charge to respect claims by setting Bypass_Claim false explicitly.


Damage Table

Charges use the same eight-type damage structure as traps:

Field.dat KeyTypeDefault
playerDamagePlayer_DamagefloatRequired
zombieDamageZombie_DamagefloatRequired
animalDamageAnimal_DamagefloatRequired
barricadeDamageBarricade_DamagefloatRequired
structureDamageStructure_DamagefloatRequired
vehicleDamageVehicle_DamagefloatRequired
resourceDamageResource_DamagefloatRequired
objectDamageObject_Damagefloat= resourceDamage

Object Damage Fallback

Identical to ItemTrapAsset:

csharp
if (p.data.ContainsKey("Object_Damage"))
    objectDamage = p.data.ParseFloat("Object_Damage");
else
    objectDamage = resourceDamage;

Blast Radius

.dat KeyTypeDefaultDescription
Range2floatRequiredBlast radius in meters
csharp
_range2 = p.data.ParseFloat("Range2");

The Range2 key (distinct from placement Range inherited from ItemBarricadeAsset) defines the explosion blast radius. All entities within this radius take damage at full blast, with damage falloff toward the edge.


Explosion Launch Speed

.dat KeyTypeDefaultDescription
Explosion_Launch_SpeedfloatplayerDamage * 0.1Physics launch velocity
csharp
explosionLaunchSpeed = p.data.ParseFloat("Explosion_Launch_Speed",
    defaultValue: playerDamage * 0.1f);

Identical to the trap system: entities within blast range are launched with this velocity. Default scales with player damage.


Detonation Effect

.dat KeyTypePurpose
Explosion2GUID/legacy IDParticle/sound effect on detonation
csharp
_explosion2 = p.data.ParseGuidOrLegacyId("Explosion2", out _detonationEffectGuid);

DetonationEffectGuid stores the resolved GUID. The legacy _explosion2 ushort is marked [Obsolete]. Always use DetonationEffectGuid for new code.

Note: Explosion2 is the charge detonation effect. Explosion (inherited from ItemBarricadeAsset) is the barricade destruction effect — the effect played if the charge is destroyed without detonating. These are different GUIDs.


BuildDescription — Inventory Tooltip

csharp
public override void BuildDescription(ItemDescriptionBuilder builder, Item itemInstance)
{
    base.BuildDescription(builder, itemInstance);

    int sortOrder = DescSort_ExplosiveChargeDamage;
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionBlastRadius",
        MeasurementTool.FormatLengthString(range2)), sortOrder++);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionPlayerDamage",
        Mathf.RoundToInt(playerDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionZombieDamage",
        Mathf.RoundToInt(zombieDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionAnimalDamage",
        Mathf.RoundToInt(animalDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionBarricadeDamage",
        Mathf.RoundToInt(barricadeDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionStructureDamage",
        Mathf.RoundToInt(structureDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionVehicleDamage",
        Mathf.RoundToInt(vehicleDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionResourceDamage",
        Mathf.RoundToInt(resourceDamage)), sortOrder);
    builder.Append(PlayerDashboardInventoryUI.localization.format("ItemDescription_ExplosionObjectDamage",
        Mathf.RoundToInt(objectDamage)), sortOrder);
}

Unlike traps, charges ALWAYS show all damage types as explosion damage — charges are always explosive (no non-explosive charge mode). The damage values are formatted as integers (Mathf.RoundToInt).

The base.BuildDescription call includes the standard barricade description (health, armor tier, etc.), but charges have build == EBuild.CHARGE and use the 17-byte state (Owner + Group + Interact) from the barricade base.


BuildCargoData — Wiki Export

csharp
CargoDeclaration data = builder.GetOrAddDeclaration("Charge");
data.Append("GUID", GUID);
data.Append("Range2", range2);
data.Append("Player_Damage", playerDamage);
data.Append("Zombie_Damage", zombieDamage);
data.Append("Animal_Damage", animalDamage);
data.Append("Barricade_Damage", barricadeDamage);
data.Append("Structure_Damage", structureDamage);
data.Append("Vehicle_Damage", vehicleDamage);
data.Append("Resource_Damage", resourceDamage);
data.Append("Explosion_Launch_Speed", explosionLaunchSpeed);
data.Append("Object_Damage", objectDamage);
data.Append("Explosion2", explosion2);
ColumnSource
GUIDPK, FK to Barricade
Range2_range2
Player_Damage through Resource_DamagePer-type damage
Explosion_Launch_SpeedexplosionLaunchSpeed
Object_DamageobjectDamage
Explosion2_explosion2 (legacy)

Charge vs Trap Comparison

FeatureItemChargeAssetItemTrapAsset
Base classItemBarricadeAssetItemBarricadeAsset
TriggerDetonator (external item)Autonomous or powered
Blast radius keyRange2Range2
Damage table8 types8 types
Setup delayNoYes (Trap_Setup_Delay)
CooldownNoYes (Trap_Cooldown)
Explosive alwaysYesOptional (Explosive flag)
Bone breakingNoYes (Broken flag)
Tire damageNoYes (Damage_Tires flag)
Power requirementNoYes (Requires_Power)
Claim bypass defaulttruefalse
OOB placement defaulttruefalse
Pickup bypass defaulttruefalse

.dat File Reference — Charge-Specific

.dat KeyTypeDefaultNotes
Range2floatRequiredBlast radius
Player_DamagefloatRequiredDamage to players
Zombie_DamagefloatRequiredDamage to zombies
Animal_DamagefloatRequiredDamage to animals
Barricade_DamagefloatRequiredDamage to barricades
Structure_DamagefloatRequiredDamage to structures
Vehicle_DamagefloatRequiredDamage to vehicles
Resource_DamagefloatRequiredDamage to resources
Object_Damagefloat= resourceDamageDamage to objects
Explosion2GUID/IDDetonation particle/sound effect
Explosion_Launch_SpeedfloatplayerDamage * 0.1Physics launch velocity
Bypass_ClaimbooltrueOverride default bypass
Allow_Placement_Inside_Clip_VolumesbooltrueOverride OOB placement
Bypass_Pickup_OwnershipbooltrueOverride pickup ownership

All ItemBarricadeAsset, ItemPlaceableAsset, and ItemAsset keys are available.


Modding Example — Demolition Charge .dat

ini
GUID a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
Type Barricade
Build Charge
Health 50
Range 4
Radius 0.3
Offset 0.05
Range2 8.0
Player_Damage 200
Zombie_Damage 300
Animal_Damage 200
Barricade_Damage 500
Structure_Damage 400
Vehicle_Damage 600
Resource_Damage 300
Explosion2 <effect_guid>
Explosion_Launch_Speed 30

8m blast radius, 200–600 damage across types (heavy structure/vehicle damage), 30 launch speed. Bypasses claims by default.


Modding Example — Breaching Charge .dat

ini
GUID f1e2d3c4b5a69788796a5b4c3d2e1f0a
Type Barricade
Build Charge
Health 25
Range 4
Radius 0.2
Offset 0.05
Range2 2.0
Player_Damage 50
Zombie_Damage 100
Barricade_Damage 300
Structure_Damage 200
Bypass_Pickup_Ownership false

Small 2m blast radius, focused barricade/structure damage (breaching tool). Disables pickup bypass — must be owner to pick up.


Modding Example — Safe Zone Charge .dat

ini
GUID d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9
Type Barricade
Build Charge
Health 100
Range 4
Radius 0.3
Offset 0.05
Range2 10.0
Player_Damage 0
Zombie_Damage 500
Barricade_Damage 0
Structure_Damage 0
Vehicle_Damage 0
Resource_Damage 0

10m blast radius, 500 zombie damage, zero damage to everything else. An anti-zombie "cleanse" charge — player-safe explosive for horde clearing.


Common Issues

  1. Charge vs Trap confusion: Despite identical damage fields, charges and traps are separate subclasses. Charges need a detonator to activate; traps trigger autonomously. Don't use a charge .dat for an autonomous trap.

  2. Explosion2 vs Explosion: Explosion2 is the detonation effect. Explosion is the barricade destruction effect (when charge is destroyed without detonating). Both should be set for complete functionality.

  3. Charge placed on enemy base fails: If you explicitly set Bypass_Claim false, the charge respects building claims and can't be placed on enemy structures. This defeats the purpose for raiding charges — leave it at the default true.

  4. Charge stolen by raiders: By default, shouldBypassPickupOwnership true means anyone can pick up a placed charge. Set Bypass_Pickup_Ownership false if charges should only be retrievable by their owner.

  5. Object_Damage fallback: Object_Damage defaults to resourceDamage. Set both explicitly if charges deal different damage to harvestable resources vs environmental objects.

Document history

VersionDateAuthorNotes
1.02026-07-2857 StudiosInitial publication. Full charge asset documentation including damage table, unique barricade defaults, charge vs trap comparison, and modding examples.