Added a few new console commands: disablehud, lockx & locky (disables submarine movement on the respective axis), followsub (toggles whether the camera moves with the subs)

This commit is contained in:
Regalis
2017-02-13 16:23:28 +02:00
parent 7f661ce362
commit 5871faa2dd
9 changed files with 41 additions and 6 deletions

View File

@@ -7,6 +7,8 @@ namespace Barotrauma
{
public class Camera
{
public static bool FollowSub = true;
const float DefaultZoom = 1.0f;
const float ZoomSmoothness = 8.0f;
const float MoveSmoothness = 8.0f;
@@ -186,7 +188,7 @@ namespace Barotrauma
if (GameMain.Config.KeyBind(InputType.Up).IsDown()) moveCam.Y += moveSpeed;
}
if (Screen.Selected == GameMain.GameScreen)
if (Screen.Selected == GameMain.GameScreen && FollowSub)
{
var closestSub = Submarine.GetClosest(WorldViewCenter);
if (closestSub != null)

View File

@@ -1382,7 +1382,7 @@ namespace Barotrauma
if (aiTarget != null) aiTarget.Draw(spriteBatch);
}
if (this == controlled) return;
if (this == controlled || GUI.DisableHUD) return;
Vector2 pos = DrawPosition;
pos.Y = -pos.Y;

View File

@@ -34,6 +34,8 @@ namespace Barotrauma
public static void AddToGUIUpdateList(Character character)
{
if (GUI.DisableHUD) return;
if (cprButton != null && cprButton.Visible) cprButton.AddToGUIUpdateList();
if (suicideButton != null && suicideButton.Visible) suicideButton.AddToGUIUpdateList();
@@ -118,6 +120,8 @@ namespace Barotrauma
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
}
if (GUI.DisableHUD) return;
if (character.Inventory != null)
{
for (int i = 0; i < character.Inventory.Items.Length - 1; i++)

View File

@@ -511,6 +511,12 @@ namespace Barotrauma
Submarine.MainSub.GodMode = !Submarine.MainSub.GodMode;
break;
case "lockx":
Submarine.LockX = !Submarine.LockX;
break;
case "locky":
Submarine.LockY = !Submarine.LockY;
break;
case "dumpids":
int count = commands.Length < 2 ? 10 : int.Parse(commands[1]);
@@ -675,6 +681,14 @@ namespace Barotrauma
case "debugdraw":
GameMain.DebugDraw = !GameMain.DebugDraw;
break;
case "disablehud":
case "hud":
GUI.DisableHUD = !GUI.DisableHUD;
GameMain.Instance.IsMouseVisible = !GameMain.Instance.IsMouseVisible;
break;
case "followsub":
Camera.FollowSub = !Camera.FollowSub;
break;
case "drawaitargets":
case "showaitargets":
AITarget.ShowAITargets = !AITarget.ShowAITargets;

View File

@@ -64,6 +64,8 @@ namespace Barotrauma
get { return arrow; }
}
public static bool DisableHUD;
public static void Init(ContentManager content)
{
Font = ToolBox.TryLoadFont("SpriteFont1", content);
@@ -498,7 +500,8 @@ namespace Barotrauma
if (GUIComponent.MouseOn != null && !string.IsNullOrWhiteSpace(GUIComponent.MouseOn.ToolTip)) GUIComponent.MouseOn.DrawToolTip(spriteBatch);
cursor.Draw(spriteBatch, PlayerInput.MousePosition);
if (!GUI.DisableHUD)
cursor.Draw(spriteBatch, PlayerInput.MousePosition);
}
public static void AddToGUIUpdateList()

View File

@@ -183,7 +183,7 @@ namespace Barotrauma
public override void Draw(SpriteBatch spriteBatch)
{
if (!isRunning) return;
if (!isRunning|| GUI.DisableHUD) return;
CrewManager.Draw(spriteBatch);
@@ -228,7 +228,7 @@ namespace Barotrauma
public override void Update(float deltaTime)
{
if (!isRunning) return;
if (!isRunning || GUI.DisableHUD) return;
base.Update(deltaTime);

View File

@@ -374,6 +374,8 @@ namespace Barotrauma
public void Update(float deltaTime)
{
TaskManager.Update(deltaTime);
if (GUI.DisableHUD) return;
//guiRoot.Update(deltaTime);
infoButton.Update(deltaTime);
@@ -385,6 +387,8 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch)
{
if (GUI.DisableHUD) return;
infoButton.Draw(spriteBatch);
if (gameMode != null) gameMode.Draw(spriteBatch);

View File

@@ -48,6 +48,8 @@ namespace Barotrauma
private set;
}
public static bool LockX, LockY;
public static List<Submarine> SavedSubmarines = new List<Submarine>();
public static readonly Vector2 GridSize = new Vector2(16.0f, 16.0f);
@@ -744,6 +746,11 @@ namespace Barotrauma
if (Level.Loaded == null) return;
if (subBody == null) return;
subBody.Body.LinearVelocity = new Vector2(
LockX ? 0.0f : subBody.Body.LinearVelocity.X,
LockY ? 0.0f : subBody.Body.LinearVelocity.Y);
subBody.Update(deltaTime);

View File

@@ -217,7 +217,8 @@ namespace Barotrauma
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
if (Character.Controlled == null && Submarine.MainSub != null) DrawSubmarineIndicator(spriteBatch, Submarine.MainSub);
if (Character.Controlled == null && Submarine.MainSub != null && !GUI.DisableHUD)
DrawSubmarineIndicator(spriteBatch, Submarine.MainSub);
GUI.Draw((float)deltaTime, spriteBatch, cam);