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

◆ HitSwitch()

static void Terraria.Wiring.HitSwitch ( int i,
int j )
inlinestatic

Definition at line 237 of file Wiring.cs.

238 {
239 if (!WorldGen.InWorld(i, j) || Main.tile[i, j] == null)
240 {
241 return;
242 }
243 if (Main.tile[i, j].type == 135 || Main.tile[i, j].type == 314 || Main.tile[i, j].type == 423 || Main.tile[i, j].type == 428 || Main.tile[i, j].type == 442 || Main.tile[i, j].type == 476)
244 {
245 SoundEngine.PlaySound(28, i * 16, j * 16, 0);
246 TripWire(i, j, 1, 1);
247 }
248 else if (Main.tile[i, j].type == 440)
249 {
250 SoundEngine.PlaySound(28, i * 16 + 16, j * 16 + 16, 0);
251 TripWire(i, j, 3, 3);
252 }
253 else if (Main.tile[i, j].type == 136)
254 {
255 if (Main.tile[i, j].frameY == 0)
256 {
257 Main.tile[i, j].frameY = 18;
258 }
259 else
260 {
261 Main.tile[i, j].frameY = 0;
262 }
263 SoundEngine.PlaySound(28, i * 16, j * 16, 0);
264 TripWire(i, j, 1, 1);
265 }
266 else if (Main.tile[i, j].type == 443)
267 {
268 GeyserTrap(i, j);
269 }
270 else if (Main.tile[i, j].type == 144)
271 {
272 if (Main.tile[i, j].frameY == 0)
273 {
274 Main.tile[i, j].frameY = 18;
275 if (Main.netMode != 1)
276 {
277 CheckMech(i, j, 18000);
278 }
279 }
280 else
281 {
282 Main.tile[i, j].frameY = 0;
283 }
284 SoundEngine.PlaySound(28, i * 16, j * 16, 0);
285 }
286 else if (Main.tile[i, j].type == 441 || Main.tile[i, j].type == 468)
287 {
288 int num = Main.tile[i, j].frameX / 18 * -1;
289 int num2 = Main.tile[i, j].frameY / 18 * -1;
290 num %= 4;
291 if (num < -1)
292 {
293 num += 2;
294 }
295 num += i;
296 num2 += j;
297 SoundEngine.PlaySound(28, i * 16, j * 16, 0);
298 TripWire(num, num2, 2, 2);
299 }
300 else if (Main.tile[i, j].type == 467)
301 {
302 if (Main.tile[i, j].frameX / 36 == 4)
303 {
304 int num3 = Main.tile[i, j].frameX / 18 * -1;
305 int num4 = Main.tile[i, j].frameY / 18 * -1;
306 num3 %= 4;
307 if (num3 < -1)
308 {
309 num3 += 2;
310 }
311 num3 += i;
312 num4 += j;
313 SoundEngine.PlaySound(28, i * 16, j * 16, 0);
314 TripWire(num3, num4, 2, 2);
315 }
316 }
317 else
318 {
319 if (Main.tile[i, j].type != 132 && Main.tile[i, j].type != 411)
320 {
321 return;
322 }
323 short num5 = 36;
324 int num6 = Main.tile[i, j].frameX / 18 * -1;
325 int num7 = Main.tile[i, j].frameY / 18 * -1;
326 num6 %= 4;
327 if (num6 < -1)
328 {
329 num6 += 2;
330 num5 = -36;
331 }
332 num6 += i;
333 num7 += j;
334 if (Main.netMode != 1 && Main.tile[num6, num7].type == 411)
335 {
336 CheckMech(num6, num7, 60);
337 }
338 for (int k = num6; k < num6 + 2; k++)
339 {
340 for (int l = num7; l < num7 + 2; l++)
341 {
342 if (Main.tile[k, l].type == 132 || Main.tile[k, l].type == 411)
343 {
344 Main.tile[k, l].frameX += num5;
345 }
346 }
347 }
348 WorldGen.TileFrame(num6, num7);
349 SoundEngine.PlaySound(28, i * 16, j * 16, 0);
350 TripWire(num6, num7, 2, 2);
351 }
352 }
static void PlaySound(int type, Vector2 position, int style=1)
static bool CheckMech(int i, int j, int time)
Definition Wiring.cs:429
static void TripWire(int left, int top, int width, int height)
Definition Wiring.cs:499
static void GeyserTrap(int i, int j)
Definition Wiring.cs:2744

References Terraria.Wiring.CheckMech(), Terraria.Wiring.GeyserTrap(), Terraria.WorldGen.InWorld(), Terraria.Main.netMode, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.tile, Terraria.WorldGen.TileFrame(), and Terraria.Wiring.TripWire().

Referenced by Terraria.MessageBuffer.GetData(), Terraria.Minecart.HitTrackSwitch(), Terraria.Wiring.HitWireSingle(), Terraria.GameContent.Tile_Entities.TELogicSensor.Kill(), Terraria.GameContent.PressurePlateHelper.PokeLocation(), Terraria.GameContent.Golf.GolfHelper.ContactListener.PutBallInCup(), Terraria.WorldGen.ReplaceTIle_DoActualReplacement(), Terraria.Collision.SwitchTiles(), Terraria.Player.TileInteractionsUse(), Terraria.WorldGen.ToggleGemLock(), Terraria.Player.TryLandingOnDetonator(), and Terraria.GameContent.Tile_Entities.TELogicSensor.UpdateEndInternal().