tModLoader v2024.10
A mod to make and play Terraria mods
EntitySource_OnHit Class Reference

Use the interface, IEntitySource_OnHit instead when checking entity sources in OnSpawn

More...

Inherits EntitySource_Parent, and IEntitySource_OnHit.

Public Member Functions

 EntitySource_OnHit (Entity attacker, Entity victim, string? context=null)
 
- Public Member Functions inherited from EntitySource_Parent
 EntitySource_Parent (Entity entity, string? context=null)
 

Properties

Entity Attacker [get]
 The attacking entity. Note that this may be a Projectile (possibly owned by a player), a Player or even a NPC More...
 
Entity Victim [get]
 The entity being attacked. Normally an NPC, but could be an Player if a mod decides to use this source in such a way More...
 
- Properties inherited from EntitySource_Parent
string? Context [get]
 Additional context identifier, particularly useful for set bonuses or accessory affects. See ItemSourceID and ProjectileSourceID for vanilla uses More...
 
Entity Entity [get]
 The entity which is the source of the effect or action. In many cases, it makes sense to consider buffs or effects applied to the parent entity, and make changes to the spawned entity.
 
- Properties inherited from IEntitySource
string? Context [get]
 Additional context identifier, particularly useful for set bonuses or accessory affects. See ItemSourceID and ProjectileSourceID for vanilla uses More...
 
- Properties inherited from IEntitySource_OnHit
Entity Attacker [get]
 The attacking entity. Note that this may be a Projectile (possibly owned by a player), a Player or even a NPC More...
 
Entity Victim [get]
 The entity being attacked. Normally an NPC, but could be an Player if a mod decides to use this source in such a way More...
 

Detailed Description

Use the interface, IEntitySource_OnHit instead when checking entity sources in OnSpawn

Recommend setting IEntitySource.Context to indicate the effect. Many vanilla set bonuses or accessories use this source.

Property Documentation

◆ Attacker

Entity EntitySource_OnHit.Attacker
get

The attacking entity. Note that this may be a Projectile (possibly owned by a player), a Player or even a NPC

Implements IEntitySource_OnHit.

◆ Victim

Entity EntitySource_OnHit.Victim
get

The entity being attacked. Normally an NPC, but could be an Player if a mod decides to use this source in such a way

Implements IEntitySource_OnHit.