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

◆ TryGetCausingEntity()

bool Terraria.DataStructures.PlayerDeathReason.TryGetCausingEntity ( out Entity entity)
inline

Definition at line 36 of file PlayerDeathReason.cs.

37 {
38 entity = null;
39 if (Main.npc.IndexInRange(_sourceNPCIndex))
40 {
41 entity = Main.npc[_sourceNPCIndex];
42 return true;
43 }
44 if (Main.projectile.IndexInRange(_sourceProjectileLocalIndex))
45 {
46 entity = Main.projectile[_sourceProjectileLocalIndex];
47 return true;
48 }
49 if (Main.player.IndexInRange(_sourcePlayerIndex))
50 {
51 entity = Main.player[_sourcePlayerIndex];
52 return true;
53 }
54 return false;
55 }

References Terraria.DataStructures.PlayerDeathReason._sourceNPCIndex, Terraria.DataStructures.PlayerDeathReason._sourcePlayerIndex, Terraria.DataStructures.PlayerDeathReason._sourceProjectileLocalIndex, Terraria.Main.npc, Terraria.Main.player, and Terraria.Main.projectile.