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:
@@ -155,8 +155,8 @@ namespace Barotrauma
|
||||
if (!flip) return;
|
||||
|
||||
flipTimer += deltaTime;
|
||||
|
||||
if (TargetDir != dir)
|
||||
|
||||
if (TargetDir != Direction.None && TargetDir != dir)
|
||||
{
|
||||
if (flipTimer>1.0f || character.IsRemotePlayer)
|
||||
{
|
||||
|
||||
@@ -823,7 +823,7 @@ namespace Barotrauma
|
||||
|
||||
public void Control(float deltaTime, Camera cam)
|
||||
{
|
||||
if (isDead || AnimController.StunTimer>0.0f) return;
|
||||
if (!AllowInput) return;
|
||||
|
||||
Vector2 targetMovement = GetTargetMovement();
|
||||
|
||||
@@ -1461,12 +1461,7 @@ namespace Barotrauma
|
||||
ControlLocalPlayer(deltaTime, cam);
|
||||
}
|
||||
|
||||
if (controlled == this ||
|
||||
!(this is AICharacter) ||
|
||||
!((AICharacter)this).AIController.Enabled)
|
||||
{
|
||||
Control(deltaTime, cam);
|
||||
}
|
||||
Control(deltaTime, cam);
|
||||
|
||||
if (selectedConstruction != null && !selectedConstruction.IsInPickRange(WorldPosition))
|
||||
{
|
||||
|
||||
@@ -152,6 +152,18 @@ namespace Barotrauma
|
||||
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)
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
|
||||
@@ -960,8 +960,7 @@ namespace Barotrauma.Networking
|
||||
foreach (Character c in GameMain.GameSession.CrewManager.characters)
|
||||
{
|
||||
Entity.Spawner.AddToSpawnedList(c);
|
||||
|
||||
c.SpawnItems.ForEach(item => Entity.Spawner.AddToSpawnedList(item));
|
||||
Entity.Spawner.AddToSpawnedList(c.SpawnItems);
|
||||
}
|
||||
|
||||
SendStartMessage(roundStartSeed, Submarine.MainSub, GameMain.GameSession.gameMode.Preset, connectedClients);
|
||||
|
||||
@@ -412,6 +412,8 @@ namespace Barotrauma.Networking
|
||||
bool myCharacter = i >= clients.Count;
|
||||
|
||||
var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false);
|
||||
Entity.Spawner.AddToSpawnedList(character);
|
||||
|
||||
character.TeamID = 1;
|
||||
|
||||
if (myCharacter)
|
||||
@@ -424,9 +426,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
clients[i].Character = character;
|
||||
}
|
||||
|
||||
spawnedCharacters.Add(character);
|
||||
|
||||
|
||||
Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position;
|
||||
|
||||
if (divingSuitPrefab != null && oxyPrefab != null)
|
||||
@@ -450,10 +450,11 @@ namespace Barotrauma.Networking
|
||||
spawnedItems.Add(scooter);
|
||||
spawnedItems.Add(battery);
|
||||
}
|
||||
|
||||
spawnedItems.ForEach(s => Item.Spawner.AddToSpawnedList(s));
|
||||
|
||||
character.GiveJobItems(mainSubSpawnPoints[i]);
|
||||
Entity.Spawner.AddToSpawnedList(character.SpawnItems);
|
||||
Entity.Spawner.AddToSpawnedList(spawnedItems);
|
||||
|
||||
GameMain.GameSession.CrewManager.characters.Add(character);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user