- Crewcommander close button & info text notifying about the hotkey

- Doors can only be selected when they are broken
- Fixed crashing when placing a door while no sub is loaded
- Generating waypoints for an empty sub won't crash the game
- Drawing characterHUD in editor
This commit is contained in:
Regalis11
2016-01-24 17:03:25 +02:00
parent 7098a9a5e0
commit 28af6fa1f4
6 changed files with 36 additions and 9 deletions

Binary file not shown.

View File

@@ -10,11 +10,13 @@ namespace Barotrauma
{
class CrewCommander
{
CrewManager crewManager;
private CrewManager crewManager;
GUIFrame frame;
private GUIFrame frame;
//GUIListBox characterList;
private bool infoTextShown;
private int characterFrameBottom;
public GUIFrame Frame
@@ -39,6 +41,12 @@ namespace Barotrauma
if (IsOpen)
{
if (!infoTextShown)
{
GUI.AddMessage("Press " + GameMain.Config.KeyBind(InputType.CrewOrders) + " to open/close the command menu", Color.Cyan, 5.0f);
infoTextShown = true;
}
if (frame == null) CreateGUIFrame();
UpdateCharacters();
}
@@ -48,7 +56,14 @@ namespace Barotrauma
{
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f);
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", GUI.Style, frame);
closeButton.OnClicked = (GUIButton button, object userData) =>
{
ToggleGUIFrame();
return false;
};
//UpdateCharacters();
int buttonWidth = 130;
@@ -62,7 +77,7 @@ namespace Barotrauma
Order.PrefabList.FindAll(o => o.ItemComponentType == null) :
Order.PrefabList.FindAll(o=> o.ItemComponentType != null);
int startX = (int)-(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2;
int startX = -(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2;
int i=0;
foreach (Order order in orders)

View File

@@ -7,7 +7,6 @@ using FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Lights;
using System.Collections.Generic;
namespace Barotrauma.Items.Components
{
@@ -250,6 +249,12 @@ namespace Barotrauma.Items.Components
return true;
}
public override bool Select(Character character)
{
//can only be selected if the item is broken
return item.Condition <= 0.0f;
}
public override void Update(float deltaTime, Camera cam)
{
if (!isStuck)

View File

@@ -130,7 +130,7 @@ namespace Barotrauma
placePosition = Vector2.Zero;
item.Submarine = Submarine.Loaded;
item.SetTransform(ConvertUnits.ToSimUnits(item.Position - Submarine.Loaded.Position), 0.0f);
item.SetTransform(ConvertUnits.ToSimUnits(Submarine.Loaded == null ? item.Position : item.Position - Submarine.Loaded.Position), 0.0f);
item.FindHull();
//selected = null;

View File

@@ -287,6 +287,12 @@ namespace Barotrauma
public static void GenerateSubWaypoints()
{
if (!Hull.hullList.Any())
{
DebugConsole.ThrowError("Couldn't generate waypoints: no hulls found.");
return;
}
List<WayPoint> existingWaypoints = WayPointList.FindAll(wp => wp.spawnType == SpawnType.Path);
foreach (WayPoint wayPoint in existingWaypoints)
{

View File

@@ -467,8 +467,6 @@ namespace Barotrauma
GUIpanel.Draw(spriteBatch);
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
if (characterMode)
@@ -497,12 +495,15 @@ namespace Barotrauma
dummyCharacter.SelectedConstruction = null;
}
}
}
dummyCharacter.DrawHUD(spriteBatch, cam);
}
else
{
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
MapEntity.Edit(spriteBatch, cam);
}