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:
@@ -7,6 +7,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public class Camera
|
public class Camera
|
||||||
{
|
{
|
||||||
|
public static bool FollowSub = true;
|
||||||
|
|
||||||
const float DefaultZoom = 1.0f;
|
const float DefaultZoom = 1.0f;
|
||||||
const float ZoomSmoothness = 8.0f;
|
const float ZoomSmoothness = 8.0f;
|
||||||
const float MoveSmoothness = 8.0f;
|
const float MoveSmoothness = 8.0f;
|
||||||
@@ -186,7 +188,7 @@ namespace Barotrauma
|
|||||||
if (GameMain.Config.KeyBind(InputType.Up).IsDown()) moveCam.Y += moveSpeed;
|
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);
|
var closestSub = Submarine.GetClosest(WorldViewCenter);
|
||||||
if (closestSub != null)
|
if (closestSub != null)
|
||||||
|
|||||||
@@ -1382,7 +1382,7 @@ namespace Barotrauma
|
|||||||
if (aiTarget != null) aiTarget.Draw(spriteBatch);
|
if (aiTarget != null) aiTarget.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == controlled) return;
|
if (this == controlled || GUI.DisableHUD) return;
|
||||||
|
|
||||||
Vector2 pos = DrawPosition;
|
Vector2 pos = DrawPosition;
|
||||||
pos.Y = -pos.Y;
|
pos.Y = -pos.Y;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static void AddToGUIUpdateList(Character character)
|
public static void AddToGUIUpdateList(Character character)
|
||||||
{
|
{
|
||||||
|
if (GUI.DisableHUD) return;
|
||||||
|
|
||||||
if (cprButton != null && cprButton.Visible) cprButton.AddToGUIUpdateList();
|
if (cprButton != null && cprButton.Visible) cprButton.AddToGUIUpdateList();
|
||||||
|
|
||||||
if (suicideButton != null && suicideButton.Visible) suicideButton.AddToGUIUpdateList();
|
if (suicideButton != null && suicideButton.Visible) suicideButton.AddToGUIUpdateList();
|
||||||
@@ -118,6 +120,8 @@ namespace Barotrauma
|
|||||||
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
|
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GUI.DisableHUD) return;
|
||||||
|
|
||||||
if (character.Inventory != null)
|
if (character.Inventory != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < character.Inventory.Items.Length - 1; i++)
|
for (int i = 0; i < character.Inventory.Items.Length - 1; i++)
|
||||||
|
|||||||
@@ -511,6 +511,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Submarine.MainSub.GodMode = !Submarine.MainSub.GodMode;
|
Submarine.MainSub.GodMode = !Submarine.MainSub.GodMode;
|
||||||
break;
|
break;
|
||||||
|
case "lockx":
|
||||||
|
Submarine.LockX = !Submarine.LockX;
|
||||||
|
break;
|
||||||
|
case "locky":
|
||||||
|
Submarine.LockY = !Submarine.LockY;
|
||||||
|
break;
|
||||||
case "dumpids":
|
case "dumpids":
|
||||||
int count = commands.Length < 2 ? 10 : int.Parse(commands[1]);
|
int count = commands.Length < 2 ? 10 : int.Parse(commands[1]);
|
||||||
|
|
||||||
@@ -675,6 +681,14 @@ namespace Barotrauma
|
|||||||
case "debugdraw":
|
case "debugdraw":
|
||||||
GameMain.DebugDraw = !GameMain.DebugDraw;
|
GameMain.DebugDraw = !GameMain.DebugDraw;
|
||||||
break;
|
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 "drawaitargets":
|
||||||
case "showaitargets":
|
case "showaitargets":
|
||||||
AITarget.ShowAITargets = !AITarget.ShowAITargets;
|
AITarget.ShowAITargets = !AITarget.ShowAITargets;
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ namespace Barotrauma
|
|||||||
get { return arrow; }
|
get { return arrow; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool DisableHUD;
|
||||||
|
|
||||||
public static void Init(ContentManager content)
|
public static void Init(ContentManager content)
|
||||||
{
|
{
|
||||||
Font = ToolBox.TryLoadFont("SpriteFont1", 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);
|
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()
|
public static void AddToGUIUpdateList()
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
if (!isRunning) return;
|
if (!isRunning|| GUI.DisableHUD) return;
|
||||||
|
|
||||||
CrewManager.Draw(spriteBatch);
|
CrewManager.Draw(spriteBatch);
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (!isRunning) return;
|
if (!isRunning || GUI.DisableHUD) return;
|
||||||
|
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
|
|
||||||
|
|||||||
@@ -374,6 +374,8 @@ namespace Barotrauma
|
|||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
TaskManager.Update(deltaTime);
|
TaskManager.Update(deltaTime);
|
||||||
|
|
||||||
|
if (GUI.DisableHUD) return;
|
||||||
|
|
||||||
//guiRoot.Update(deltaTime);
|
//guiRoot.Update(deltaTime);
|
||||||
infoButton.Update(deltaTime);
|
infoButton.Update(deltaTime);
|
||||||
@@ -385,6 +387,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch)
|
public void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
|
if (GUI.DisableHUD) return;
|
||||||
|
|
||||||
infoButton.Draw(spriteBatch);
|
infoButton.Draw(spriteBatch);
|
||||||
|
|
||||||
if (gameMode != null) gameMode.Draw(spriteBatch);
|
if (gameMode != null) gameMode.Draw(spriteBatch);
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ namespace Barotrauma
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool LockX, LockY;
|
||||||
|
|
||||||
public static List<Submarine> SavedSubmarines = new List<Submarine>();
|
public static List<Submarine> SavedSubmarines = new List<Submarine>();
|
||||||
|
|
||||||
public static readonly Vector2 GridSize = new Vector2(16.0f, 16.0f);
|
public static readonly Vector2 GridSize = new Vector2(16.0f, 16.0f);
|
||||||
@@ -744,6 +746,11 @@ namespace Barotrauma
|
|||||||
if (Level.Loaded == null) return;
|
if (Level.Loaded == null) return;
|
||||||
|
|
||||||
if (subBody == 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);
|
subBody.Update(deltaTime);
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
|
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);
|
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user