mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 04:06:43 -04:00
Merge branch 'master-MC1.8.9' of github.com:MightyPirates/OpenComputers into master-MC1.9.4
This commit is contained in:
commit
c5989952fc
@ -857,7 +857,9 @@ sandbox = {
|
||||
min = math.min,
|
||||
modf = math.modf,
|
||||
pi = math.pi,
|
||||
pow = math.pow,
|
||||
pow = math.pow or function(a, b) -- Deprecated in Lua 5.3
|
||||
return a^b
|
||||
end,
|
||||
rad = math.rad,
|
||||
random = function(...)
|
||||
return spcall(math.random, ...)
|
||||
|
@ -262,16 +262,23 @@ private class Network private(private val data: mutable.Map[String, Network.Vert
|
||||
val node = vertex.data
|
||||
val neighbors = vertex.edges.map(_.other(vertex).data).toArray
|
||||
|
||||
var newAddress = ""
|
||||
do {
|
||||
newAddress = java.util.UUID.randomUUID().toString
|
||||
} while (data.contains(newAddress) || otherNetwork.data.contains(newAddress))
|
||||
|
||||
// This may lead to splits, which is the whole reason we have to
|
||||
// check the network of the other nodes after the readdressing.
|
||||
node.remove()
|
||||
|
||||
do {
|
||||
node.address = java.util.UUID.randomUUID().toString
|
||||
} while (data.contains(node.address) || otherNetwork.data.contains(node.address))
|
||||
|
||||
node.address = newAddress
|
||||
Network.joinNewNetwork(node)
|
||||
|
||||
if (node.address == newAddress) {
|
||||
neighbors.filter(_.network != null).foreach(_.connect(node))
|
||||
} else {
|
||||
OpenComputers.log.error("I can't see this happening any other way than someone directly setting node addresses, which they shouldn't. So yeah. Shit'll be borked. Deal with it.")
|
||||
node.remove() // well screw you then
|
||||
}
|
||||
})
|
||||
|
||||
duplicates.head.data.network.asInstanceOf[Network.Wrapper].network
|
||||
|
Loading…
x
Reference in New Issue
Block a user