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

◆ UpdateChestFrames()

static void Terraria.Chest.UpdateChestFrames ( )
inlinestatic

Visually updates all chests' frames.
Chests that are being used (M:Terraria.Chest.GetCurrentlyOpenChests) or eating an item (F:Terraria.Chest.eatingAnimationTime) will not be opened.

Definition at line 3900 of file Chest.cs.

3901 {
3902 //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
3903 int num = 8000;
3904 _chestInUse.Clear();
3905 for (int i = 0; i < 255; i++)
3906 {
3907 if (Main.player[i].active && Main.player[i].chest >= 0 && Main.player[i].chest < num)
3908 {
3909 _chestInUse.Add(Main.player[i].chest);
3910 }
3911 }
3912 Chest chest = null;
3913 for (int j = 0; j < num; j++)
3914 {
3915 chest = Main.chest[j];
3916 if (chest != null)
3917 {
3918 if (_chestInUse.Contains(j))
3919 {
3920 chest.frameCounter++;
3921 }
3922 else
3923 {
3924 chest.frameCounter--;
3925 }
3926 if (chest.eatingAnimationTime == 9 && chest.frame == 1)
3927 {
3928 SoundEngine.PlaySound(7, new Vector2((float)(chest.x * 16 + 16), (float)(chest.y * 16 + 16)));
3929 }
3930 if (chest.eatingAnimationTime > 0)
3931 {
3932 chest.eatingAnimationTime--;
3933 }
3934 if (chest.frameCounter < chest.eatingAnimationTime)
3935 {
3936 chest.frameCounter = chest.eatingAnimationTime;
3937 }
3938 if (chest.frameCounter < 0)
3939 {
3940 chest.frameCounter = 0;
3941 }
3942 if (chest.frameCounter > 10)
3943 {
3944 chest.frameCounter = 10;
3945 }
3946 if (chest.frameCounter == 0)
3947 {
3948 chest.frame = 0;
3949 }
3950 else if (chest.frameCounter == 10)
3951 {
3952 chest.frame = 2;
3953 }
3954 else
3955 {
3956 chest.frame = 1;
3957 }
3958 }
3959 }
3960 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
Chest(bool bank=false)
Create a new T:Terraria.Chest with no name.
Definition Chest.cs:137
static HashSet< int > _chestInUse
Definition Chest.cs:132

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: