2025-12-19 17:54:50 +01:00
|
|
|
|
using LiteNetLib;
|
|
|
|
|
|
using LiteNetLib.Utils;
|
|
|
|
|
|
|
|
|
|
|
|
namespace PacketLib;
|
|
|
|
|
|
|
2026-03-12 22:33:35 +01:00
|
|
|
|
public struct PlayerState : INetSerializable { // TODO: make a constructor
|
2026-01-25 11:16:54 +01:00
|
|
|
|
public int pid;
|
2025-12-19 17:54:50 +01:00
|
|
|
|
public int camera;
|
|
|
|
|
|
public bool monitorUp;
|
|
|
|
|
|
|
2026-03-08 16:55:49 +01:00
|
|
|
|
public int officeTileId;
|
2026-01-25 11:16:54 +01:00
|
|
|
|
public bool[] doorStates;
|
2026-03-08 16:55:49 +01:00
|
|
|
|
public int[] neighbouringTiles; // the indexes should correspond in both arrays
|
2026-01-25 11:16:54 +01:00
|
|
|
|
|
2026-03-12 22:33:35 +01:00
|
|
|
|
public int power;
|
|
|
|
|
|
public bool poweredOut;
|
|
|
|
|
|
|
2025-12-19 17:54:50 +01:00
|
|
|
|
public void Serialize(NetDataWriter writer) {
|
|
|
|
|
|
writer.Put(pid);
|
|
|
|
|
|
writer.Put(camera);
|
|
|
|
|
|
writer.Put(monitorUp);
|
2026-01-25 11:16:54 +01:00
|
|
|
|
writer.PutArray(doorStates);
|
2026-03-08 16:55:49 +01:00
|
|
|
|
writer.Put(officeTileId);
|
|
|
|
|
|
writer.PutArray(neighbouringTiles);
|
2026-03-12 22:33:35 +01:00
|
|
|
|
writer.Put(power);
|
|
|
|
|
|
writer.Put(poweredOut);
|
2025-12-19 17:54:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Deserialize(NetDataReader reader) {
|
2026-01-25 11:16:54 +01:00
|
|
|
|
pid = reader.GetInt();
|
2025-12-19 17:54:50 +01:00
|
|
|
|
camera = reader.GetInt();
|
|
|
|
|
|
monitorUp = reader.GetBool();
|
2026-01-25 11:16:54 +01:00
|
|
|
|
doorStates = reader.GetBoolArray();
|
2026-03-08 16:55:49 +01:00
|
|
|
|
officeTileId = reader.GetInt();
|
|
|
|
|
|
neighbouringTiles = reader.GetIntArray();
|
2026-03-12 22:33:35 +01:00
|
|
|
|
power = reader.GetInt();
|
|
|
|
|
|
poweredOut = reader.GetBool();
|
2025-12-19 17:54:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|