List of previously used mapentities in editor, waypoint sprites, properly generating waypoints for hatches, waypoint paths are saved in editor instead of generating them on loading, gap particle bugfix, separate waypoint and spawnpoint prefabs, turret rotation limits visible in editor, hatch convexhull fix, new railgunloader sprite

This commit is contained in:
Regalis
2016-01-17 15:45:16 +02:00
parent 8e491ae855
commit 5f1cb194ab
20 changed files with 316 additions and 106 deletions
+13 -13
View File
@@ -25,7 +25,7 @@ namespace Barotrauma
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any,
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any};
private Vector2[] slotPositions;
public Vector2[] SlotPositions;
public CharacterInventory(int capacity, Character character)
: base(character, capacity)
@@ -34,11 +34,11 @@ namespace Barotrauma
if (icons == null) icons = TextureLoader.FromFile("Content/UI/inventoryIcons.png");
slotPositions = new Vector2[limbSlots.Length];
SlotPositions = new Vector2[limbSlots.Length];
int rectWidth = 40, rectHeight = 40;
int spacing = 10;
for (int i = 0; i < slotPositions.Length; i++)
for (int i = 0; i < SlotPositions.Length; i++)
{
switch (i)
{
@@ -46,19 +46,19 @@ namespace Barotrauma
case 0:
case 1:
case 2:
slotPositions[i] = new Vector2(
SlotPositions[i] = new Vector2(
spacing,
GameMain.GraphicsHeight - (spacing + rectHeight) * (3 - i));
break;
//lefthand, righthand
case 3:
case 4:
slotPositions[i] = new Vector2(
SlotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 3),
GameMain.GraphicsHeight - (spacing + rectHeight)*3);
break;
default:
slotPositions[i] = new Vector2(
SlotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 3)%5),
GameMain.GraphicsHeight - (spacing + rectHeight) * ((i>9) ? 2 : 1));
break;
@@ -225,8 +225,8 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++)
{
slotRect.X = (int)slotPositions[i].X;
slotRect.Y = (int)slotPositions[i].Y;
slotRect.X = (int)SlotPositions[i].X;
slotRect.Y = (int)SlotPositions[i].Y;
if (i==1) //head
{
@@ -246,8 +246,8 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++)
{
slotRect.X = (int)slotPositions[i].X;
slotRect.Y = (int)slotPositions[i].Y;
slotRect.X = (int)SlotPositions[i].X;
slotRect.Y = (int)SlotPositions[i].Y;
bool multiSlot = false;
//skip if the item is in multiple slots
@@ -285,8 +285,8 @@ namespace Barotrauma
//check if the item is in multiple slots
if (Items[i] != null)
{
slotRect.X = (int)slotPositions[i].X;
slotRect.Y = (int)slotPositions[i].Y;
slotRect.X = (int)SlotPositions[i].X;
slotRect.Y = (int)SlotPositions[i].Y;
slotRect.Width = 40;
slotRect.Height = 40;
@@ -300,7 +300,7 @@ namespace Barotrauma
{
multiSlot = true;
slotRect = Rectangle.Union(
new Rectangle((int)slotPositions[n].X, (int)slotPositions[n].Y, rectWidth, rectHeight), slotRect);
new Rectangle((int)SlotPositions[n].X, (int)SlotPositions[n].Y, rectWidth, rectHeight), slotRect);
}
}
}
+14 -15
View File
@@ -13,12 +13,12 @@ namespace Barotrauma.Items.Components
{
class Door : ItemComponent
{
Gap linkedGap;
private Gap linkedGap;
Rectangle window;
private Rectangle window;
ConvexHull convexHull;
ConvexHull convexHull2;
private ConvexHull convexHull;
private ConvexHull convexHull2;
private bool isOpen;
@@ -45,7 +45,7 @@ namespace Barotrauma.Items.Components
}
}
Gap LinkedGap
public Gap LinkedGap
{
get
{
@@ -139,7 +139,7 @@ namespace Barotrauma.Items.Components
doorRect = new Rectangle(
item.Rect.Center.X - (int)(doorSprite.size.X / 2),
item.Rect.Y,
item.Rect.Y - item.Rect.Height/2 + (int)(doorSprite.size.Y / 2.0f),
(int)doorSprite.size.X,
(int)doorSprite.size.Y);
@@ -165,24 +165,23 @@ namespace Barotrauma.Items.Components
private void UpdateConvexHulls()
{
Rectangle rect = doorRect;
rect.Height = (int)(rect.Height * (1.0f - openState));
if (window.Height == 0 || window.Width == 0)
if (isHorizontal)
{
rect.Width = (int)(rect.Width * (1.0f - openState));
}
else
{
//Rectangle rect = item.Rect;
//rect.Height = (int)(rect.Height * (1.0f - openState));
rect.Height = (int)(rect.Height * (1.0f - openState));
}
if (window.Height > 0 && window.Width > 0)
{
rect.Height = -window.Y;
rect.Y += (int)(doorRect.Height * openState);
rect.Height = Math.Max(rect.Height - (rect.Y - doorRect.Y), 0);
rect.Y = Math.Min(doorRect.Y, rect.Y);
if (convexHull2 != null)
{
Rectangle rect2 = doorRect;
@@ -395,8 +394,8 @@ namespace Barotrauma.Items.Components
if (isHorizontal)
{
l.body.SetTransform(new Vector2(l.SimPosition.X, item.SimPosition.Y + dir * simSize.Y * 1.2f), l.body.Rotation);
l.body.ApplyLinearImpulse(new Vector2(isOpen ? 0.0f : 1.0f, dir * 0.5f));
l.body.SetTransform(new Vector2(l.SimPosition.X, item.SimPosition.Y + dir * simSize.Y * 2.0f), l.body.Rotation);
l.body.ApplyLinearImpulse(new Vector2(isOpen ? 0.0f : 1.0f, dir * 2.0f));
}
else
{
@@ -89,6 +89,24 @@ namespace Barotrauma.Items.Components
drawPos + barrelPos, Color.White,
rotation + MathHelper.PiOver2, 1.0f,
SpriteEffects.None, item.Sprite.Depth+0.01f);
if (!editing) return;
GUI.DrawLine(spriteBatch,
drawPos + barrelPos,
drawPos + barrelPos + new Vector2((float)Math.Cos(minRotation), (float)Math.Sin(minRotation))*60.0f,
Color.Green);
GUI.DrawLine(spriteBatch,
drawPos + barrelPos,
drawPos + barrelPos + new Vector2((float)Math.Cos(maxRotation), (float)Math.Sin(maxRotation)) * 60.0f,
Color.Green);
GUI.DrawLine(spriteBatch,
drawPos + barrelPos,
drawPos + barrelPos + new Vector2((float)Math.Cos((maxRotation + minRotation) / 2), (float)Math.Sin((maxRotation + minRotation) / 2)) * 60.0f,
Color.LightGreen);
}
public override void Update(float deltaTime, Camera cam)
+10 -3
View File
@@ -908,8 +908,8 @@ namespace Barotrauma
transformedTrigger.X + transformedTrigger.Width / 2.0f,
transformedTrigger.Y - transformedTrigger.Height / 2.0f);
dist = MathHelper.Min(Math.Abs(triggerCenter.X - displayPos.X), Math.Abs(triggerCenter.Y-displayPos.Y));
if (dist > closestDist && closest!=null) continue;
//dist = MathHelper.Min(Math.Abs(triggerCenter.X - displayPos.X), Math.Abs(triggerCenter.Y-displayPos.Y));
//if (dist > closestDist && closest!=null) continue;
dist = MathHelper.Min(Math.Abs(triggerCenter.X - displayPickPos.X), Math.Abs(triggerCenter.Y - displayPickPos.Y));
if (closest == null || dist < closestDist)
@@ -951,6 +951,13 @@ namespace Barotrauma
return false;
}
public bool IsInPickRange(Vector2 worldPosition)
{
if (IsInsideTrigger(worldPosition)) return true;
return Vector2.Distance(WorldPosition, worldPosition) < PickDistance;
}
public bool Pick(Character picker, bool ignoreRequiredItems=false, bool forceSelectKey=false, bool forceActionKey=false)
{
@@ -1019,7 +1026,7 @@ namespace Barotrauma
picker.SelectedConstruction = this;
}
if (!hasRequiredSkills && Character.Controlled==picker)
if (!hasRequiredSkills && Character.Controlled==picker && Screen.Selected != GameMain.EditMapScreen)
{
GUI.AddMessage("Your skills may be insufficient to use the item!", Color.Red, 5.0f);
if (requiredSkill != null)