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

◆ UpdateChestFrames()

static void Terraria.Chest.UpdateChestFrames ( )
inlinestatic

Definition at line 3540 of file Chest.cs.

3541 {
3542 int num = 8000;
3543 _chestInUse.Clear();
3544 for (int i = 0; i < 255; i++)
3545 {
3546 if (Main.player[i].active && Main.player[i].chest >= 0 && Main.player[i].chest < num)
3547 {
3548 _chestInUse.Add(Main.player[i].chest);
3549 }
3550 }
3551 Chest chest = null;
3552 for (int j = 0; j < num; j++)
3553 {
3554 chest = Main.chest[j];
3555 if (chest != null)
3556 {
3557 if (_chestInUse.Contains(j))
3558 {
3559 chest.frameCounter++;
3560 }
3561 else
3562 {
3563 chest.frameCounter--;
3564 }
3565 if (chest.eatingAnimationTime == 9 && chest.frame == 1)
3566 {
3567 SoundEngine.PlaySound(7, new Vector2(chest.x * 16 + 16, chest.y * 16 + 16));
3568 }
3569 if (chest.eatingAnimationTime > 0)
3570 {
3571 chest.eatingAnimationTime--;
3572 }
3573 if (chest.frameCounter < chest.eatingAnimationTime)
3574 {
3575 chest.frameCounter = chest.eatingAnimationTime;
3576 }
3577 if (chest.frameCounter < 0)
3578 {
3579 chest.frameCounter = 0;
3580 }
3581 if (chest.frameCounter > 10)
3582 {
3583 chest.frameCounter = 10;
3584 }
3585 if (chest.frameCounter == 0)
3586 {
3587 chest.frame = 0;
3588 }
3589 else if (chest.frameCounter == 10)
3590 {
3591 chest.frame = 2;
3592 }
3593 else
3594 {
3595 chest.frame = 1;
3596 }
3597 }
3598 }
3599 }
static void PlaySound(int type, Vector2 position, int style=1)
Chest(bool bank=false)
Definition Chest.cs:59
static HashSet< int > _chestInUse
Definition Chest.cs:57

References Terraria.Chest._chestInUse, Terraria.Main.chest, Terraria.Chest.eatingAnimationTime, Terraria.Chest.frame, Terraria.Chest.frameCounter, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Chest.x, and Terraria.Chest.y.

Referenced by Terraria.Main.DoUpdateInWorld().