TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ OnHurt()

static void Terraria.ModLoader.PlayerLoader.OnHurt ( Player player,
Player::HurtInfo info )
inlinestatic

Definition at line 1040 of file PlayerLoader.cs.

1041 {
1042 if (info.DamageSource.TryGetCausingEntity(out var sourceEntity))
1043 {
1044 Entity entity = sourceEntity;
1045 if (!(entity is Projectile proj))
1046 {
1047 if (!(entity is NPC npc))
1048 {
1049 if (entity is Player sourcePlayer)
1050 {
1051 Item item = info.DamageSource.SourceItem;
1052 if (item != null && info.PvP)
1053 {
1054 ItemLoader.OnHitPvp(item, sourcePlayer, player, info);
1055 }
1056 }
1057 }
1058 else if (player == Main.LocalPlayer)
1059 {
1060 CombinedHooks.OnHitByNPC(player, npc, in info);
1061 }
1062 }
1063 else if (player == Main.LocalPlayer)
1064 {
1065 CombinedHooks.OnHitByProjectile(player, proj, in info);
1066 }
1067 }
1068 FilteredSpanEnumerator<ModPlayer> enumerator = HookHurt.Enumerate(player).GetEnumerator();
1069 while (enumerator.MoveNext())
1070 {
1071 enumerator.Current.OnHurt(info);
1072 }
1073 }
static HookList< ModPlayer > HookHurt

References Terraria.ModLoader.PlayerLoader.HookHurt, Terraria.Main.LocalPlayer, Terraria.ModLoader.CombinedHooks.OnHitByNPC(), Terraria.ModLoader.CombinedHooks.OnHitByProjectile(), and Terraria.ModLoader.ItemLoader.OnHitPvp().

Referenced by Terraria.Player.Hurt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: