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:
@@ -68,6 +68,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
item.body.FarseerBody.IgnoreCollisionWith(l.body.FarseerBody);
|
||||
|
||||
if (character.AnimController.InWater) continue;
|
||||
if (l.type == LimbType.LeftFoot || l.type == LimbType.LeftThigh || l.type == LimbType.LeftLeg) continue;
|
||||
|
||||
if (l.type == LimbType.Head || l.type == LimbType.Torso)
|
||||
|
||||
@@ -95,8 +95,10 @@ namespace Barotrauma.Items.Components
|
||||
if (item.body!= null && !item.body.Enabled)
|
||||
{
|
||||
Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
|
||||
|
||||
item.SetTransform(rightHand.SimPosition, 0.0f);
|
||||
item.body.Enabled = true;
|
||||
|
||||
}
|
||||
picker.Inventory.RemoveItem(item);
|
||||
picker = null;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Barotrauma.Items.Components
|
||||
else
|
||||
{
|
||||
pingState = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
@@ -201,6 +201,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
prevPos = pos;
|
||||
}
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
private void DrawMarker(SpriteBatch spriteBatch, string label, Vector2 position, float scale, Vector2 center, float radius)
|
||||
|
||||
@@ -427,7 +427,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
message.Write(autoTemp);
|
||||
message.WriteRangedSingle(temperature, 0.0f, 10000.0f, 16);
|
||||
message.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 7);
|
||||
message.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 8);
|
||||
|
||||
message.WriteRangedSingle(coolingRate, 0.0f, 100.0f, 8);
|
||||
message.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8);
|
||||
@@ -443,8 +443,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
newAutoTemp = message.ReadBoolean();
|
||||
newTemperature = message.ReadRangedSingle(0.0f, 10000.0f, 16);
|
||||
newShutDownTemp = message.ReadRangedSingle(0.0f, 10000.0f, 7);
|
||||
newShutDownTemp = MathUtils.Round(newShutDownTemp, 100.0f);
|
||||
newShutDownTemp = message.ReadRangedSingle(0.0f, 10000.0f, 8);
|
||||
newShutDownTemp = MathUtils.RoundTowardsClosest(newShutDownTemp, 100.0f);
|
||||
|
||||
newCoolingRate = message.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
newFissionRate = message.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Barotrauma.Items.Components
|
||||
private bool valueChanged;
|
||||
|
||||
private float autopilotRayCastTimer;
|
||||
|
||||
|
||||
bool AutoPilot
|
||||
{
|
||||
get { return autoPilot; }
|
||||
@@ -104,6 +104,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
item.SendSignal(targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out");
|
||||
|
||||
item.SendSignal((-targetVelocity.Y).ToString(CultureInfo.InvariantCulture), "velocity_y_out");
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -130,12 +130,13 @@ namespace Barotrauma.Items.Components
|
||||
Projectile projectileComponent = null;
|
||||
//search for a projectile from linked containers
|
||||
Item projectile = null;
|
||||
Item projectileContainer = null;
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
Item container = e as Item;
|
||||
if (container == null) continue;
|
||||
projectileContainer = e as Item;
|
||||
if (projectileContainer == null) continue;
|
||||
|
||||
ItemContainer containerComponent = container.GetComponent<ItemContainer>();
|
||||
ItemContainer containerComponent = projectileContainer.GetComponent<ItemContainer>();
|
||||
if (containerComponent == null) continue;
|
||||
|
||||
for (int i = 0; i < containerComponent.inventory.items.Length; i++)
|
||||
@@ -182,7 +183,7 @@ namespace Barotrauma.Items.Components
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation);
|
||||
|
||||
projectileComponent.Use(deltaTime);
|
||||
item.RemoveContained(projectile);
|
||||
projectileContainer.RemoveContained(projectile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user