2026-03-28 09:59:31 +01:00
|
|
|
|
using LiteNetLib.Utils;
|
2025-12-19 17:54:50 +01:00
|
|
|
|
|
|
|
|
|
|
namespace PacketLib;
|
|
|
|
|
|
|
2026-03-28 09:59:31 +01:00
|
|
|
|
public struct PlayerState(int pid, int camera, bool[] doorStates, int power, bool poweredOut) : INetSerializable {
|
|
|
|
|
|
public int Pid = pid;
|
|
|
|
|
|
public int Camera = camera;
|
|
|
|
|
|
public bool MonitorUp;
|
2025-12-19 17:54:50 +01:00
|
|
|
|
|
2026-03-28 09:59:31 +01:00
|
|
|
|
public int OfficeTileId;
|
|
|
|
|
|
public bool[] DoorStates = doorStates;
|
|
|
|
|
|
public int[] NeighbouringTiles = []; // the indexes should correspond in both arrays
|
|
|
|
|
|
|
|
|
|
|
|
public int Power = power;
|
|
|
|
|
|
public bool PoweredOut = poweredOut;
|
2026-01-25 11:16:54 +01:00
|
|
|
|
|
2025-12-19 17:54:50 +01:00
|
|
|
|
public void Serialize(NetDataWriter writer) {
|
2026-03-28 09:59:31 +01:00
|
|
|
|
writer.Put(Pid);
|
|
|
|
|
|
writer.Put(Camera);
|
|
|
|
|
|
writer.Put(MonitorUp);
|
|
|
|
|
|
writer.PutArray(DoorStates);
|
|
|
|
|
|
writer.Put(OfficeTileId);
|
|
|
|
|
|
writer.PutArray(NeighbouringTiles);
|
|
|
|
|
|
writer.Put(Power);
|
|
|
|
|
|
writer.Put(PoweredOut);
|
2025-12-19 17:54:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Deserialize(NetDataReader reader) {
|
2026-03-28 09:59:31 +01:00
|
|
|
|
Pid = reader.GetInt();
|
|
|
|
|
|
Camera = reader.GetInt();
|
|
|
|
|
|
MonitorUp = reader.GetBool();
|
|
|
|
|
|
DoorStates = reader.GetBoolArray();
|
|
|
|
|
|
OfficeTileId = reader.GetInt();
|
|
|
|
|
|
NeighbouringTiles = reader.GetIntArray();
|
|
|
|
|
|
Power = reader.GetInt();
|
|
|
|
|
|
PoweredOut = reader.GetBool();
|
2025-12-19 17:54:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|