waypoint selection bug, unequipped captain uniform sprites, repairtool sounds & particle tweaking, wire overlap bug, connectionpanel loading bug, looting dead crew members

This commit is contained in:
Regalis
2015-08-04 20:11:59 +03:00
parent 9149408b36
commit 048eb5713f
24 changed files with 154 additions and 71 deletions
@@ -19,7 +19,8 @@ namespace Subsurface
private static LimbSlot[] limbSlots = new LimbSlot[] {
LimbSlot.Head, LimbSlot.Torso, LimbSlot.Legs, LimbSlot.LeftHand, LimbSlot.RightHand,
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any };
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any,
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any};
private Vector2[] slotPositions;
@@ -52,12 +53,12 @@ namespace Subsurface
case 4:
slotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 3),
Game1.GraphicsHeight - (spacing + rectHeight));
Game1.GraphicsHeight - (spacing + rectHeight)*3);
break;
default:
slotPositions[i] = new Vector2(
spacing * (4 + (i - 5)) + rectWidth * (3 + (i - 5)),
Game1.GraphicsHeight - (spacing + rectHeight));
spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 3)%5),
Game1.GraphicsHeight - (spacing + rectHeight) * ((i>9) ? 2 : 1));
break;
}
}
@@ -212,7 +213,7 @@ namespace Subsurface
}
public override void Draw(SpriteBatch spriteBatch)
public void DrawOwn(SpriteBatch spriteBatch)
{
if (doubleClickedItem!=null && doubleClickedItem.inventory!=this)
{
@@ -251,7 +252,7 @@ namespace Subsurface
slotRect.Y = (int)slotPositions[i].Y;
UpdateSlot(spriteBatch, slotRect, i, items[i], false);
UpdateSlot(spriteBatch, slotRect, i, items[i], i>4);
if (draggingItem!=null && draggingItem == items[i]) draggingItemSlot = slotRect;
}
@@ -58,8 +58,8 @@ namespace Subsurface.Items.Components
[HasDefaultValue(0.0f, false)]
public float ItemRotation
{
get { return itemRotation; }
set { itemRotation = value; }
get { return MathHelper.ToDegrees(itemRotation); }
set { itemRotation = MathHelper.ToRadians(value); }
}
private float itemRotation;
@@ -183,6 +183,17 @@ namespace Subsurface.Items.Components
if (!attachable || item.body==null) return true;
item.Drop();
var containedItems = item.ContainedItems;
if (containedItems!=null)
{
foreach (Item contained in containedItems)
{
if (contained.body == null) continue;
contained.SetTransform(item.SimPosition, contained.body.Rotation);
}
}
item.body.Enabled = false;
item.body = null;
@@ -124,7 +124,7 @@ namespace Subsurface.Items.Components
Body targetBody = Submarine.PickBody(TransformedBarrelPos, targetPosition, ignoredBodies);
pickedPosition = Submarine.LastPickedPosition;
if (targetBody==null || targetBody.UserData==null) return true;
if (targetBody == null || targetBody.UserData == null) return true;
//ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
@@ -550,9 +550,7 @@ namespace Subsurface.Items.Components
public virtual void Load(XElement componentElement)
{
if (componentElement == null) return;
if (componentElement == null) return;
foreach (XAttribute attribute in componentElement.Attributes())
{
@@ -179,6 +179,10 @@ namespace Subsurface.Items.Components
foreach (Item contained in item.ContainedItems)
{
contained.Condition = 0.0f;
if (contained.body!=null)
{
contained.body.SetTransform(item.SimPosition, contained.body.Rotation);
}
}
return true;
@@ -28,7 +28,7 @@ namespace Subsurface.Items.Components
private List<StatusEffect> effects;
int[] wireId;
public readonly int[] wireId;
public List<Connection> Recipients
{
@@ -463,7 +463,7 @@ namespace Subsurface.Items.Components
}
}
wireId = null;
//wireId = null;
}
}
@@ -74,21 +74,26 @@ namespace Subsurface.Items.Components
public override void Load(XElement element)
{
base.Load(element);
connections.Clear();
List<Connection> loadedConnections = new List<Connection>();
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString())
{
case "input":
connections.Add(new Connection(subElement, item));
loadedConnections.Add(new Connection(subElement, item));
break;
case "output":
connections.Add(new Connection(subElement, item));
loadedConnections.Add(new Connection(subElement, item));
break;
}
}
for (int i = 0; i<loadedConnections.Count && i<connections.Count; i++)
{
loadedConnections[i].wireId.CopyTo(connections[i].wireId, 0);
}
}
public override void Remove()
@@ -274,12 +274,12 @@ namespace Subsurface.Items.Components
for (int i = 1; i < Nodes.Count; i++)
{
DrawSection(spriteBatch, Nodes[i], Nodes[i - 1], i, item.Color);
DrawSection(spriteBatch, Nodes[i], Nodes[i - 1], item.Color);
}
if (isActive && Vector2.Distance(newNodePos, Nodes[Nodes.Count - 1]) > nodeDistance)
{
DrawSection(spriteBatch, Nodes[Nodes.Count - 1], newNodePos, Nodes.Count, item.Color * 0.5f);
DrawSection(spriteBatch, Nodes[Nodes.Count - 1], newNodePos, item.Color * 0.5f);
//nodes.Add(newNodePos);
}
@@ -333,7 +333,7 @@ selectedNodeIndex = null;
}
private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, int i, Color color)
private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color)
{
start.Y = -start.Y;
end.Y = -end.Y;
@@ -344,7 +344,7 @@ selectedNodeIndex = null;
new Vector2(0.0f, wireSprite.size.Y / 2.0f),
new Vector2((Vector2.Distance(start, end)) / wireSprite.Texture.Width, 0.3f),
SpriteEffects.None,
wireSprite.Depth + 0.1f + i * 0.00001f);
wireSprite.Depth + ((item.ID % 100) * 0.00001f));
}
public override XElement Save(XElement parentElement)
+10 -2
View File
@@ -450,13 +450,21 @@ namespace Subsurface
{
if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive;
if (!ic.WasUsed) ic.StopSounds(ActionType.OnUse);
ic.WasUsed = false;
//if (!ic.WasUsed)
//{
// if (ic.Name == "RepairTool" && ic.IsActive)
// {
// System.Diagnostics.Debug.WriteLine("stop sounds");
// }
// ic.StopSounds(ActionType.OnUse);
//}
//ic.WasUsed = false;
if (!ic.IsActive)
{
ic.StopSounds(ActionType.OnActive);
ic.StopSounds(ActionType.OnUse);
continue;
}
if (condition > 0.0f)