private static void sendHackData(Packet p, HackingBlock b) { try { p.writeInt((int)b.state); p.writeLong(b.targetID); p.writeFloat(b.targetDifficulty); p.writeInt(b.targetTime); p.writeInt(b.cyclesUntilAttempt); p.writeBoolean(b.isIdle); } catch (Exception e) { IO.log("Threw exception while dispatching hacking packet: " + e.ToString()); } }
private static void handleHackingPacket(Packet p, IMyEntity entity) { try { HackingBlock logic = entity.GameLogic.GetAs <HackingBlock>(); if (logic != null) { logic.state = (HackingBlock.States)p.readInt(); logic.targetID = p.readLong(); logic.targetDifficulty = p.readFloat(); logic.targetTime = p.readInt(); logic.cyclesUntilAttempt = p.readInt(); logic.isIdle = p.readBoolean(); logic.updateRender(); } else { IO.log("Hacking computer logic did not exist on client to process sync packet!"); } } catch (Exception e) { IO.log("Threw exception while handling hacking packet: " + e.ToString()); } }