Should fix potential leakage of drones.

Cleaned up robot name list a bit.
This commit is contained in:
Florian Nücke 2015-04-17 13:08:33 +02:00
parent effe8ebea1
commit 15f5609a0e
3 changed files with 33 additions and 11 deletions

View File

@ -5,8 +5,10 @@
# Names of more or less famous robots and AIs, are welcome. Feel free to add # Names of more or less famous robots and AIs, are welcome. Feel free to add
# more via pull requests. Let's hope this won't get us sued... # more via pull requests. Let's hope this won't get us sued...
# When adding names, please keep the list sorted alphabetially, make sure it's # When adding names, please keep the list sorted alphabetically, make sure it's
# not already in the list, and, where appropriate, provide a concise source. # not already in the list, and, where appropriate, provide a concise source.
# And since we now also have that special case, ignore special characters when
# sorting.
Adventure Core # Portal Adventure Core # Portal
Anson Argyris # Perry Rhodan Anson Argyris # Perry Rhodan
@ -27,13 +29,13 @@ Claptrap # Borderlands
Crypto # Kodos Crypto # Kodos
Daedalus # Deus Ex Daedalus # Deus Ex
Dalek Sec # Doctor Who Dalek Sec # Doctor Who
Deputy ANDY # Eureka
Death Trap # Borderlands 2's Mechromancer Death Trap # Borderlands 2's Mechromancer
Deputy ANDY # Eureka
Dog # Half-Life Dog # Half-Life
Donald Duck # Perry Rhodan Donald Duck # Perry Rhodan
Elmer # One of the first two robots developed by William Gray Walter. Elmer # One of the first two robots developed by William Gray Walter.
Elsie # One of the first two robots developed by William Gray Walter. Elsie # One of the first two robots developed by William Gray Walter.
Emilia # Digital: A Love Story *Emilia # Digital: A Love Story
Eve # Wall-E Eve # Wall-E
Fact Core # Portal Fact Core # Portal
Flexo # Futurama Flexo # Futurama
@ -43,11 +45,11 @@ HAL 9000 # Space Odyssey
Harkness # Fallout 3 Harkness # Fallout 3
Heron # Vexatos Heron # Vexatos
Homunk # Perry Rhodan Homunk # Perry Rhodan
Hyun-ae # Analogue: A Hate Story / Hate Plus *Hyun-ae # Analogue: A Hate Story / Hate Plus
Icarus # Deus Ex Icarus # Deus Ex
J.A.R.V.I.S # Iron Man J.A.R.V.I.S # Iron Man
JoshTheEnder # Contributor
Johnny 5 # Short Circuit Johnny 5 # Short Circuit
JoshTheEnder # Contributor
K-9 # Doctor Who K-9 # Doctor Who
KARR # Knight Rider KARR # Knight Rider
Kilobyte # Contributor Kilobyte # Contributor
@ -58,13 +60,13 @@ Loader 1340 # Borderlands 2
LordFokas # Contributor LordFokas # Contributor
Marvin # Hitchhiker's Guide to the Galaxy Marvin # Hitchhiker's Guide to the Galaxy
Michiyo # Contributor Michiyo # Contributor
Mute # Analogue: A Hate Story / Hate Plus *Mute # Analogue: A Hate Story / Hate Plus
P-Body # Portal P-Body # Portal
PixelToast # Contributor PixelToast # Contributor
QT-1 # I, Robot QT-1 # I, Robot
R2-D2 # Star Wars
R. Daneel Olivaw # Isaac Asimov's R. Daneel Olivaw # Isaac Asimov's
R. Giskard Reventlov # Isaac Asimov's R. Giskard Reventlov # Isaac Asimov's
R2-D2 # Star Wars
Replicator # Stargate Replicator # Stargate
Robby # Forbidden Planet Robby # Forbidden Planet
Roomba # Under your couch... wait. Roomba # Under your couch... wait.

View File

@ -12,6 +12,7 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent
import li.cil.oc._ import li.cil.oc._
import li.cil.oc.api.Network import li.cil.oc.api.Network
import li.cil.oc.api.detail.ItemInfo import li.cil.oc.api.detail.ItemInfo
import li.cil.oc.api.machine.MachineHost
import li.cil.oc.client.renderer.PetRenderer import li.cil.oc.client.renderer.PetRenderer
import li.cil.oc.client.{PacketSender => ClientPacketSender} import li.cil.oc.client.{PacketSender => ClientPacketSender}
import li.cil.oc.common.asm.ClassTransformer import li.cil.oc.common.asm.ClassTransformer
@ -39,6 +40,7 @@ import net.minecraftforge.common.util.FakePlayer
import net.minecraftforge.common.util.ForgeDirection import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.event.entity.EntityJoinWorldEvent
import net.minecraftforge.event.world.BlockEvent import net.minecraftforge.event.world.BlockEvent
import net.minecraftforge.event.world.ChunkEvent
import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.event.world.WorldEvent
import scala.collection.convert.WrapAsScala._ import scala.collection.convert.WrapAsScala._
@ -140,9 +142,14 @@ object EventHandler {
else if (robot.world != null) robot.machine.update() else if (robot.world != null) robot.machine.update()
}) })
runningRobots --= invalid runningRobots --= invalid
}
else if (e.phase == TickEvent.Phase.END) {
// Clean up machines *after* a tick, to allow stuff to be saved, first.
val closed = mutable.ArrayBuffer.empty[Machine] val closed = mutable.ArrayBuffer.empty[Machine]
machines.foreach(machine => if (machine.tryClose()) closed += machine) machines.foreach(machine => if (machine.tryClose()) {
closed += machine
if (machine.node != null) machine.node.remove()
})
machines --= closed machines --= closed
} }
@ -341,10 +348,23 @@ object EventHandler {
@SubscribeEvent @SubscribeEvent
def onWorldUnload(e: WorldEvent.Unload) { def onWorldUnload(e: WorldEvent.Unload) {
if (!e.world.isRemote) { if (!e.world.isRemote) {
import scala.collection.convert.WrapAsScala._
e.world.loadedTileEntityList.collect { e.world.loadedTileEntityList.collect {
case te: tileentity.traits.TileEntity => te.dispose() case te: tileentity.traits.TileEntity => te.dispose()
} }
e.world.loadedEntityList.collect {
case host: MachineHost => host.machine.stop()
}
}
}
@SubscribeEvent
def onChunkUnload(e: ChunkEvent.Unload): Unit = {
if (!e.world.isRemote) {
e.getChunk.entityLists.foreach(_.collect {
case host: MachineHost => host.machine match {
case machine: Machine => scheduleClose(machine)
}
})
} }
} }
} }

View File

@ -91,7 +91,7 @@ class WirelessNetworkCard(host: EnvironmentHost) extends NetworkCard(host) with
override def onDisconnect(node: Node) { override def onDisconnect(node: Node) {
super.onDisconnect(node) super.onDisconnect(node)
if (node == this.node) { if (node == this.node || !world.blockExists(x, y, z)) {
api.Network.leaveWirelessNetwork(this) api.Network.leaveWirelessNetwork(this)
} }
} }