mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
tinting robots based on their level; including distance of zero in normal network messages to have a uniform signal signature
This commit is contained in:
parent
eee27e49de
commit
d0e97e8d4b
Binary file not shown.
Before Width: | Height: | Size: 935 B After Width: | Height: | Size: 926 B |
@ -132,7 +132,9 @@ class PacketHandler extends CommonPacketHandler {
|
||||
|
||||
def onRobotXp(p: PacketParser) =
|
||||
p.readTileEntity[RobotProxy]() match {
|
||||
case Some(t) => t.robot.xp = p.readDouble()
|
||||
case Some(t) =>
|
||||
t.robot.xp = p.readDouble()
|
||||
t.robot.updateXpInfo()
|
||||
case _ => // Invalid packet.
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
compileList()
|
||||
|
||||
def renderChassis(isRunning: Boolean = false, offset: Double = 0) {
|
||||
def renderChassis(isRunning: Boolean = false, level: Int = 0, offset: Double = 0) {
|
||||
val size = 0.3f
|
||||
val l = 0.5f - size
|
||||
val h = 0.5f + size
|
||||
@ -114,6 +114,15 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
bindTexture(texture)
|
||||
if (level > 19) {
|
||||
GL11.glColor3f(0.4f, 1, 1)
|
||||
}
|
||||
else if (level > 9) {
|
||||
GL11.glColor3f(1, 1, 0.4f)
|
||||
}
|
||||
else {
|
||||
GL11.glColor3f(0.5f, 0.5f, 0.5f)
|
||||
}
|
||||
if (!isRunning) {
|
||||
GL11.glTranslatef(0, -2 * gap, 0)
|
||||
}
|
||||
@ -122,6 +131,7 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(0, 2 * gap, 0)
|
||||
}
|
||||
GL11.glCallList(displayList + 1)
|
||||
GL11.glColor3f(1, 1, 1)
|
||||
|
||||
if (MinecraftForgeClient.getRenderPass == 0) {
|
||||
RenderState.disableLighting()
|
||||
@ -202,7 +212,7 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
if (MinecraftForgeClient.getRenderPass == 0) {
|
||||
val offset = timeJitter + worldTime / 20.0
|
||||
renderChassis(robot.isRunning, offset)
|
||||
renderChassis(robot.isRunning, robot.level, offset)
|
||||
}
|
||||
|
||||
robot.equippedItem match {
|
||||
|
@ -98,7 +98,9 @@ class Robot(isRemote: Boolean) extends Computer(isRemote) with ISidedInventory w
|
||||
// xp(level) = base + (level * const) ^ exp
|
||||
// pow(xp(level) - base, 1/exp) / const = level
|
||||
level = (Math.pow(xp - Settings.get.baseXpToLevel, 1 / Settings.get.exponentialXpGrowth) / Settings.get.constantXpGrowth).toInt min 30
|
||||
battery.setLocalBufferSize(Settings.get.bufferRobot + Settings.get.bufferPerLevel * level)
|
||||
if (battery != null) {
|
||||
battery.setLocalBufferSize(Settings.get.bufferRobot + Settings.get.bufferPerLevel * level)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
@ -337,6 +339,7 @@ class Robot(isRemote: Boolean) extends Computer(isRemote) with ISidedInventory w
|
||||
equippedItem = Option(ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("equipped")))
|
||||
}
|
||||
xp = nbt.getDouble(Settings.namespace + "xp")
|
||||
updateXpInfo()
|
||||
animationTicksTotal = nbt.getInteger("animationTicksTotal")
|
||||
animationTicksLeft = nbt.getInteger("animationTicksLeft")
|
||||
moveFromX = nbt.getInteger("moveFromX")
|
||||
|
@ -49,7 +49,7 @@ abstract class GraphicsCard extends ManagedComponent {
|
||||
def bind(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val address = args.checkString(0)
|
||||
node.network.node(address) match {
|
||||
case null => Array(Unit, "invalid address")
|
||||
case null => result(false, "invalid address")
|
||||
case node: Node if node.host.isInstanceOf[Buffer] =>
|
||||
screenAddress = Option(address)
|
||||
screenInstance = Some(node.host.asInstanceOf[Buffer])
|
||||
@ -62,7 +62,7 @@ abstract class GraphicsCard extends ManagedComponent {
|
||||
s.background = 0x000000
|
||||
result(true)
|
||||
})
|
||||
case _ => Array(Unit, "not a screen")
|
||||
case _ => result(false, "not a screen")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class NetworkCard extends ManagedComponent {
|
||||
openPorts.clear()
|
||||
if (message.name == "network.message") message.data match {
|
||||
case Array(port: Integer, args@_*) if openPorts.contains(port) =>
|
||||
node.sendToReachable("computer.signal", Seq("modem_message", message.source.address, Int.box(port)) ++ args: _*)
|
||||
node.sendToReachable("computer.signal", Seq("modem_message", message.source.address, Int.box(port), Int.box(0)) ++ args: _*)
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user