Skip to content

Commit

Permalink
inventory size sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Baldie-dev committed Apr 16, 2021
1 parent a1c831e commit 254d3d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NebulaModel/Packets/Players/PlayerTechBonuses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class PlayerTechBonuses : INetSerializable
int droneCount { get; set; }
float droneSpeed { get; set; }
int droneMovement { get; set; }
int inventorySize { get; set; }

public PlayerTechBonuses() { }

Expand Down Expand Up @@ -59,6 +60,7 @@ public PlayerTechBonuses(Mecha source)
this.droneCount = source.droneCount;
this.droneSpeed = source.droneSpeed;
this.droneMovement = source.droneMovement;
this.inventorySize = source.player.package.size;
}

public void UpdateMech(Mecha destination)
Expand Down Expand Up @@ -88,6 +90,10 @@ public void UpdateMech(Mecha destination)
destination.droneCount = this.droneCount;
destination.droneSpeed = this.droneSpeed;
destination.droneMovement = this.droneMovement;
if (this.inventorySize > destination.player.package.size)
{
destination.player.package.SetSize(this.inventorySize);
}
}

public void Serialize(NetDataWriter writer)
Expand Down Expand Up @@ -117,6 +123,7 @@ public void Serialize(NetDataWriter writer)
writer.Put(droneCount);
writer.Put(droneSpeed);
writer.Put(droneMovement);
writer.Put(inventorySize);
}

public void Deserialize(NetDataReader reader)
Expand Down Expand Up @@ -146,6 +153,7 @@ public void Deserialize(NetDataReader reader)
droneCount = reader.GetInt();
droneSpeed = reader.GetFloat();
droneMovement = reader.GetInt();
inventorySize = reader.GetInt();
}
}
}

0 comments on commit 254d3d8

Please sign in to comment.