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

◆ Lock()

static bool Terraria.Chest.Lock ( int X,
int Y )
inlinestatic

Definition at line 461 of file Chest.cs.

462 {
463 if (Main.tile[X, Y] == null || Main.tile[X + 1, Y] == null || Main.tile[X, Y + 1] == null || Main.tile[X + 1, Y + 1] == null)
464 {
465 return false;
466 }
467 short num = 0;
468 Tile tileSafely = Framing.GetTileSafely(X, Y);
469 int type = tileSafely.type;
470 int num2 = tileSafely.frameX / 36;
471 switch (type)
472 {
473 case 21:
474 switch (num2)
475 {
476 case 1:
477 num = 36;
478 break;
479 case 3:
480 num = 36;
481 break;
482 case 18:
483 case 19:
484 case 20:
485 case 21:
486 case 22:
487 if (!NPC.downedPlantBoss)
488 {
489 return false;
490 }
491 num = 180;
492 break;
493 case 35:
494 case 37:
495 case 39:
496 num = 36;
497 break;
498 default:
499 return false;
500 }
501 break;
502 case 467:
503 if (num2 == 12)
504 {
505 if (!NPC.downedPlantBoss)
506 {
507 return false;
508 }
509 num = 36;
511 break;
512 }
513 return false;
514 }
515 SoundEngine.PlaySound(22, X * 16, Y * 16);
516 for (int i = X; i <= X + 1; i++)
517 {
518 for (int j = Y; j <= Y + 1; j++)
519 {
520 Tile tileSafely2 = Framing.GetTileSafely(i, j);
521 if (tileSafely2.type == type)
522 {
523 tileSafely2.frameX += num;
524 Main.tile[i, j] = tileSafely2;
525 }
526 }
527 }
528 return true;
529 }
static void PlaySound(int type, Vector2 position, int style=1)

References Terraria.NPC.downedPlantBoss, Terraria.Framing.GetTileSafely(), Terraria.GameContent.Achievements.AchievementsHelper.NotifyProgressionEvent(), Terraria.Audio.SoundEngine.PlaySound(), and Terraria.Main.tile.

Referenced by Terraria.MessageBuffer.GetData(), and Terraria.Player.PlaceThing_LockChest().