Unstable 0.1300.0.8

This commit is contained in:
Markus Isberg
2021-04-09 15:07:09 +03:00
parent 538c3dbfc3
commit 29bd4d6f49
38 changed files with 162 additions and 76 deletions
@@ -8,7 +8,10 @@ namespace Barotrauma.Items.Components
public override void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
{
base.ServerWrite(msg, c, extraData);
if (!attachable || body == null) { return; }
bool writeAttachData = attachable && body != null;
msg.Write(writeAttachData);
if (!writeAttachData) { return; }
msg.Write(Attached);
msg.Write(body.SimPosition.X);
@@ -269,6 +269,7 @@ namespace Barotrauma
msg.Write(body == null ? (byte)0 : (byte)body.BodyType);
msg.Write(SpawnedInOutpost);
msg.Write(AllowStealing);
byte teamID = 0;
foreach (WifiComponent wifiComponent in GetComponents<WifiComponent>())
@@ -3752,11 +3752,11 @@ namespace Barotrauma.Networking
private Client FindClientWithJobPreference(List<Client> clients, JobPrefab job, bool forceAssign = false)
{
int bestPreference = 0;
int bestPreference = int.MaxValue;
Client preferredClient = null;
foreach (Client c in clients)
{
if (c.Karma < job.MinKarma) { continue; }
if (ServerSettings.KarmaEnabled && c.Karma < job.MinKarma) { continue; }
int index = c.JobPreferences.IndexOf(c.JobPreferences.Find(j => j.First == job));
if (index > -1 && index < bestPreference)
{
@@ -18,10 +18,17 @@ namespace Barotrauma.Networking
if (!c.InGame) { continue; }
if (c.SpectateOnly && (GameMain.Server.ServerSettings.AllowSpectating || GameMain.Server.OwnerConnection == c.Connection)) { continue; }
if (c.Character != null && !c.Character.IsDead) { continue; }
//don't allow respawn if the client already has a character (they'll regain control once they're in sync)
var matchingData = campaign?.GetClientCharacterData(c);
if (matchingData != null && matchingData.HasSpawned &&
Character.CharacterList.Any(c => c.Info == matchingData.CharacterInfo && !c.IsDead))
{
continue;
}
if (UseRespawnPrompt)
{
var matchingData = campaign?.GetClientCharacterData(c);
if (matchingData != null && matchingData.HasSpawned)
{
if (!c.WaitForNextRoundRespawn.HasValue || c.WaitForNextRoundRespawn.Value) { continue; }