Fixed AI characters constantly flipping over the X-axis when inside, fixed clients not receiving a msg about characters spawned by RespawnManager
This commit is contained in:
@@ -156,7 +156,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
flipTimer += deltaTime;
|
flipTimer += deltaTime;
|
||||||
|
|
||||||
if (TargetDir != dir)
|
if (TargetDir != Direction.None && TargetDir != dir)
|
||||||
{
|
{
|
||||||
if (flipTimer>1.0f || character.IsRemotePlayer)
|
if (flipTimer>1.0f || character.IsRemotePlayer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Control(float deltaTime, Camera cam)
|
public void Control(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
if (isDead || AnimController.StunTimer>0.0f) return;
|
if (!AllowInput) return;
|
||||||
|
|
||||||
Vector2 targetMovement = GetTargetMovement();
|
Vector2 targetMovement = GetTargetMovement();
|
||||||
|
|
||||||
@@ -1461,12 +1461,7 @@ namespace Barotrauma
|
|||||||
ControlLocalPlayer(deltaTime, cam);
|
ControlLocalPlayer(deltaTime, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controlled == this ||
|
Control(deltaTime, cam);
|
||||||
!(this is AICharacter) ||
|
|
||||||
!((AICharacter)this).AIController.Enabled)
|
|
||||||
{
|
|
||||||
Control(deltaTime, cam);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedConstruction != null && !selectedConstruction.IsInPickRange(WorldPosition))
|
if (selectedConstruction != null && !selectedConstruction.IsInPickRange(WorldPosition))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,6 +152,18 @@ namespace Barotrauma
|
|||||||
NetStateID = (UInt32)spawnHistory.Count;
|
NetStateID = (UInt32)spawnHistory.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddToSpawnedList(IEnumerable<Entity> entities)
|
||||||
|
{
|
||||||
|
if (GameMain.Server == null) return;
|
||||||
|
if (entities == null) return;
|
||||||
|
|
||||||
|
foreach (Entity entity in entities)
|
||||||
|
{
|
||||||
|
spawnHistory.Add(new SpawnOrRemove(entity, false));
|
||||||
|
NetStateID = (UInt32)spawnHistory.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ServerWrite(Lidgren.Network.NetBuffer message, Client client, object[] extraData = null)
|
public void ServerWrite(Lidgren.Network.NetBuffer message, Client client, object[] extraData = null)
|
||||||
{
|
{
|
||||||
if (GameMain.Server == null) return;
|
if (GameMain.Server == null) return;
|
||||||
|
|||||||
@@ -960,8 +960,7 @@ namespace Barotrauma.Networking
|
|||||||
foreach (Character c in GameMain.GameSession.CrewManager.characters)
|
foreach (Character c in GameMain.GameSession.CrewManager.characters)
|
||||||
{
|
{
|
||||||
Entity.Spawner.AddToSpawnedList(c);
|
Entity.Spawner.AddToSpawnedList(c);
|
||||||
|
Entity.Spawner.AddToSpawnedList(c.SpawnItems);
|
||||||
c.SpawnItems.ForEach(item => Entity.Spawner.AddToSpawnedList(item));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SendStartMessage(roundStartSeed, Submarine.MainSub, GameMain.GameSession.gameMode.Preset, connectedClients);
|
SendStartMessage(roundStartSeed, Submarine.MainSub, GameMain.GameSession.gameMode.Preset, connectedClients);
|
||||||
|
|||||||
@@ -412,6 +412,8 @@ namespace Barotrauma.Networking
|
|||||||
bool myCharacter = i >= clients.Count;
|
bool myCharacter = i >= clients.Count;
|
||||||
|
|
||||||
var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false);
|
var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false);
|
||||||
|
Entity.Spawner.AddToSpawnedList(character);
|
||||||
|
|
||||||
character.TeamID = 1;
|
character.TeamID = 1;
|
||||||
|
|
||||||
if (myCharacter)
|
if (myCharacter)
|
||||||
@@ -425,8 +427,6 @@ namespace Barotrauma.Networking
|
|||||||
clients[i].Character = character;
|
clients[i].Character = character;
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnedCharacters.Add(character);
|
|
||||||
|
|
||||||
Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position;
|
Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position;
|
||||||
|
|
||||||
if (divingSuitPrefab != null && oxyPrefab != null)
|
if (divingSuitPrefab != null && oxyPrefab != null)
|
||||||
@@ -451,9 +451,10 @@ namespace Barotrauma.Networking
|
|||||||
spawnedItems.Add(battery);
|
spawnedItems.Add(battery);
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnedItems.ForEach(s => Item.Spawner.AddToSpawnedList(s));
|
|
||||||
|
|
||||||
character.GiveJobItems(mainSubSpawnPoints[i]);
|
character.GiveJobItems(mainSubSpawnPoints[i]);
|
||||||
|
Entity.Spawner.AddToSpawnedList(character.SpawnItems);
|
||||||
|
Entity.Spawner.AddToSpawnedList(spawnedItems);
|
||||||
|
|
||||||
GameMain.GameSession.CrewManager.characters.Add(character);
|
GameMain.GameSession.CrewManager.characters.Add(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user