fixed the worst oversight of mankind

This commit is contained in:
2026-04-28 21:34:18 +03:00
parent 9a733e0a81
commit 86b3486622
3 changed files with 12 additions and 4 deletions

View File

@@ -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))
}
}
}

View File

@@ -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 {

View File

@@ -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 {