TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
Searches.cs
Go to the documentation of this file.
1using Microsoft.Xna.Framework;
2
4
5public static class Searches
6{
7 public class Left : GenSearch
8 {
9 private int _maxDistance;
10
11 public Left(int maxDistance)
12 {
14 }
15
16 public override Point Find(Point origin)
17 {
18 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
19 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
20 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
21 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
22 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
23 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
24 for (int i = 0; i < _maxDistance; i++)
25 {
26 if (Check(origin.X - i, origin.Y))
27 {
28 return new Point(origin.X - i, origin.Y);
29 }
30 }
31 return GenSearch.NOT_FOUND;
32 }
33 }
34
35 public class Right : GenSearch
36 {
37 private int _maxDistance;
38
39 public Right(int maxDistance)
40 {
42 }
43
44 public override Point Find(Point origin)
45 {
46 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
47 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
48 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
49 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
50 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
51 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
52 for (int i = 0; i < _maxDistance; i++)
53 {
54 if (Check(origin.X + i, origin.Y))
55 {
56 return new Point(origin.X + i, origin.Y);
57 }
58 }
59 return GenSearch.NOT_FOUND;
60 }
61 }
62
63 public class Down : GenSearch
64 {
65 private int _maxDistance;
66
67 public Down(int maxDistance)
68 {
70 }
71
72 public override Point Find(Point origin)
73 {
74 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
75 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
76 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
77 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
78 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
79 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
80 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
81 for (int i = 0; i < _maxDistance && origin.Y + i < Main.maxTilesY; i++)
82 {
83 if (Check(origin.X, origin.Y + i))
84 {
85 return new Point(origin.X, origin.Y + i);
86 }
87 }
88 return GenSearch.NOT_FOUND;
89 }
90 }
91
92 public class Up : GenSearch
93 {
94 private int _maxDistance;
95
96 public Up(int maxDistance)
97 {
99 }
100
101 public override Point Find(Point origin)
102 {
103 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
104 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
105 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
106 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
107 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
108 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
109 for (int i = 0; i < _maxDistance; i++)
110 {
111 if (Check(origin.X, origin.Y - i))
112 {
113 return new Point(origin.X, origin.Y - i);
114 }
115 }
116 return GenSearch.NOT_FOUND;
117 }
118 }
119
120 public class Rectangle : GenSearch
121 {
122 private int _width;
123
124 private int _height;
125
126 public Rectangle(int width, int height)
127 {
128 _width = width;
129 _height = height;
130 }
131
132 public override Point Find(Point origin)
133 {
134 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
135 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
136 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
137 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
138 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
139 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
140 for (int i = 0; i < _width; i++)
141 {
142 for (int j = 0; j < _height; j++)
143 {
144 if (Check(origin.X + i, origin.Y + j))
145 {
146 return new Point(origin.X + i, origin.Y + j);
147 }
148 }
149 }
150 return GenSearch.NOT_FOUND;
151 }
152 }
153
154 public static GenSearch Chain(GenSearch search, params GenCondition[] conditions)
155 {
156 return search.Conditions(conditions);
157 }
158}
static int maxTilesY
The height of the currently-loaded world in tiles.
Definition Main.cs:1191
override Point Find(Point origin)
Definition Searches.cs:72
override Point Find(Point origin)
Definition Searches.cs:16
override Point Find(Point origin)
Definition Searches.cs:132
override Point Find(Point origin)
Definition Searches.cs:44
override Point Find(Point origin)
Definition Searches.cs:101
static GenSearch Chain(GenSearch search, params GenCondition[] conditions)
Definition Searches.cs:154