Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10

This commit is contained in:
Florian Nücke 2014-07-22 03:23:17 +02:00
commit 8140426508
16 changed files with 34 additions and 41 deletions

View File

@ -209,17 +209,13 @@ function filesystem.mounts()
end
local queue = {mtab}
return function()
if #queue == 0 then
return nil
else
while #queue > 0 do
local node = table.remove(queue)
for _, child in pairs(node.children) do
table.insert(queue, child)
end
if node.fs then
return component.proxy(node.fs), path(node)
end
return component.proxy(node.fs) or node.fs, path(node)
end
end
end
@ -269,20 +265,17 @@ function filesystem.umount(fsOrPath)
return true
end
end
local function unmount(address)
local queue = {mtab}
local address = type(fsOrPath) == "table" and fsOrPath.address or fsOrPath
local result = false
for proxy, path in filesystem.mounts() do
if string.sub(proxy.address, 1, address:len()) == address then
local addr = type(proxy) == "table" and proxy.address or proxy
if string.sub(addr, 1, address:len()) == address then
local node, rest, vnode, vrest = findNode(path)
vnode.fs = nil
removeEmptyNodes(vnode)
return true
result = true
end
end
end
local address = type(fsOrPath) == "table" and fsOrPath.address or fsOrPath
local result = false
while unmount(address) do result = true end
return result
end

View File

@ -34,7 +34,7 @@ object PetRenderer {
if (hidden.contains(name) || !entitledPlayers.contains(name)) return
rendering = Some(entitledPlayers(name))
val worldTime = e.entityPlayer.getEntityWorld.getWorldTime
val worldTime = e.entityPlayer.getEntityWorld.getTotalWorldTime
val timeJitter = e.entityPlayer.hashCode ^ 0xFF
val offset = timeJitter + worldTime / 20.0
val hover = (math.sin(timeJitter + (worldTime + e.partialRenderTick) / 20.0) * 0.03).toFloat

View File

@ -69,7 +69,7 @@ class TextBuffer(val owner: Container) extends ManagedComponent with api.compone
override def update() {
super.update()
if (isDisplaying && owner.world.getWorldTime % Settings.get.tickFrequency == 0) {
if (isDisplaying && owner.world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
if (relativeLitArea < 0) {
// The relative lit area is the number of pixels that are not blank
// versus the number of pixels in the *current* resolution. This is
@ -438,7 +438,7 @@ object TextBuffer {
def markDirty() {
dirty = true
lastChange = owner.owner.world.getWorldTime
lastChange = owner.owner.world.getTotalWorldTime
}
def render() = false
@ -483,7 +483,7 @@ object TextBuffer {
class ClientProxy(val owner: TextBuffer) extends Proxy {
override def render() = {
TextBufferRenderCache.render(owner)
lastChange == owner.owner.world.getWorldTime
lastChange == owner.owner.world.getTotalWorldTime
}
override def onScreenColorChange() {

View File

@ -55,7 +55,7 @@ class Case(var tier: Int) extends traits.PowerAcceptor with traits.Computer with
override def canUpdate = isServer
override def updateEntity() {
if (isServer && tier == 3 && world.getWorldTime % Settings.get.tickFrequency == 0) {
if (isServer && tier == 3 && world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
// Creative case, make it generate power.
node.asInstanceOf[Connector].changeBuffer(Double.PositiveInfinity)
}

View File

@ -52,7 +52,7 @@ class Disassembler extends traits.Environment with traits.PowerAcceptor with tra
override def updateEntity() {
super.updateEntity()
if (world.getWorldTime % Settings.get.tickFrequency == 0) {
if (world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
if (queue.isEmpty) {
disassemble(decrStackSize(0, 1))
setActive(queue.nonEmpty)

View File

@ -269,7 +269,7 @@ class Hologram(var tier: Int) extends traits.Environment with SidedEnvironment w
resetDirtyFlag()
}
}
if (world.getWorldTime % Settings.get.tickFrequency == 0) {
if (world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
if (litRatio < 0) this.synchronized {
litRatio = 0
for (i <- 0 until volume.length) {

View File

@ -28,7 +28,7 @@ class MotionSensor extends traits.Environment {
override def updateEntity() {
super.updateEntity()
if (world.getWorldTime % 10 == 0) {
if (world.getTotalWorldTime % 10 == 0) {
// Get a list of all living entities we could possibly detect, using a rough
// bounding box check, then refining it using the actual distance and an
// actual visibility check.

View File

@ -265,7 +265,7 @@ class Robot extends traits.Computer with traits.PowerInformation with api.machin
}
super.updateEntity()
if (isServer) {
if (world.getWorldTime % Settings.get.tickFrequency == 0) {
if (world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
if (info.tier == 3) {
bot.node.changeBuffer(Double.PositiveInfinity)
}

View File

@ -97,7 +97,7 @@ class RobotAssembler extends traits.Environment with traits.PowerAcceptor with t
override def updateEntity() {
super.updateEntity()
if (robot.isDefined && world.getWorldTime % Settings.get.tickFrequency == 0) {
if (robot.isDefined && world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
val want = math.max(1, math.min(requiredEnergy, Settings.get.assemblerTickAmount * Settings.get.tickFrequency))
val success = node.tryChangeBuffer(-want)
if (success) {

View File

@ -72,7 +72,7 @@ trait Hub extends traits.Environment with SidedEnvironment {
relayCooldown = relayDelay
}
}
else if (world.getWorldTime % relayDelay == 0) {
else if (world.getTotalWorldTime % relayDelay == 0) {
packetsPerCycleAvg += 0
}
}

View File

@ -11,7 +11,7 @@ trait PowerBalancer extends PowerInformation with SidedEnvironment {
override def updateEntity() {
super.updateEntity()
if (isServer && isConnected && world.getWorldTime % Settings.get.tickFrequency == 0) {
if (isServer && isConnected && world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
val nodes = connectors
def network(connector: Connector) = if (connector != null && connector.network != null) connector.network else this
// Yeeeeah, so that just happened... it's not a beauty, but it works. This

View File

@ -28,7 +28,7 @@ trait TileEntity extends net.minecraft.tileentity.TileEntity {
override def updateEntity() {
super.updateEntity()
if (world.getWorldTime % 40 == 0 && block.getLightValue(world, x, y, z) > 0) {
if (world.getTotalWorldTime % 40 == 0 && block.getLightValue(world, x, y, z) > 0) {
world.markBlockForUpdate(x, y, z)
}
}

View File

@ -16,7 +16,7 @@ trait BuildCraft extends Common with IPowerReceptor {
override def updateEntity() {
super.updateEntity()
if (useBuildCraftPower && world.getWorldTime % Settings.get.tickFrequency == 0) {
if (useBuildCraftPower && world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
for (side <- ForgeDirection.VALID_DIRECTIONS) {
val demand = (globalBufferSize(side) - globalBuffer(side)) / Settings.ratioBuildCraft
if (demand > 1) {

View File

@ -20,7 +20,7 @@ class UpgradeChunkloader(val owner: Container) extends component.ManagedComponen
override def update() {
super.update()
if (owner.world.getWorldTime % Settings.get.tickFrequency == 0 && ticket.isDefined) {
if (owner.world.getTotalWorldTime % Settings.get.tickFrequency == 0 && ticket.isDefined) {
if (!node.tryChangeBuffer(-Settings.get.chunkloaderCost * Settings.get.tickFrequency)) {
ticket.foreach(ForgeChunkManager.releaseTicket)
ticket = None

View File

@ -72,7 +72,7 @@ class WirelessNetworkCard(val owner: Container) extends NetworkCard with Wireles
override def update() {
super.update()
if (world.getWorldTime % 20 == 0) {
if (world.getTotalWorldTime % 20 == 0) {
api.Network.updateWirelessNetwork(this)
}
}

View File

@ -354,7 +354,7 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
callCounts.synchronized(if (callCounts.size > 0) callCounts.clear())
// Make sure we have enough power.
if (worldTime % Settings.get.tickFrequency == 0) {
if (owner.world.getTotalWorldTime % Settings.get.tickFrequency == 0) {
state.synchronized(state.top match {
case Machine.State.Paused |
Machine.State.Restarting |
@ -372,7 +372,7 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
}
// Avoid spamming user list across the network.
if (worldTime % 20 == 0 && usersChanged) {
if (owner.world.getTotalWorldTime % 20 == 0 && usersChanged) {
val list = _users.synchronized {
usersChanged = false
users