Example #1
0
        public override bool NewRightClick(int i, int j)
        {
            Main.mouseRightRelease = false;
            Point16 extractorPos = TEPosition(i, j);
            ChlorophyteExtractorTE extractorTE = mod.GetTileEntity <ChlorophyteExtractorTE>(extractorPos);

            if (extractorTE == null)
            {
                return(false);
            }

            Player       player       = Main.LocalPlayer;
            GadgetPlayer gadgetPlayer = player.Gadget();

            player.CloseVanillaUIs();
            if (GadgetBox.Instance.reforgeMachineInterface.CurrentState != null)
            {
                GadgetBox.Instance.reforgeMachineInterface.SetState(null);
            }

            if (extractorTE.CurrentPlayer == player.whoAmI)
            {
                extractorTE.CloseUI();
            }
            else
            {
                extractorTE.CurrentPlayer = (byte)player.whoAmI;
                gadgetPlayer.machinePos   = extractorPos;
                extractorTE.OpenUI();
            }

            return(true);
        }
Example #2
0
        public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
        {
            ChlorophyteExtractorTE extractorTE = mod.GetTileEntity <ChlorophyteExtractorTE>(TEPosition(i, j));

            if (extractorTE == null)
            {
                return;
            }

            if (extractorTE.Animating && !extractorTE.IsWorking && (Main.tileFrame[TileID.Extractinator] - extractorTE.FrameYOffset + 10) % 10 == 0)
            {
                extractorTE.Animating    = false;
                extractorTE.FrameYOffset = 0;
            }
            else if (!extractorTE.Animating && extractorTE.IsWorking)
            {
                extractorTE.Animating    = true;
                extractorTE.FrameYOffset = (byte)Main.tileFrame[TileID.Extractinator];
            }
            frameYOffset = !extractorTE.Animating ? 0 : (Main.tileFrame[TileID.Extractinator] - extractorTE.FrameYOffset + 10) % 10 * animationFrameHeight;
        }