Disabled AI crew commands in multiplayer, attempting to give commands to a character with no AIController doesn't crash the game
This commit is contained in:
@@ -148,7 +148,7 @@ namespace Barotrauma
|
|||||||
frame.RemoveChild(child);
|
frame.RemoveChild(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Character> aliveCharacters = crewManager.characters.FindAll(c => !c.IsDead);
|
List<Character> aliveCharacters = crewManager.characters.FindAll(c => !c.IsDead && c.AIController is HumanAIController);
|
||||||
|
|
||||||
characterFrameBottom = 0;
|
characterFrameBottom = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,11 @@ namespace Barotrauma
|
|||||||
frame.SelectedColor = Color.Gold * 0.5f;
|
frame.SelectedColor = Color.Gold * 0.5f;
|
||||||
|
|
||||||
var ai = character.AIController as HumanAIController;
|
var ai = character.AIController as HumanAIController;
|
||||||
|
if (ai == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error in crewmanager - attempted to give orders to a character with no HumanAIController");
|
||||||
|
return;
|
||||||
|
}
|
||||||
SetCharacterOrder(character, ai.CurrentOrder);
|
SetCharacterOrder(character, ai.CurrentOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,9 +156,10 @@ namespace Barotrauma
|
|||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
guiFrame.Update(deltaTime);
|
guiFrame.Update(deltaTime);
|
||||||
|
|
||||||
|
//TODO: implement AI commands in multiplayer?
|
||||||
if (GameMain.Config.KeyBind(InputType.CrewOrders).IsHit())
|
if (GameMain.NetworkMember != null &&
|
||||||
|
GameMain.Config.KeyBind(InputType.CrewOrders).IsHit())
|
||||||
{
|
{
|
||||||
//deselect construction unless it's the ladders the character is climbing
|
//deselect construction unless it's the ladders the character is climbing
|
||||||
if (!commander.IsOpen && Character.Controlled != null &&
|
if (!commander.IsOpen && Character.Controlled != null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user