Merge branch 'master-MC1.7.10' into master-MC1.10

This commit is contained in:
payonel 2019-11-14 00:37:43 -08:00
commit 569829ee69

View File

@ -8,6 +8,7 @@ import li.cil.oc.api.Driver
import li.cil.oc.api.fs.Label
import li.cil.oc.api.network.Analyzable
import li.cil.oc.api.network.Visibility
import li.cil.oc.common.item.data.DriveData
import li.cil.oc.common.Slot
import li.cil.oc.common.item.data.NodeData
import li.cil.oc.server.component.FileSystem
@ -79,6 +80,14 @@ class Raid extends traits.Environment with traits.Inventory with traits.Rotatabl
def tryCreateRaid(id: String) {
if (items.count(_.isDefined) == items.length && filesystem.fold(true)(fs => fs.node == null || fs.node.address != id)) {
filesystem.foreach(fs => if (fs.node != null) fs.node.remove())
items.foreach(fs => fs match {
case Some(fsStack) =>
val drive = new DriveData(fsStack)
drive.lockInfo = ""
drive.isUnmanaged = false
drive.save(fsStack)
case _ => // should not happen but is safe to ignore
})
val fs = api.FileSystem.asManagedEnvironment(
api.FileSystem.fromSaveDirectory(id, wipeDisksAndComputeSpace, Settings.get.bufferChanges),
label, this, Settings.resourceDomain + ":hdd_access", 6).