OnFireworkDamage
OnFireworkDamage is called from BaseFirework.OnAttacked after the hit has been applied to the firework, before Rust decides whether to light the fuse for heat damage. Returning a non-null value skips the fuse-lighting step.
object OnFireworkDamage(BaseFirework firework, HitInfo info)Parameters
| Parameter | Type | Description |
|---|---|---|
firework | BaseFirework | The BaseFirework entity that was hit. Use it to read position, OwnerID, net.ID or to kill/destroy it. |
info | HitInfo | The HitInfo for the attack. Check info.damageTypes (heat, bullet, explosion) and info.Initiator / info.InitiatorPlayer to know the source. |
Return value
Return null to let vanilla behavior continue: a hit containing heat damage calls StaggeredTryLightFuse() and arms the firework. Return any non-null value (for example false) to skip that lighting step entirely; the damage has already been applied either way.
How it works
The hook fires once per attack on a deployed firework, inside BaseFirework.OnAttacked. The base damage handling has already run at this point, so firework.Health() already reflects the hit. The parameter you will use most is info.damageTypes: the vanilla code only lights the fuse when the hit includes DamageType.Heat, so a torch or a burning tool will arm the firework while bullets usually just damage it. You can also read info.InitiatorPlayer to find who is attacking; it is null for non-player sources such as turrets, fire or explosions.
Returning a non-null value makes Oxide skip the StaggeredTryLightFuse() call, so the firework survives the heat hit without being ignited. Return null to keep vanilla behavior. Because the hook is checked only for the fuse step, returning a value changes nothing about the damage itself. If you want to prevent the firework from being armed at all, return false for heat hits, or destroy the entity outright when you want it gone.
Example plugin: Prevent fireworks from being lit by heat damage
using System;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("No Heat Ignite Fireworks", "RustPluginGenerator", "1.0.0")]
[Description("Blocks heat damage from lighting the fuse on fireworks unless the attacker is permitted.")]
public class NoHeatIgniteFireworks : RustPlugin
{
private const string PermAllow = "noheatignitefireworks.allow";
private PluginConfig config;
private class PluginConfig
{
[JsonProperty("Block heat ignition for unpermitted players")]
public bool BlockHeatIgnition = true;
[JsonProperty("Block ignition by non-player heat sources")]
public bool BlockEnvironmentalHeat = true;
}
protected override void LoadDefaultConfig() => config = new PluginConfig();
protected override void LoadConfig()
{
base.LoadConfig();
try
{
config = Config.ReadObject<PluginConfig>();
if (config == null) throw new Exception();
}
catch
{
PrintWarning("Configuration file is invalid, using defaults");
LoadDefaultConfig();
}
SaveConfig();
}
protected override void SaveConfig() => Config.WriteObject(config);
private void Init()
{
permission.RegisterPermission(PermAllow, this);
}
private object OnFireworkDamage(BaseFirework firework, HitInfo info)
{
if (!config.BlockHeatIgnition || firework == null || info == null)
return null;
if (info.damageTypes == null || info.damageTypes.GetMajorityDamageType() != Rust.DamageType.Heat)
return null;
BasePlayer attacker = info.InitiatorPlayer;
if (attacker != null)
{
if (!attacker.IsNpc && permission.UserHasPermission(attacker.UserIDString, PermAllow))
return null;
return false;
}
return config.BlockEnvironmentalHeat ? (object)false : null;
}
}
}The plugin lets admins block firework ignition by heat damage, so spam or accidental torch handling does not trigger a firework. OnFireworkDamage checks whether info.damageTypes.GetMajorityDamageType() is Rust.DamageType.Heat; when the attacker is a non-NPC player without noheatignitefireworks.allow, it returns false and the ignition is blocked. Because any non-null return blocks the ignition, false is enough to stop it. The permission noheatignitefireworks.allow is registered in Init. Heat sources with no InitiatorPlayer are blocked when BlockEnvironmentalHeat is enabled. A config flag, BlockHeatIgnition, gives admins a master switch for the whole feature.
Common use cases
Stop griefers from igniting stored fireworks
Block ignition when a player without a permission torches a firework in a base, keeping the firework intact until it is manually lit.
Log whoever arms a firework
Read info.InitiatorPlayer in the hook and record the name and position, then return null so the fuse still lights.
Disable fireworks entirely on a server
Return false for all hits and optionally kill the entity inside the hook so that fireworks placed on the map cannot be used.
Pitfalls
Damage already applied
By the time OnFireworkDamage fires, BaseFirework.OnAttacked has run the base damage, so health is already reduced. Returning false only stops the fuse, it does not prevent the hit.
InitiatorPlayer is often null
Non-player sources (fire, turrets, explosions) have no InitiatorPlayer. Always null-check before using a permission or chat message.
The hook is only reached on the server firework
The injection is guarded by base.isServer, so client-side copies do not call it. Do not rely on it for anything other than server-side logic.
Build a plugin with OnFireworkDamage
Describe what should happen and get a compiled plugin that uses this hook.
Edit the prompt on the next screen. 2 free plugins a month, no card.
Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.
Build a plugin with OnFireworkDamage
Generate