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, detonationNote: 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:
| Property | Standard Default | Charge Default | .dat Key |
|---|---|---|---|
bypassClaim | false | true | Bypass_Claim |
AllowPlacementInsideClipVolumes | false | true | Allow_Placement_Inside_Clip_Volumes |
shouldBypassPickupOwnership | false | true | Bypass_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 Key | Type | Default |
|---|---|---|---|
playerDamage | Player_Damage | float | Required |
zombieDamage | Zombie_Damage | float | Required |
animalDamage | Animal_Damage | float | Required |
barricadeDamage | Barricade_Damage | float | Required |
structureDamage | Structure_Damage | float | Required |
vehicleDamage | Vehicle_Damage | float | Required |
resourceDamage | Resource_Damage | float | Required |
objectDamage | Object_Damage | float | = 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 Key | Type | Default | Description |
|---|---|---|---|
Range2 | float | Required | Blast 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 Key | Type | Default | Description |
|---|---|---|---|
Explosion_Launch_Speed | float | playerDamage * 0.1 | Physics 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 Key | Type | Purpose |
|---|---|---|
Explosion2 | GUID/legacy ID | Particle/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);| Column | Source |
|---|---|
GUID | PK, FK to Barricade |
Range2 | _range2 |
Player_Damage through Resource_Damage | Per-type damage |
Explosion_Launch_Speed | explosionLaunchSpeed |
Object_Damage | objectDamage |
Explosion2 | _explosion2 (legacy) |
Charge vs Trap Comparison
| Feature | ItemChargeAsset | ItemTrapAsset |
|---|---|---|
| Base class | ItemBarricadeAsset | ItemBarricadeAsset |
| Trigger | Detonator (external item) | Autonomous or powered |
| Blast radius key | Range2 | Range2 |
| Damage table | 8 types | 8 types |
| Setup delay | No | Yes (Trap_Setup_Delay) |
| Cooldown | No | Yes (Trap_Cooldown) |
| Explosive always | Yes | Optional (Explosive flag) |
| Bone breaking | No | Yes (Broken flag) |
| Tire damage | No | Yes (Damage_Tires flag) |
| Power requirement | No | Yes (Requires_Power) |
| Claim bypass default | true | false |
| OOB placement default | true | false |
| Pickup bypass default | true | false |
.dat File Reference — Charge-Specific
| .dat Key | Type | Default | Notes |
|---|---|---|---|
Range2 | float | Required | Blast radius |
Player_Damage | float | Required | Damage to players |
Zombie_Damage | float | Required | Damage to zombies |
Animal_Damage | float | Required | Damage to animals |
Barricade_Damage | float | Required | Damage to barricades |
Structure_Damage | float | Required | Damage to structures |
Vehicle_Damage | float | Required | Damage to vehicles |
Resource_Damage | float | Required | Damage to resources |
Object_Damage | float | = resourceDamage | Damage to objects |
Explosion2 | GUID/ID | — | Detonation particle/sound effect |
Explosion_Launch_Speed | float | playerDamage * 0.1 | Physics launch velocity |
Bypass_Claim | bool | true | Override default bypass |
Allow_Placement_Inside_Clip_Volumes | bool | true | Override OOB placement |
Bypass_Pickup_Ownership | bool | true | Override 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 308m 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 falseSmall 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 010m blast radius, 500 zombie damage, zero damage to everything else. An anti-zombie "cleanse" charge — player-safe explosive for horde clearing.
Common Issues
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
.datfor an autonomous trap.Explosion2 vs Explosion:
Explosion2is the detonation effect.Explosionis the barricade destruction effect (when charge is destroyed without detonating). Both should be set for complete functionality.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 defaulttrue.Charge stolen by raiders: By default,
shouldBypassPickupOwnership truemeans anyone can pick up a placed charge. SetBypass_Pickup_Ownership falseif charges should only be retrievable by their owner.Object_Damage fallback:
Object_Damagedefaults toresourceDamage. Set both explicitly if charges deal different damage to harvestable resources vs environmental objects.
Document history
| Version | Date | Author | Notes |
|---|---|---|---|
| 1.0 | 2026-07-28 | 57 Studios | Initial publication. Full charge asset documentation including damage table, unique barricade defaults, charge vs trap comparison, and modding examples. |
