Esempio n. 1
0
        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            int ID = mod.GetID <TEQETank>(i, j);

            if (ID == -1)
            {
                return(false);
            }

            Tile tile = Main.tile[i, j];

            if (tile.TopLeft())
            {
                Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);
                if (Main.drawToScreen)
                {
                    zero = Vector2.Zero;
                }
                Vector2 position = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero;

                TEQETank qeTank = (TEQETank)TileEntity.ByID[ID];
                ModFluid fluid  = qeTank.GetFluid();

                if (fluid != null)
                {
                    spriteBatch.Draw(ModLoader.GetTexture(FluidLoader.GetFluid(fluid.Name).Texture), new Rectangle((int)position.X + 6, (int)(position.Y + 6 + (20 - 20 * (fluid.volume / (float)TEQETank.MaxVolume))), 20, (int)(20 * (fluid.volume / (float)TEQETank.MaxVolume))), null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0f);
                }
            }

            return(true);
        }
Esempio n. 2
0
        public void AddFluid(string fluid, int volume = 1, int tanks = -1)
        {
            ModFluid modFluid = FluidLoader.GetFluid(fluid).NewInstance();

            modFluid.volume = volume;
            if (tanks == -1)
            {
                requiredFluids.Add(modFluid);
            }
            else
            {
                requiredFluids[tanks] = modFluid;
            }
        }