@@ -264,9 +264,17 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
radio = null;
|
||||
if (sender?.Inventory == null || sender.Removed) { return false; }
|
||||
radio = sender.Inventory.AllItems.FirstOrDefault(i => i.GetComponent<WifiComponent>() != null)?.GetComponent<WifiComponent>();
|
||||
if (radio?.Item == null) { return false; }
|
||||
return sender.HasEquippedItem(radio.Item) && radio.CanTransmit();
|
||||
|
||||
foreach (Item item in sender.Inventory.AllItems)
|
||||
{
|
||||
var wifiComponent = item.GetComponent<WifiComponent>();
|
||||
if (wifiComponent == null || !wifiComponent.CanTransmit() || !sender.HasEquippedItem(item)) { continue; }
|
||||
if (radio == null || wifiComponent.Range > radio.Range)
|
||||
{
|
||||
radio = wifiComponent;
|
||||
}
|
||||
}
|
||||
return radio?.Item != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Barotrauma
|
||||
return removeQueue.Contains(entity);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void Update(bool createNetworkEvents = true)
|
||||
{
|
||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return; }
|
||||
while (spawnQueue.Count > 0)
|
||||
@@ -387,10 +387,13 @@ namespace Barotrauma
|
||||
var spawnedEntity = entitySpawnInfo.Spawn();
|
||||
if (spawnedEntity != null)
|
||||
{
|
||||
CreateNetworkEventProjSpecific(spawnedEntity, false);
|
||||
if (spawnedEntity is Item)
|
||||
if (createNetworkEvents)
|
||||
{
|
||||
CreateNetworkEventProjSpecific(spawnedEntity, false);
|
||||
}
|
||||
if (spawnedEntity is Item item)
|
||||
{
|
||||
((Item)spawnedEntity).Condition = ((ItemSpawnInfo)entitySpawnInfo).Condition;
|
||||
item.Condition = ((ItemSpawnInfo)entitySpawnInfo).Condition;
|
||||
}
|
||||
entitySpawnInfo.OnSpawned(spawnedEntity);
|
||||
}
|
||||
@@ -403,7 +406,10 @@ namespace Barotrauma
|
||||
{
|
||||
item.SendPendingNetworkUpdates();
|
||||
}
|
||||
CreateNetworkEventProjSpecific(removedEntity, true);
|
||||
if (createNetworkEvents)
|
||||
{
|
||||
CreateNetworkEventProjSpecific(removedEntity, true);
|
||||
}
|
||||
removedEntity.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,22 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
RespawnCharactersProjSpecific(shuttlePos);
|
||||
}
|
||||
|
||||
|
||||
public static Affliction GetRespawnPenaltyAffliction()
|
||||
{
|
||||
var respawnPenaltyAffliction = AfflictionPrefab.List.FirstOrDefault(a => a.AfflictionType.Equals("respawnpenalty", StringComparison.OrdinalIgnoreCase));
|
||||
return respawnPenaltyAffliction?.Instantiate(10.0f);
|
||||
}
|
||||
|
||||
public static void GiveRespawnPenaltyAffliction(Character character)
|
||||
{
|
||||
var respawnPenaltyAffliction = GetRespawnPenaltyAffliction();
|
||||
if (respawnPenaltyAffliction != null)
|
||||
{
|
||||
character.CharacterHealth.ApplyAffliction(targetLimb: null, respawnPenaltyAffliction);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 FindSpawnPos()
|
||||
{
|
||||
if (Level.Loaded == null || Submarine.MainSub == null) { return Vector2.Zero; }
|
||||
|
||||
Reference in New Issue
Block a user