defaulting strength on wireless cards to max, because it's way too likely to forget setting the strength; also returning foreground and background color from gpu.get

This commit is contained in:
Florian Nücke 2014-01-21 21:22:28 +01:00
parent 53e96153f0
commit 1ec08922b4
2 changed files with 12 additions and 3 deletions

View File

@ -145,7 +145,14 @@ abstract class GraphicsCard extends ManagedComponent {
def get(context: Context, args: Arguments): Array[AnyRef] = {
val x = args.checkInteger(0) - 1
val y = args.checkInteger(1) - 1
screen(s => result(s.get(x, y)))
screen(s => {
val char = s.get(x, y)
val color = s.color(y)(x)
val depth = s.depth
val foreground = PackedColor.unpackForeground(color, depth)
val background = PackedColor.unpackBackground(color, depth)
result(char, foreground, background)
})
}
def set(context: Context, args: Arguments): Array[AnyRef] = {

View File

@ -15,7 +15,7 @@ class WirelessNetworkCard(val owner: TileEntity) extends NetworkCard {
withConnector().
create()
var strength = 0.0
var strength = Settings.get.maxWirelessRange
// ----------------------------------------------------------------------- //
@ -95,7 +95,9 @@ class WirelessNetworkCard(val owner: TileEntity) extends NetworkCard {
override def load(nbt: NBTTagCompound) {
super.load(nbt)
strength = nbt.getDouble("strength") max 0 min Settings.get.maxWirelessRange
if (nbt.hasKey("strength")) {
strength = nbt.getDouble("strength") max 0 min Settings.get.maxWirelessRange
}
}
override def save(nbt: NBTTagCompound) {