- npcs wont try grab items from other characters' inventories
- fixed lightcomponent LightSprites "twitching" when the sub is moving - fixed null reference exceptions in Hull.Render if no submarine has been loaded - submarine descriptions - emergency sirens in Aegir & Vellamo - changed the required item for fabricating a wire from "Copper" to "Copper Bar"
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<fabricableitem name="Railgun Shell" requireditems="Steel Bar, Steel Bar, Polycarbonate Bar" requiredtime="20"/>
|
||||
<fabricableitem name="Nuclear Shell" requireditems="Steel Bar, Steel Bar, Uranium Bar, Polycarbonate Bar" requiredtime="30"/>
|
||||
|
||||
<fabricableitem name="Wire" requireditems="Copper" requiredtime="5"/>
|
||||
<fabricableitem name="Wire" requireditems="Copper Bar" requiredtime="5"/>
|
||||
|
||||
<fabricableitem name="Button" requireditems="Steel Bar, FPGA Circuit" requiredtime="10"/>
|
||||
<fabricableitem name="And Component" requireditems="Steel Bar, FPGA Circuit" requiredtime="10"/>
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user