- fixed launcher not resetting the "checking for updates" text if it fails to parse the updateinfo xml file

- fixed crashing if switching from wiring mode to character mode
- option to disable crew ai through the console
This commit is contained in:
Regalis
2016-03-16 17:35:11 +02:00
parent 6f312281bf
commit 804510b144
4 changed files with 38 additions and 5 deletions

View File

@@ -335,8 +335,13 @@ namespace Launcher2
return false;
}
if (doc == null) return false;
if (doc == null)
{
updateInfoText.Text = "Checking updates failed";
updateInfoBox.Visible = true;
return false;
}
CheckUpdateXML(doc);
return true;

View File

@@ -5,6 +5,8 @@ namespace Barotrauma
{
class HumanAIController : AIController
{
public static bool DisableCrewAI;
const float UpdateObjectiveInterval = 0.5f;
private AIObjectiveManager objectiveManager;
@@ -46,6 +48,8 @@ namespace Barotrauma
public override void Update(float deltaTime)
{
if (DisableCrewAI) return;
Character.ClearInputs();
//steeringManager = Character.AnimController.CurrentHull == null ? outdoorsSteeringManager : indoorsSteeringManager;
@@ -85,12 +89,28 @@ namespace Barotrauma
{
Character.AnimController.TargetMovement = new Vector2( 0.0f, Math.Sign(Character.AnimController.TargetMovement.Y));
}
}
//unequip diving suit if running out of oxygen
if (Character.Oxygen < 50.0f && Character.AnimController.CurrentHull!=null &&
Character.AnimController.CurrentHull.Volume < Character.AnimController.CurrentHull.FullVolume*0.3f)
{
var divingSuit = Character.Inventory.FindItem("Diving Suit");
if (divingSuit != null) divingSuit.Drop(Character);
}
if (Character.IsKeyDown(InputType.Aim))
{
Character.AnimController.TargetDir = Character.CursorPosition.X > Character.Position.X ? Direction.Right : Direction.Left;
var cursorDiffX = Character.CursorPosition.X - Character.Position.X;
if (cursorDiffX > 10.0f)
{
Character.AnimController.TargetDir = Direction.Right;
}
else if (cursorDiffX < -10.0f)
{
Character.AnimController.TargetDir = Direction.Left;
}
if (Character.SelectedConstruction != null) Character.SelectedConstruction.SecondaryUse(deltaTime, Character);
}
@@ -106,7 +126,7 @@ namespace Barotrauma
public override void OnAttacked(IDamageable attacker, float amount)
{
var enemy = attacker as Character;
if (enemy == null) return;
if (enemy == null || enemy == Character) return;
objectiveManager.AddObjective(new AIObjectiveCombat(Character, enemy));
}

View File

@@ -218,6 +218,12 @@ namespace Barotrauma
if (spawnedCharacter != null && GameMain.Server != null) GameMain.Server.SendCharacterSpawnMessage(spawnedCharacter);
break;
case "disablecrewai":
HumanAIController.DisableCrewAI = !HumanAIController.DisableCrewAI;
break;
case "enablecrewai":
HumanAIController.DisableCrewAI = false;
break;
case "kick":
if (GameMain.Server == null) break;

View File

@@ -435,9 +435,11 @@ namespace Barotrauma
characterMode = !characterMode;
//button.Color = (characterMode) ? Color.Gold : Color.White;
if (characterMode)
{
if (wiringMode) ToggleWiringMode();
CreateDummyCharacter();
}
else if (dummyCharacter != null)