Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local term = require("term")
- local holo = component.hologram
- local energyCell = component.tile_thermalexpansion_cell_resonant_name
- local h = 0
- holo.clear()
- holo.setScale(0.33)
- holo.setPaletteColor(1,0x00ff00)
- holo.setPaletteColor(2,0xffff00)
- holo.setPaletteColor(3,0xff0000)
- local barSize = 16
- function anzeigeBalken(t, w, ti, wi, h)
- local absHoehe = h * 32
- local color = 1
- if h < 0.2 then
- color = 3
- elseif h < 0.75 then
- color = 2
- end
- for i = t, t + ti do
- for j = w, w + wi do
- holo.fill(i, j, 0, absHoehe, color)
- end
- end
- end
- while true do
- local energy = energyCell.getEnergyStored()
- local maxEnergy = energyCell.getMaxEnergyStored()
- h = energy / maxEnergy
- print(h.." = "..energy.." / "..maxEnergy)
- anzeigeBalken(0, 0, barSize, 1 ,1)
- anzeigeBalken(0, 1, barSize, barSize - 1, h)
- os.sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment