Terminal server item texture, fixed saving/loading of terminal data, fixed coordinate flippery, visually indenting rack mountables one (like it's already in MC 1.8).

This commit is contained in:
Florian Nücke 2015-11-14 20:13:43 +01:00
parent f579524ca6
commit adf4de6838
11 changed files with 40 additions and 11 deletions

Binary file not shown.

View File

@ -117,6 +117,7 @@ item.oc.TabletCase0.name=Tablet Case (Tier 1)
item.oc.TabletCase1.name=Tablet Case (Tier 2)
item.oc.TabletCase3.name=Tablet Case (Creative)
item.oc.Terminal.name=Remote Terminal
item.oc.TerminalServer.name=Terminal Server
item.oc.TexturePicker.name=Texture Picker
item.oc.Transistor.name=Transistor
item.oc.UpgradeAngel.name=Angel Upgrade
@ -345,6 +346,7 @@ oc:tooltip.Switch=Allows connecting different networks to each other. Only netwo
oc:tooltip.Tablet=A tablet computer, for fresh Lua on the go. Can be forced to shut down by sneak-activating it.
oc:tooltip.TabletCase=Basic case for tablets. Place it into the assembler to add in components and create a tablet computer.
oc:tooltip.Terminal=Allows controlling a server remotely, as long as you are in range of it. Acts like a portable screen and keyboard. Shift-right-click a server in a server rack to bind the terminal to it.
oc:tooltip.TerminalServer=Backend to which Remote Terminals can be connected to provide remote control. Houses a virtual screen and keyboard.
oc:tooltip.TexturePicker=This tool allows showing a string describing a block's surface, for use in 3D printer shape definitions. Totally not texture names, nope. No sir.
oc:tooltip.Tier=§8Tier %s
oc:tooltip.NetSplitter=Acts as a dynamic connector. Connectivity of each side can be toggled by hitting it with a wrench. Connectivity of all sides can be inverted by applying a redstone signal.

View File

@ -98,6 +98,11 @@ server3 {
["oc:circuitChip3", "oc:circuitChip3", "oc:circuitChip3"]
[obsidian, "oc:materialCircuitBoardPrinted", obsidian]]
}
terminalServer {
input: [[obsidian, "oc:wlanCard", obsidian]
["oc:wlanCard", "oc:circuitChip2", "oc:wlanCard"]
[obsidian, "oc:materialCircuitBoardPrinted", obsidian]]
}
ram1 {
input: [["oc:circuitChip1", nuggetIron, "oc:circuitChip1"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

View File

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 4
}
}

View File

@ -30,13 +30,13 @@ object Rack {
for (i <- 0 until 4 if rack.getStackInSlot(i) != null) {
side match {
case ForgeDirection.WEST =>
renderer.setRenderBounds(lx, v2 - (i + 1) * fs, lz + u1, u2, v2 - i * fs, hz - u1)
renderer.setRenderBounds(lx + 1 / 16f, v2 - (i + 1) * fs, lz + u1, u2, v2 - i * fs, hz - u1)
case ForgeDirection.EAST =>
renderer.setRenderBounds(u1, v2 - (i + 1) * fs, lz + u1, hx, v2 - i * fs, hz - u1)
renderer.setRenderBounds(u1, v2 - (i + 1) * fs, lz + u1, hx - 1 / 16f, v2 - i * fs, hz - u1)
case ForgeDirection.NORTH =>
renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, lz, hx - u1, v2 - i * fs, u2)
renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, lz + 1 / 16f, hx - u1, v2 - i * fs, u2)
case ForgeDirection.SOUTH =>
renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, u1, hx - u1, v2 - i * fs, hz)
renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, u1, hx - u1, v2 - i * fs, hz - 1 / 16f)
case _ =>
}

View File

@ -30,7 +30,7 @@ object RackRenderer extends TileEntitySpecialRenderer {
case _ => // No yaw.
}
GL11.glTranslated(-0.5, 0.5, 0.505)
GL11.glTranslated(-0.5, 0.5, 0.505 - 1 / 16f)
GL11.glScalef(1, -1, 1)
// Note: we manually sync the rack inventory for this to work.

View File

@ -17,6 +17,7 @@ import li.cil.oc.api.internal.Server
import li.cil.oc.api.machine.MachineHost
import li.cil.oc.client.renderer.PetRenderer
import li.cil.oc.common.asm.ClassTransformer
import li.cil.oc.common.component.TerminalServer
import li.cil.oc.common.item.data.MicrocontrollerData
import li.cil.oc.common.item.data.RobotData
import li.cil.oc.common.item.data.TabletData
@ -373,6 +374,9 @@ object EventHandler {
Callbacks.clear()
}
else {
TerminalServer.loaded.clear()
}
}
@SubscribeEvent
@ -384,7 +388,6 @@ object EventHandler {
case _ => // Dafuq?
}
case rack: Rack =>
// TODO
(0 until rack.getSizeInventory).
map(rack.getMountable).
collect { case server: Server if server.machine != null => server.machine.stop() }

View File

@ -94,9 +94,9 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme
override def world = rack.world
override def yPosition = rack.xPosition
override def xPosition = rack.xPosition
override def xPosition = rack.yPosition
override def yPosition = rack.yPosition
override def zPosition = rack.zPosition
@ -148,6 +148,9 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme
// Persistable
override def load(nbt: NBTTagCompound): Unit = {
if (rack.isServer) {
node.load(nbt)
}
buffer.load(nbt.getCompoundTag(Settings.namespace + "buffer"))
keyboard.load(nbt.getCompoundTag(Settings.namespace + "keyboard"))
keys.clear()
@ -155,6 +158,7 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme
}
override def save(nbt: NBTTagCompound): Unit = {
node.save(nbt)
nbt.setNewCompoundTag(Settings.namespace + "buffer", buffer.save)
nbt.setNewCompoundTag(Settings.namespace + "keyboard", keyboard.save)
nbt.setNewTagList(Settings.namespace + "keys", keys)
@ -187,8 +191,10 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme
// LifeCycle
override def onLifecycleStateChange(state: Lifecycle.LifecycleState): Unit = if (rack.isClient) state match {
case Lifecycle.LifecycleState.Initialized => TerminalServer.loaded += this
case Lifecycle.LifecycleState.Disposed => TerminalServer.loaded -= this
case Lifecycle.LifecycleState.Initialized =>
TerminalServer.loaded += this
case Lifecycle.LifecycleState.Disposed =>
TerminalServer.loaded -= this
case _ => // Ignore.
}
}

View File

@ -92,7 +92,10 @@ class TextBuffer(val host: EnvironmentHost) extends prefab.ManagedEnvironment wi
val data = new util.TextBuffer(maxResolution, PackedColor.Depth.format(maxDepth))
def markInitialized(): Unit = syncCooldown = -1 // Stop polling for init state.
def markInitialized(): Unit = {
syncCooldown = -1 // Stop polling for init state.
relativeLitArea = -1 // Recompute lit area, avoid screens blanking out until something changes.
}
// ----------------------------------------------------------------------- //

View File

@ -165,6 +165,11 @@ class Rack extends traits.PowerAcceptor with traits.Hub with traits.PowerBalance
// ----------------------------------------------------------------------- //
// Environment
override def dispose(): Unit = {
super.dispose()
disconnectComponents()
}
override def onMessage(message: Message): Unit = {
super.onMessage(message)
if (message.name == "network.message") message.data match {