- 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:
Regalis
2016-03-18 17:48:25 +02:00
parent 8df9864db9
commit fc8b30c974
18 changed files with 158 additions and 82 deletions
+6 -4
View File
@@ -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);
}
+14 -27
View File
@@ -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())
{