Garry's Mod Wiki

Revision Difference

util.BlastDamage#568531

<function name="BlastDamage" parent="util" type="libraryfunc"> <description> Applies explosion damage to all entities in the specified radius. Performs line-of-sight checking. This a simpler version of <page>util.BlastDamageInfo</page> <note>This function will not deal damage to the ``Hunter-Chopper`` type NPC. To deal damage, use the <page>util.BlastDamageInfo</page> function and add <page text="DMG_AIRBOAT">Enums/DMG#DMG_AIRBOAT</page> to the damage type.</note> </description> <realm>Server</realm> <args> <arg name="inflictor" type="Entity">The entity that caused the damage.</arg> <arg name="attacker" type="Entity">The entity that attacked.</arg> <arg name="damageOrigin" type="Vector">The center of the explosion</arg> <arg name="damageRadius" type="number">The radius in which entities will be damaged.</arg> <arg name="damage" type="number">The amount of damage to be applied.</arg> <arg name="damageType" type="number{DMG}"> <note>Added on November 2, 2026, but not included in any release.</note> Override the damage type </arg> </args> </function> ⤶ ⤶ <example>⤶ <description>Allow the ``Hunter-Chooper`` to take damage from explosions.</description>⤶ <code>⤶ local target = ents.FindByClass("npc_helicopter")[1]⤶ if not target then return end⤶ util.BlastDamage( Entity(1), target, target:GetPos(), 200, 200, bit.bor( DMG_BLAST, DMG_AIRBOAT ))⤶ </code>⤶ </example>⤶