mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
working filesystem (tested: mkdir, open, file:writeLine/close, cp, mv, rm)
Former-commit-id: ce3fcae801291f770ed19dce4616b8ab61556f9b Former-commit-id: 999d637fac1c1c6a9ff855ebb8f7f37336519771
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.virtualcomputer.worldobject
|
||||
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.FixturesBase
|
||||
import net.torvald.terrarum.gameactors.FixtureBase
|
||||
import net.torvald.terrarum.virtualcomputer.terminal.SimpleTextTerminal
|
||||
import net.torvald.terrarum.virtualcomputer.terminal.Terminal
|
||||
import net.torvald.terrarum.virtualcomputer.worldobject.ui.UITextTerminal
|
||||
@@ -11,7 +11,7 @@ import java.util.*
|
||||
/**
|
||||
* Created by minjaesong on 16-09-08.
|
||||
*/
|
||||
class FixturesBasicTerminal(phosphor: Color) : FixturesBase() {
|
||||
class FixtureBasicTerminal(phosphor: Color) : FixtureBase() {
|
||||
|
||||
val vt: Terminal = SimpleTextTerminal(phosphor, 80, 25)
|
||||
val ui = UITextTerminal(vt)
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.virtualcomputer.worldobject
|
||||
|
||||
import net.torvald.terrarum.gameactors.FixturesBase
|
||||
import net.torvald.terrarum.gameactors.FixtureBase
|
||||
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer
|
||||
import net.torvald.terrarum.virtualcomputer.terminal.SimpleTextTerminal
|
||||
import net.torvald.terrarum.virtualcomputer.terminal.Terminal
|
||||
@@ -12,51 +12,30 @@ import java.util.*
|
||||
/**
|
||||
* Created by minjaesong on 16-09-08.
|
||||
*/
|
||||
open class FixturesComputerBase() : FixturesBase() {
|
||||
open class FixtureComputerBase() : FixtureBase() {
|
||||
|
||||
val processorCycle: Int // number of Lua statement to process per tick (1/100 s)
|
||||
get() = ComputerPartsCodex.getProcessorCycles(actorValue.getAsInt("processor") ?: -1)
|
||||
get() = ComputerPartsCodex.getProcessorCycles(computerInside!!.computerValue.getAsInt("processor") ?: -1)
|
||||
val memSize: Int // max: 8 GB
|
||||
get() {
|
||||
var size = 0
|
||||
for (i in 0..3)
|
||||
size += ComputerPartsCodex.getRamSize(actorValue.getAsInt("memSlot$i") ?: -1)
|
||||
size += ComputerPartsCodex.getRamSize(computerInside!!.computerValue.getAsInt("memSlot$i") ?: -1)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
/** Connected terminal */
|
||||
var terminal: FixturesBasicTerminal? = null
|
||||
var terminal: FixtureBasicTerminal? = null
|
||||
|
||||
var computerInside: BaseTerrarumComputer? = null
|
||||
|
||||
init {
|
||||
actorValue["memslot0"] = -1 // -1 indicates mem slot is empty
|
||||
actorValue["memslot1"] = -1 // put index of item here
|
||||
actorValue["memslot2"] = -1 // ditto.
|
||||
actorValue["memslot3"] = -1 // do.
|
||||
// UUID of the "brain"
|
||||
actorValue["computerid"] = "none"
|
||||
|
||||
actorValue["processor"] = -1 // do.
|
||||
|
||||
// as in "dev/hda"; refers hard disk drive (and no partitioning)
|
||||
actorValue["hda"] = "none" // 'UUID rendered as String' or "none"
|
||||
actorValue["hdb"] = "none"
|
||||
actorValue["hdc"] = "none"
|
||||
actorValue["hdd"] = "none"
|
||||
// as in "dev/fd1"; refers floppy disk drive
|
||||
actorValue["fd1"] = "none"
|
||||
actorValue["fd2"] = "none"
|
||||
actorValue["fd3"] = "none"
|
||||
actorValue["fd4"] = "none"
|
||||
// SCSI connected optical drive
|
||||
actorValue["sda"] = "none"
|
||||
|
||||
// UUID of this device
|
||||
actorValue["uuid"] = UUID.randomUUID().toString()
|
||||
|
||||
collisionFlag = COLLISION_PLATFORM
|
||||
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
@@ -66,6 +45,7 @@ open class FixturesComputerBase() : FixturesBase() {
|
||||
fun attachTerminal(uuid: String) {
|
||||
val fetchedTerminal = getTerminalByUUID(uuid)
|
||||
computerInside = BaseTerrarumComputer(fetchedTerminal)
|
||||
actorValue["computerid"] = computerInside!!.UUID
|
||||
}
|
||||
|
||||
fun detatchTerminal() {
|
||||
Reference in New Issue
Block a user