Made blank screens not draw power.

This actually reduces the energy cost for screens, but realizing that computers and robots don't actually draw as fast as the config suggests (because they idle most of the time) this is for the better I think.
This commit is contained in:
Florian Nücke 2014-04-02 20:15:04 +02:00
parent 1acdd5f8ae
commit a715a21226
2 changed files with 10 additions and 11 deletions

View File

@ -471,15 +471,14 @@ opencomputers {
# The amount of energy a screen consumes per tick. For each lit pixel
# (each character that is not blank) this cost increases linearly:
# for basic screens, if all pixels are lit the cost per tick will be
# twice as high as this value. Higher tier screens can become even
# more expensive to run, due to their higher resolution. If a screen
# cannot consume the defined amount of energy it will stop rendering
# the text that should be displayed on it. It will *not* forget that
# text, however, so when enough power is available again it will
# restore the previously displayed text (with any changes possibly
# made in the meantime). Note that for multi-block screens *each*
# screen that is part of it will consume this amount of energy per
# tick.
# this value. Higher tier screens can become even more expensive to
# run, due to their higher resolution. If a screen cannot consume the
# defined amount of energy it will stop rendering the text that
# should be displayed on it. It will *not* forget that text, however,
# so when enough power is available again it will restore the
# previously displayed text (with any changes possibly made in the
# meantime). Note that for multi-block screens *each* screen that is
# part of it will consume this amount of energy per tick.
screen: 0.05
# The amount of energy a hologram projetor consumes per tick. This

View File

@ -208,9 +208,9 @@ class Screen(var tier: Int) extends traits.TextBuffer with SidedEnvironment with
// The relative lit area is the number of pixels that are not blank
// versus the number of pixels in the *current* resolution. This is
// scaled to multi-block screens, since we only compute this for the
// origin. We add 1 to make sure we at least consume `screenCost`.
// origin.
val (w, h) = buffer.resolution
relativeLitArea = 1 + width * height * buffer.lines.foldLeft(0) {
relativeLitArea = width * height * buffer.lines.foldLeft(0) {
(acc, line) => acc + line.count(' ' !=)
} / (w * h).toDouble
}