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

◆ CanCatchNPC()

static ? bool Terraria.ModLoader.ItemLoader.CanCatchNPC ( Item item,
NPC target,
Player player )
inlinestatic

Gathers the results of all M:Terraria.ModLoader.GlobalItem.CanCatchNPC(Terraria.Item,Terraria.NPC,Terraria.Player) hooks, then the M:Terraria.ModLoader.ModItem.CanCatchNPC(Terraria.NPC,Terraria.Player) hook if applicable.
If any of them returns false, this returns false.
Otherwise, if any of them returns true, then this returns true.
If all of them return null, this returns null.

Definition at line 1172 of file ItemLoader.cs.

1173 {
1174 bool? canCatchOverall = null;
1175 EntityGlobalsEnumerator<GlobalItem> enumerator = HookCanCatchNPC.Enumerate(item).GetEnumerator();
1176 while (enumerator.MoveNext())
1177 {
1178 bool? canCatchFromGlobalItem = enumerator.Current.CanCatchNPC(item, target, player);
1179 if (canCatchFromGlobalItem.HasValue)
1180 {
1181 if (!canCatchFromGlobalItem.Value)
1182 {
1183 return false;
1184 }
1185 canCatchOverall = true;
1186 }
1187 }
1188 if (item.ModItem != null)
1189 {
1190 bool? canCatchAsModItem = item.ModItem.CanCatchNPC(target, player);
1191 if (canCatchAsModItem.HasValue)
1192 {
1193 if (!canCatchAsModItem.Value)
1194 {
1195 return false;
1196 }
1197 canCatchOverall = true;
1198 }
1199 }
1200 return canCatchOverall;
1201 }
static GlobalHookList< GlobalItem > HookCanCatchNPC

References Terraria.ModLoader.ItemLoader.HookCanCatchNPC, and Terraria.Item.ModItem.

Referenced by Terraria.ModLoader.CombinedHooks.CanCatchNPC().

+ Here is the caller graph for this function: