Api Sandbox DamageInfo
class

DamageInfo

public class DamageInfo

Describes the damage that should be done to something. This is purposefully a class so it can be derived from, allowing games to create their own special types of damage, while not having to create a whole new system.

Constructors

DamageInfo()
DamageInfo(Single damage, GameObject attacker, GameObject weapon)
DamageInfo(Single damage, GameObject attacker, GameObject weapon, Hitbox hitbox)

Properties

Name Type Description
Attacker GameObject Usually a player or Npc
Weapon GameObject The weapon that did the damage, or a vehicle etc
Hitbox Hitbox The hitbox that we hit (if any)
Damage Single Amount of damage this should do
Origin Vector3 The origin of the damage. For bullets this would be the shooter's eye position. For explosions, this would be the center of the exposion.
Position Vector3 The location of the damage on the hit object.
Shape PhysicsShape The physics shape that we hit (if any)
Tags TagSet Tags for this damage, allows you to enter and read different damage types etc
IsExplosion Boolean True if this is explosive damage
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.DamageInfo