mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 08:50:04 -04:00
buffer mapped elements in cpu list so as to not lose equivalent cpus
closes #1921
This commit is contained in:
parent
aa84a24325
commit
b24e3e6f6b
@ -80,12 +80,17 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Get a list of tables representing the available CPUs in the network.")
|
||||
def getCpus(context: Context, args: Arguments): Array[AnyRef] =
|
||||
result(tile.getProxy.getCrafting.getCpus.map(cpu => Map(
|
||||
"name" -> cpu.getName,
|
||||
"storage" -> cpu.getAvailableStorage,
|
||||
"coprocessors" -> cpu.getCoProcessors,
|
||||
"busy" -> cpu.isBusy)))
|
||||
def getCpus(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val buffer = new mutable.ListBuffer[Map[String, Any]]
|
||||
tile.getProxy.getCrafting.getCpus.foreach(cpu => {
|
||||
buffer.append(Map(
|
||||
"name" -> cpu.getName,
|
||||
"storage" -> cpu.getAvailableStorage,
|
||||
"coprocessors" -> cpu.getCoProcessors,
|
||||
"busy" -> cpu.isBusy))
|
||||
})
|
||||
result(buffer.toArray)
|
||||
}
|
||||
|
||||
@Callback(doc = "function([filter:table]):table -- Get a list of known item recipes. These can be used to issue crafting requests.")
|
||||
def getCraftables(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user