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

◆ GetState()

static bool Terraria.GameContent.Tile_Entities.TELogicSensor.GetState ( int x,
int y,
LogicCheckType type,
TELogicSensor instance = null )
inlinestatic

Definition at line 226 of file TELogicSensor.cs.

227 {
228 switch (type)
229 {
230 case LogicCheckType.Day:
231 return Main.dayTime;
232 case LogicCheckType.Night:
233 return !Main.dayTime;
234 case LogicCheckType.PlayerAbove:
235 {
236 bool result = false;
237 Rectangle value = new Rectangle(x * 16 - 32 - 1, y * 16 - 160 - 1, 82, 162);
239 {
240 if (item.Value.Intersects(value))
241 {
242 result = true;
243 break;
244 }
245 }
246 return result;
247 }
248 case LogicCheckType.Water:
249 case LogicCheckType.Lava:
250 case LogicCheckType.Honey:
251 case LogicCheckType.Liquid:
252 {
253 if (instance == null)
254 {
255 return false;
256 }
257 Tile tile = Main.tile[x, y];
258 bool flag = true;
259 if (tile == null || tile.liquid == 0)
260 {
261 flag = false;
262 }
263 if (!tile.lava() && type == LogicCheckType.Lava)
264 {
265 flag = false;
266 }
267 if (!tile.honey() && type == LogicCheckType.Honey)
268 {
269 flag = false;
270 }
271 if ((tile.honey() || tile.lava()) && type == LogicCheckType.Water)
272 {
273 flag = false;
274 }
275 if (!flag && instance.On)
276 {
277 if (instance.CountedData == 0)
278 {
279 instance.CountedData = 15;
280 }
281 else if (instance.CountedData > 0)
282 {
283 instance.CountedData--;
284 }
285 flag = instance.CountedData > 0;
286 }
287 return flag;
288 }
289 default:
290 return false;
291 }
292 }
static Dictionary< int, Rectangle > playerBox

References Terraria.Main.dayTime, Terraria.Tile.honey(), System.item, Terraria.Tile.lava(), Terraria.Tile.liquid, Terraria.GameContent.Tile_Entities.TELogicSensor.playerBox, Terraria.Main.tile, Terraria.DataStructures.TileEntity.type, and System.value.

Referenced by Terraria.GameContent.Tile_Entities.TELogicSensor.FigureCheckType(), and Terraria.GameContent.Tile_Entities.TELogicSensor.Update().