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

◆ ProvideCandidate()

bool Terraria.GameContent.ObjectInteractions.NPCSmartInteractCandidateProvider.ProvideCandidate ( SmartInteractScanSettings settings,
out ISmartInteractCandidate candidate )
inline

Implements Terraria.GameContent.ObjectInteractions.ISmartInteractCandidateProvider.

Definition at line 34 of file NPCSmartInteractCandidateProvider.cs.

35 {
36 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
37 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
38 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
39 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
40 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
41 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
42 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
43 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
44 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
45 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
46 //IL_009d: Unknown result type (might be due to invalid IL or missing references)
47 //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
48 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
49 //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
50 //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
51 //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
52 //IL_00d0: Unknown result type (might be due to invalid IL or missing references)
53 candidate = null;
54 if (!settings.FullInteraction)
55 {
56 return false;
57 }
58 Rectangle value = Utils.CenteredRectangle(settings.player.Center, new Vector2((float)Player.tileRangeX, (float)Player.tileRangeY) * 16f * 2f);
59 Vector2 mousevec = settings.mousevec;
60 mousevec.ToPoint();
61 bool flag = false;
62 int num = -1;
63 float npcDistanceFromCursor = -1f;
64 for (int i = 0; i < 200; i++)
65 {
66 NPC nPC = Main.npc[i];
67 if (!nPC.active || !(NPCLoader.CanChat(nPC) ?? nPC.townNPC))
68 {
69 continue;
70 }
71 Rectangle hitbox = nPC.Hitbox;
72 if (((Rectangle)(ref hitbox)).Intersects(value) && !flag)
73 {
74 float num2 = nPC.Hitbox.Distance(mousevec);
75 if (num == -1 || Main.npc[num].Hitbox.Distance(mousevec) > num2)
76 {
77 num = i;
79 }
80 if (num2 == 0f)
81 {
82 flag = true;
83 num = i;
85 break;
86 }
87 }
88 }
89 if (settings.DemandOnlyZeroDistanceTargets && !flag)
90 {
91 return false;
92 }
93 if (num != -1)
94 {
97 return true;
98 }
99 return false;
100 }
static ? bool CanChat(NPC npc)
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26

References Terraria.GameContent.ObjectInteractions.NPCSmartInteractCandidateProvider._candidate, Terraria.ModLoader.NPCLoader.CanChat(), Terraria.Utils.CenteredRectangle(), Terraria.Main.npc, Terraria.GameContent.ObjectInteractions.NPCSmartInteractCandidateProvider.ReusableCandidate.Reuse(), Terraria.Player.tileRangeX, and Terraria.Player.tileRangeY.

+ Here is the call graph for this function: