From fb2340baa397e9dfc4ac76ce63d2e9990f182066 Mon Sep 17 00:00:00 2001 From: payonel Date: Thu, 14 Nov 2019 00:32:07 -0800 Subject: [PATCH] raids are unlocked managed only devices hard disk drives put in raids are wiped and wiping a disk should reset it to managed and unlocked resolves #2874 --- src/main/scala/li/cil/oc/common/tileentity/Raid.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/scala/li/cil/oc/common/tileentity/Raid.scala b/src/main/scala/li/cil/oc/common/tileentity/Raid.scala index 590a56cea..8486637fa 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Raid.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Raid.scala @@ -10,6 +10,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.server.component.FileSystem import li.cil.oc.server.{PacketSender => ServerPacketSender} @@ -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).