fixed the worst oversight of mankind
This commit is contained in:
@@ -67,7 +67,7 @@ class RelayEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceBlock
|
||||
override fun received(message: Networking.Message) {
|
||||
super.received(message)
|
||||
if(message.sender == this) return
|
||||
if(message is Networking.ClassicPacket && message.hopCount <= 5 && queue.size < computeRelayCapacity()) {
|
||||
if(message is Networking.ClassicPacket && message.hopCount < 5 && queue.size < computeRelayCapacity()) {
|
||||
queue.addLast(message)
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class RelayEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceBlock
|
||||
if(connection is ConventionalNetworkDevice) {
|
||||
connection.sendClassicPacket(hopped)
|
||||
} else {
|
||||
Networking.emitMessage(connection, hopped)
|
||||
Networking.emitMessage(connection, hopped, setOf(deviceNode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,13 @@ class CaseBlockEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun received(message: Networking.Message) {
|
||||
super.received(message)
|
||||
if(message is Networking.ClassicPacket) {
|
||||
NeoComputers.LOGGER.info("machine $address got $message")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val redstoneIn = Array(Direction.entries.size) {0}
|
||||
@@ -170,6 +177,7 @@ class CaseBlockEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceB
|
||||
}
|
||||
// Server-side stuff!!
|
||||
sendMachineEvent(MachinePowerEvent(this, isOn))
|
||||
Networking.emitMessage(deviceNode, Networking.ClassicPacket(deviceNode, deviceNode.address.toString(), "fuck you", 1, listOf(), 0))
|
||||
}
|
||||
|
||||
override fun start(): Boolean {
|
||||
|
||||
@@ -50,8 +50,8 @@ object Networking {
|
||||
|
||||
// node may differ from message.sender in the case of relays,
|
||||
// as they might have DIRECT reachability but
|
||||
fun emitMessage(deviceNode: DeviceNode, message: Message) {
|
||||
deviceNode.getReachable().forEach { it.received(message) }
|
||||
fun emitMessage(deviceNode: DeviceNode, message: Message, exclude: Set<DeviceNode> = setOf()) {
|
||||
deviceNode.getReachable().forEach { if(it !in exclude) it.received(message) }
|
||||
}
|
||||
|
||||
fun computeRangeAllowedByHardness(src: BlockPos, dst: BlockPos): Double {
|
||||
|
||||
Reference in New Issue
Block a user