Oprava spawnování monster, optimalizace v CommandProcessor a EventProcessor. Přesunutí některých tříd do vlastních namespaců, pročištění kódu, úpravy formátování, odstranění nepoužívaných souborů a zakomentovaného kódu

This commit is contained in:
Perry 2026-03-28 09:59:31 +01:00
parent e5d746d597
commit 243f071a43
62 changed files with 873 additions and 1217 deletions

View file

@ -1,40 +1,39 @@
using LiteNetLib;
using LiteNetLib.Utils;
using LiteNetLib.Utils;
namespace PacketLib;
public struct PlayerState : INetSerializable { // TODO: make a constructor
public int pid;
public int camera;
public bool monitorUp;
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;
public int officeTileId;
public bool[] doorStates;
public int[] neighbouringTiles; // the indexes should correspond in both arrays
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;
public int power;
public bool poweredOut;
public void Serialize(NetDataWriter writer) {
writer.Put(pid);
writer.Put(camera);
writer.Put(monitorUp);
writer.PutArray(doorStates);
writer.Put(officeTileId);
writer.PutArray(neighbouringTiles);
writer.Put(power);
writer.Put(poweredOut);
writer.Put(Pid);
writer.Put(Camera);
writer.Put(MonitorUp);
writer.PutArray(DoorStates);
writer.Put(OfficeTileId);
writer.PutArray(NeighbouringTiles);
writer.Put(Power);
writer.Put(PoweredOut);
}
public void Deserialize(NetDataReader reader) {
pid = reader.GetInt();
camera = reader.GetInt();
monitorUp = reader.GetBool();
doorStates = reader.GetBoolArray();
officeTileId = reader.GetInt();
neighbouringTiles = reader.GetIntArray();
power = reader.GetInt();
poweredOut = reader.GetBool();
Pid = reader.GetInt();
Camera = reader.GetInt();
MonitorUp = reader.GetBool();
DoorStates = reader.GetBoolArray();
OfficeTileId = reader.GetInt();
NeighbouringTiles = reader.GetIntArray();
Power = reader.GetInt();
PoweredOut = reader.GetBool();
}
}