Faction Test v1.0.1.0

This commit is contained in:
Regalis11
2023-02-16 15:01:28 +02:00
parent caa5a2f762
commit 2c5a7923b0
309 changed files with 7502 additions and 4335 deletions
@@ -8,8 +8,9 @@ namespace Barotrauma
{
partial class Character
{
public Address OwnerClientAddress;
public string OwnerClientName;
private Address ownerClientAddress;
private Option<AccountId> ownerClientAccountId;
public bool ClientDisconnected;
public float KillDisconnectedTimer;
@@ -19,6 +20,35 @@ namespace Barotrauma
public bool HealthUpdatePending;
public void SetOwnerClient(Client client)
{
if (client == null)
{
ownerClientAddress = null;
ownerClientAccountId = Option<AccountId>.None();
IsRemotePlayer = false;
}
else
{
ownerClientAddress = client.Connection.Endpoint.Address;
ownerClientAccountId = client.AccountId;
IsRemotePlayer = true;
}
}
public bool IsClientOwner(Client client)
{
if (ownerClientAccountId.TryUnwrap(out var accountId)
&& client.AccountId.TryUnwrap(out var clientId))
{
return accountId == clientId;
}
else
{
return ownerClientAddress == client.Connection.Endpoint.Address;
}
}
public float GetPositionUpdateInterval(Client recipient)
{
if (!Enabled) { return 1000.0f; }
@@ -662,6 +692,7 @@ namespace Barotrauma
{
msg.WriteIdentifier(MerchantIdentifier);
}
msg.WriteIdentifier(Faction);
int msgLengthBeforeOrders = msg.LengthBytes;
// Current orders