Ragdoll raycast crash, holding items in correct angles, ghost wires, dropping items properly in editmapscreen, radar wont work without power, remove wire from connectors if its deleted
This commit is contained in:
@@ -281,6 +281,7 @@ namespace Barotrauma.Items.Components
|
||||
if (!PlayerInput.LeftButtonDown())
|
||||
{
|
||||
panel.Item.NewComponentEvent(panel, true, true);
|
||||
//draggingConnected.Drop(character);
|
||||
draggingConnected = null;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +319,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (index>-1 && wireComponent!=null && !Wires.Contains(wireComponent))
|
||||
{
|
||||
wireComponent.RemoveConnection(item);
|
||||
|
||||
Wires[index] = wireComponent;
|
||||
wireComponent.Connect(this);
|
||||
}
|
||||
@@ -325,15 +328,15 @@ namespace Barotrauma.Items.Components
|
||||
//far away -> disconnect if the wire is linked to this connector
|
||||
else
|
||||
{
|
||||
int index = FindWireIndex(draggingConnected);
|
||||
if (index>-1)
|
||||
{
|
||||
Wires[index].RemoveConnection(this);
|
||||
//Wires[index].Item.SetTransform(item.SimPosition, 0.0f);
|
||||
//Wires[index].Item.Drop();
|
||||
//Wires[index].Item.body.Enabled = true;
|
||||
Wires[index] = null;
|
||||
}
|
||||
//int index = FindWireIndex(draggingConnected);
|
||||
//if (index>-1)
|
||||
//{
|
||||
// Wires[index].RemoveConnection(this);
|
||||
// //Wires[index].Item.SetTransform(item.SimPosition, 0.0f);
|
||||
// //Wires[index].Item.Drop();
|
||||
// //Wires[index].Item.body.Enabled = true;
|
||||
// Wires[index] = null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace Barotrauma.Items.Components
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
if (character != Character.Controlled || character != user) return;
|
||||
|
||||
if (character.GetInputState(InputType.Select) &&
|
||||
character.SelectedConstruction==this.item) character.SelectedConstruction = null;
|
||||
|
||||
Connection.DrawConnections(spriteBatch, this, character);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,23 @@ namespace Barotrauma.Items.Components
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveConnection(Item item)
|
||||
{
|
||||
for (int i = 0; i<2; i++)
|
||||
{
|
||||
if (connections[i]==null || connections[i].Item!=item) continue;
|
||||
|
||||
for (int n = 0; n< connections[i].Wires.Length; n++)
|
||||
{
|
||||
if (connections[i].Wires[n] == this) connections[i].Wires[n] = null;
|
||||
}
|
||||
connections[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveConnection(Connection connection)
|
||||
{
|
||||
if (connection == connections[0]) connections[0] = null;
|
||||
if (connection == connections[0]) connections[0] = null;
|
||||
if (connection == connections[1]) connections[1] = null;
|
||||
}
|
||||
|
||||
@@ -407,6 +421,13 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
{
|
||||
ClearConnections();
|
||||
|
||||
base.Remove();
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
{
|
||||
message.Write((byte)Math.Min(Nodes.Count, 10));
|
||||
|
||||
Reference in New Issue
Block a user