diff --git a/Subsurface/Content/Items/Fabricators/fabricators.xml b/Subsurface/Content/Items/Fabricators/fabricators.xml
index 4f703dc21..88546fae0 100644
--- a/Subsurface/Content/Items/Fabricators/fabricators.xml
+++ b/Subsurface/Content/Items/Fabricators/fabricators.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/Subsurface/Properties/AssemblyInfo.cs b/Subsurface/Properties/AssemblyInfo.cs
index dbf4d45f5..e51b2608b 100644
--- a/Subsurface/Properties/AssemblyInfo.cs
+++ b/Subsurface/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.3.5.1")]
-[assembly: AssemblyFileVersion("0.3.5.1")]
+[assembly: AssemblyVersion("0.3.6.0")]
+[assembly: AssemblyFileVersion("0.3.6.0")]
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs
index 8b2d1f71d..46959fd9d 100644
--- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs
@@ -111,7 +111,6 @@ namespace Barotrauma
for (int i = 0; i < 5 && currSearchIndex < Item.ItemList.Count - 2; i++)
{
-
currSearchIndex++;
var item = Item.ItemList[currSearchIndex];
@@ -119,8 +118,16 @@ namespace Barotrauma
if (item.CurrentHull == null || item.Condition <= 0.0f) continue;
if (IgnoreContainedItems && item.Container != null) continue;
if (item.Name != itemName && !item.HasTag(itemName)) continue;
+
+ //if the item is inside a character's inventory, don't steal it
if (item.ParentInventory is CharacterInventory) continue;
+ //if the item is inside an item, which is inside a character's inventory, don't steal it
+ if (item.ParentInventory != null && item.ParentInventory.Owner is Item)
+ {
+ if (((Item)item.ParentInventory.Owner).ParentInventory is CharacterInventory) continue;
+ }
+
//ignore if item is further away than the currently targeted item
Item rootContainer = item.GetRootContainer();
if (moveToTarget != null && Vector2.DistanceSquared((rootContainer ?? item).Position, character.Position) > currDist) continue;
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index 0d971f697..1a4695485 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -756,7 +756,7 @@ namespace Barotrauma
if (torso == null) return null;
Vector2 pos = (torso.body.TargetPosition != Vector2.Zero) ? torso.body.TargetPosition : torso.SimPosition;
- Vector2 pickPos = selectedConstruction == null ? mouseSimPos : ConvertUnits.ToSimUnits(selectedConstruction.WorldPosition);
+ Vector2 pickPos = mouseSimPos;
if (Submarine != null)
{
@@ -764,6 +764,8 @@ namespace Barotrauma
pickPos += Submarine.SimPosition;
}
+ if (selectedConstruction != null) pickPos = ConvertUnits.ToSimUnits(selectedConstruction.WorldPosition);
+
return Item.FindPickable(pos, pickPos, AnimController.CurrentHull, selectedItems);
}
diff --git a/Subsurface/Source/GUI/GUIComponent.cs b/Subsurface/Source/GUI/GUIComponent.cs
index d8e1f2c81..46624adcc 100644
--- a/Subsurface/Source/GUI/GUIComponent.cs
+++ b/Subsurface/Source/GUI/GUIComponent.cs
@@ -75,7 +75,7 @@ namespace Barotrauma
get { return new Vector2(rect.Center.X, rect.Center.Y); }
}
- public Rectangle Rect
+ public virtual Rectangle Rect
{
get { return rect; }
set
diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs
index 39628a0a6..c04912ad3 100644
--- a/Subsurface/Source/GUI/GUITextBlock.cs
+++ b/Subsurface/Source/GUI/GUITextBlock.cs
@@ -44,6 +44,19 @@ namespace Barotrauma
}
}
+ public override Rectangle Rect
+ {
+ get
+ {
+ return base.Rect;
+ }
+ set
+ {
+ base.Rect = value;
+ SetTextPos();
+ }
+ }
+
public float TextDepth
{
get { return textDepth; }
diff --git a/Subsurface/Source/GUI/GUITextBox.cs b/Subsurface/Source/GUI/GUITextBox.cs
index d043de721..07a444ef2 100644
--- a/Subsurface/Source/GUI/GUITextBox.cs
+++ b/Subsurface/Source/GUI/GUITextBox.cs
@@ -20,11 +20,13 @@ namespace Barotrauma
public delegate bool OnEnterHandler(GUITextBox textBox, string text);
public OnEnterHandler OnEnterPressed;
-
+
public event TextBoxEvent OnKeyHit;
public delegate bool OnTextChangedHandler(GUITextBox textBox, string text);
public OnTextChangedHandler OnTextChanged;
+
+ public bool CaretEnabled;
public GUITextBlock.TextGetterHandler TextGetter
{
@@ -83,8 +85,20 @@ namespace Barotrauma
}
}
- public bool CaretEnabled;
+ public override Rectangle Rect
+ {
+ get
+ {
+ return base.Rect;
+ }
+ set
+ {
+ base.Rect = value;
+ textBlock.Rect = value;
+ }
+ }
+
public String Text
{
get
diff --git a/Subsurface/Source/Items/Components/Signal/LightComponent.cs b/Subsurface/Source/Items/Components/Signal/LightComponent.cs
index beea3ddd6..534419757 100644
--- a/Subsurface/Source/Items/Components/Signal/LightComponent.cs
+++ b/Subsurface/Source/Items/Components/Signal/LightComponent.cs
@@ -152,7 +152,7 @@ namespace Barotrauma.Items.Components
{
if (light.LightSprite != null)
{
- light.LightSprite.Draw(spriteBatch, new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), lightColor * lightBrightness);
+ light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness);
}
}
diff --git a/Subsurface/Source/Map/Hull.cs b/Subsurface/Source/Map/Hull.cs
index daa794261..19e3b6a62 100644
--- a/Subsurface/Source/Map/Hull.cs
+++ b/Subsurface/Source/Map/Hull.cs
@@ -537,14 +537,16 @@ namespace Barotrauma
{
if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return;
+ Vector2 submarinePos = Submarine == null ? Vector2.Zero : Submarine.DrawPosition;
+
//calculate where the surface should be based on the water volume
- float top = rect.Y+Submarine.DrawPosition.Y;
+ float top = rect.Y + submarinePos.Y;
float bottom = top - rect.Height;
float surfaceY = bottom + Volume / rect.Width;
//interpolate the position of the rendered surface towards the "target surface"
- surface = surface + ((surfaceY - Submarine.DrawPosition.Y) - surface) / 10.0f;
- float drawSurface = surface + Submarine.DrawPosition.Y;
+ surface = surface + ((surfaceY - submarinePos.Y) - surface) / 10.0f;
+ float drawSurface = surface + submarinePos.Y;
Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
@@ -565,7 +567,7 @@ namespace Barotrauma
Vector2[] uvCoords = new Vector2[4];
for (int i = 0; i < 4; i++ )
{
- corners[i] += new Vector3(Submarine.DrawPosition, 0.0f);
+ corners[i] += new Vector3(submarinePos, 0.0f);
uvCoords[i] = Vector2.Transform(new Vector2(corners[i].X, -corners[i].Y), transform);
}
diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs
index 48827f087..039a8f924 100644
--- a/Subsurface/Source/Map/Submarine.cs
+++ b/Subsurface/Source/Map/Submarine.cs
@@ -55,6 +55,12 @@ namespace Barotrauma
set { name = value; }
}
+ public string Description
+ {
+ get;
+ set;
+ }
+
public static Vector2 LastPickedPosition
{
get { return lastPickedPosition; }
@@ -191,17 +197,12 @@ namespace Barotrauma
{
this.hash = new Md5Hash(hash);
}
- else
+
+ XDocument doc = OpenDoc(filePath);
+
+ if (doc != null && doc.Root != null)
{
- //XDocument doc = OpenDoc(filePath);
-
- //string md5Hash = ToolBox.GetAttributeString(doc.Root, "md5hash", "");
- //if (md5Hash == "" || md5Hash.Length < 16)
- //{
- // DebugConsole.ThrowError("Couldn't find a valid MD5 hash in the map file");
- //}
-
- //this.mapHash = new MapHash(md5Hash);
+ Description = ToolBox.GetAttributeString(doc.Root, "description", "");
}
ID = ushort.MaxValue;
@@ -225,21 +226,6 @@ namespace Barotrauma
if (MapEntity.mapEntityList[i].Sprite == null || MapEntity.mapEntityList[i].Sprite.Depth < 0.5f)
MapEntity.mapEntityList[i].Draw(spriteBatch, editing, false);
}
-
-
-
- if (loaded == null) return;
-
- //foreach (HullBody hb in loaded.hullBodies)
- //{
- // spriteBatch.Draw(
- // hb.shapeTexture,
- // ConvertUnits.ToDisplayUnits(new Vector2(hb.body.Position.X, -hb.body.Position.Y)),
- // null,
- // Color.White,
- // -hb.body.Rotation,
- // new Vector2(hb.shapeTexture.Width / 2, hb.shapeTexture.Height / 2), 1.0f, SpriteEffects.None, 0.0f);
- //}
}
public static void DrawBack(SpriteBatch spriteBatch, bool editing = false)
@@ -488,6 +474,7 @@ namespace Barotrauma
XDocument doc = new XDocument(new XElement("Submarine"));
doc.Root.Add(new XAttribute("name", name));
+ doc.Root.Add(new XAttribute("description", Description == null ? "" : Description));
foreach (MapEntity e in MapEntity.mapEntityList)
{
@@ -684,9 +671,9 @@ namespace Barotrauma
//string file = filePath;
XDocument doc = OpenDoc(filePath);
- if (doc == null) return;
+ if (doc == null || doc.Root == null) return;
- //name = ToolBox.GetAttributeString(doc.Root, "name", name);
+ Description = ToolBox.GetAttributeString(doc.Root, "description", "");
foreach (XElement element in doc.Root.Elements())
{
diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs
index 8bc36ee5c..e752eb90e 100644
--- a/Subsurface/Source/Screens/EditMapScreen.cs
+++ b/Subsurface/Source/Screens/EditMapScreen.cs
@@ -19,7 +19,7 @@ namespace Barotrauma
private GUIFrame loadFrame;
- private GUITextBox nameBox;
+ private GUITextBox nameBox, descriptionBox;
const int PreviouslyUsedCount = 10;
private GUIListBox previouslyUsedList;
@@ -88,40 +88,29 @@ namespace Barotrauma
var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", GUI.Style, topPanel);
button.OnClicked = CreateLoadScreen;
- // var nameBlock =new GUITextBlock(new Rectangle(0, 20, 0, 20), "Submarine:", GUI.Style, leftPanel);
nameBox = new GUITextBox(new Rectangle(150, 0, 150, 20), GUI.Style, topPanel);
nameBox.OnEnterPressed = ChangeSubName;
button = new GUIButton(new Rectangle(310,0,70,20), "Save", GUI.Style, topPanel);
button.OnClicked = SaveSub;
+
+ new GUITextBlock(new Rectangle(400, 0, 100, 20), "Description: ", GUI.Style, topPanel);
+
+ descriptionBox = new GUITextBox(new Rectangle(500, 0, 200, 20), null, null, Alignment.TopLeft,
+ Alignment.TopLeft, GUI.Style, topPanel);
+ descriptionBox.Wrap = true;
+ descriptionBox.OnSelected += ExpandDescriptionBox;
+ descriptionBox.OnTextChanged = ChangeSubDescription;
leftPanel = new GUIFrame(new Rectangle(0, 30, 150, GameMain.GraphicsHeight-30), GUI.Style);
leftPanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- //GUIListBox constructionList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUIpanel);
- //constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
- //constructionList.CheckSelected = MapEntityPrefab.GetSelected;
-
-
-
-
- //GUIButton button = new GUIButton(new Rectangle(0,70,0,20), "Save", GUI.Style, GUIpanel);
- //button.OnClicked = SaveSub;
-
+
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, leftPanel);
itemCount.TextGetter = GetItemCount;
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 50, 0, 20), "", GUI.Style, leftPanel);
structureCount.TextGetter = GetStructureCount;
- //GUITextBlock physicsBodyCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel);
- //physicsBodyCount.TextGetter = GetPhysicsBodyCount;
-
-
- //button = new GUIButton(new Rectangle(0, 180, 0, 20), "Structures", Alignment.Left, GUI.Style, GUIpanel);
- //button.UserData = 1;
- //button.OnClicked = SelectTab;
-
-
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
@@ -246,11 +235,13 @@ namespace Barotrauma
{
cam.Position = Submarine.Loaded.Position + Submarine.HiddenSubPosition;
nameBox.Text = Submarine.Loaded.Name;
+ descriptionBox.Text = ToolBox.LimitString(Submarine.Loaded.Description,15);
}
else
{
cam.Position = Submarine.HiddenSubPosition;
nameBox.Text = "";
+ descriptionBox.Text = "";
}
nameBox.Deselect();
@@ -411,6 +402,7 @@ namespace Barotrauma
selectedSub.Load();
nameBox.Text = selectedSub.Name;
+ descriptionBox.Text = ToolBox.LimitString(selectedSub.Description,15);
loadFrame = null;
@@ -579,6 +571,41 @@ namespace Barotrauma
return true;
}
+ private bool ChangeSubDescription(GUITextBox textBox, string text)
+ {
+ if (Submarine.Loaded != null)
+ {
+ Submarine.Loaded.Description = text;
+ }
+ else
+ {
+ textBox.UserData = text;
+ }
+
+ textBox.Rect = new Rectangle(textBox.Rect.Location, new Point(textBox.Rect.Width, 20));
+
+ textBox.Text = ToolBox.LimitString(text, 15);
+
+ textBox.Flash(Color.Green);
+ textBox.Deselect();
+
+ return true;
+ }
+
+ private void ExpandDescriptionBox(GUITextBox textBox, Keys key)
+ {
+ if (Submarine.Loaded != null)
+ {
+ textBox.Text = Submarine.Loaded.Description;
+ }
+ else if (textBox.UserData is string)
+ {
+ textBox.Text = (string)textBox.UserData;
+ }
+
+ textBox.Rect = new Rectangle(textBox.Rect.Location, new Point(textBox.Rect.Width, 150));
+ }
+
private bool SelectPrefab(GUIComponent component, object obj)
{
AddPreviouslyUsed(obj as MapEntityPrefab);
@@ -609,11 +636,7 @@ namespace Barotrauma
var existing = previouslyUsedList.FindChild(mapEntityPrefab);
if (existing != null) previouslyUsedList.RemoveChild(existing);
- string name = mapEntityPrefab.Name;
- if (name.Length>15)
- {
- name = name.Substring(0,12)+"...";
- }
+ string name = ToolBox.LimitString(mapEntityPrefab.Name,15);
var textBlock = new GUITextBlock(new Rectangle(0,0,0,15), name, GUI.Style, previouslyUsedList);
textBlock.UserData = mapEntityPrefab;
diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs
index 2be24a4b7..549d59f61 100644
--- a/Subsurface/Source/Screens/MainMenuScreen.cs
+++ b/Subsurface/Source/Screens/MainMenuScreen.cs
@@ -99,7 +99,9 @@ namespace Barotrauma
GUI.Style,
Alignment.Left, Alignment.Left, mapList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
+ textBlock.ToolTip = sub.Description;
textBlock.UserData = sub;
+
}
if (Submarine.SavedSubmarines.Count > 0) mapList.Select(Submarine.SavedSubmarines[0]);
diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs
index 08d357dfb..f8d0e42dc 100644
--- a/Subsurface/Source/Screens/NetLobbyScreen.cs
+++ b/Subsurface/Source/Screens/NetLobbyScreen.cs
@@ -528,25 +528,22 @@ namespace Barotrauma
subList.ClearChildren();
- if (Submarine.SavedSubmarines.Count > 0)
- {
- foreach (Submarine sub in Submarine.SavedSubmarines)
- {
- GUITextBlock textBlock = new GUITextBlock(
- new Rectangle(0, 0, 0, 25),
- sub.Name, GUI.Style,
- Alignment.Left, Alignment.Left,
- subList);
- textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
- textBlock.UserData = sub;
- }
- }
- else
+ if (Submarine.SavedSubmarines.Count == 0)
{
DebugConsole.ThrowError("No saved submarines found!");
- return;
}
-
+
+ foreach (Submarine sub in Submarine.SavedSubmarines)
+ {
+ new GUITextBlock(
+ new Rectangle(0, 0, 0, 25), sub.Name, GUI.Style,
+ Alignment.Left, Alignment.Left, subList)
+ {
+ Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f),
+ ToolTip = sub.Description,
+ UserData = sub
+ };
+ }
}
public bool VotableClicked(GUIComponent component, object userData)
diff --git a/Subsurface/Source/Utils/ToolBox.cs b/Subsurface/Source/Utils/ToolBox.cs
index 837627418..abc5f0487 100644
--- a/Subsurface/Source/Utils/ToolBox.cs
+++ b/Subsurface/Source/Utils/ToolBox.cs
@@ -302,6 +302,16 @@ namespace Barotrauma
return floatArray;
}
+ public static string LimitString(string str, int maxCharacters)
+ {
+ if (str == null || maxCharacters < 0) return null;
+
+ if (maxCharacters < 4 || str.Length <= maxCharacters) return str;
+
+ return str.Substring(0, maxCharacters-3) + "...";
+
+ }
+
public static string RandomSeed(int length)
{
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
diff --git a/Subsurface/Submarines/Aegir Mark II.sub b/Subsurface/Submarines/Aegir Mark II.sub
index aafc1ea60..ac543a322 100644
Binary files a/Subsurface/Submarines/Aegir Mark II.sub and b/Subsurface/Submarines/Aegir Mark II.sub differ
diff --git a/Subsurface/Submarines/Vellamo.sub b/Subsurface/Submarines/Vellamo.sub
index 3542a9781..5ad754f77 100644
Binary files a/Subsurface/Submarines/Vellamo.sub and b/Subsurface/Submarines/Vellamo.sub differ
diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt
index 8fa2ef25c..42c528f49 100644
--- a/Subsurface/changelog.txt
+++ b/Subsurface/changelog.txt
@@ -1,3 +1,22 @@
+---------------------------------------------------------------------------------------------------------
+v0.3.6.0
+---------------------------------------------------------------------------------------------------------
+
+- bunch of crew AI improvements and bugfixes: they are now much better at keeping themselves alive and
+fixing leaks
+- crew AI can be toggled on and off using "DisableCrewAi" and "EnableCrewAi" commands
+- fixed crashing when switching from wiring mode to character mode
+- inventory is visible in wiring mode
+- several wiring bugfixes
+- emergency sirens and alarm buzzers
+- fixed light components throwing errors when receiving an invalid color value to the "set_color" input
+- fixed bright lights making it impossible to see whether a light component is on or off
+- relay components break if too much power is directed through them
+- relay components are active by default and they can be toggled on/off in the editor
+- wires can be created in fabricators
+- label text color can be changed
+- boolean (true/false) properties are displayed as checkboxes in the editor
+
---------------------------------------------------------------------------------------------------------
v0.3.5.1
---------------------------------------------------------------------------------------------------------
diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo
index 8ae8f4da7..e146c133c 100644
Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ