Added wire-tag to all wires (to allow using it for fixes even if the name isn't ''Wire''), disconnect networkmember when going to main menu, fixed questmode crashing in multiplayer, fixed too short seeds throwing an error, attachable items aren't attached if secondary key isn't held, update hull when attaching an item, dropping connected wires when detaching items, kicking players with a button click instead of debugconsole

This commit is contained in:
Regalis
2015-10-17 21:24:00 +03:00
parent 3c1a66078c
commit aa3882a815
15 changed files with 156 additions and 51 deletions
+5 -2
View File
@@ -238,6 +238,8 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
convexHull.Enabled = true;
if (convexHull2 != null) convexHull2.Enabled = true;
if (!isStuck)
{
OpenState += deltaTime * ((isOpen) ? 2.0f : -2.0f);
@@ -251,9 +253,10 @@ namespace Barotrauma.Items.Components
public override void UpdateBroken(float deltaTime, Camera cam)
{
body.Enabled = false;
//convexHull.Enabled = false;
convexHull.Enabled = false;
if (convexHull2 != null) convexHull2.Enabled = false;
linkedGap.Open = 1.0f;
//if (convexHull2 != null) convexHull2.Enabled = false;
}
public override void Draw(SpriteBatch spriteBatch, bool editing)
@@ -181,6 +181,7 @@ namespace Barotrauma.Items.Components
public override bool Use(float deltaTime, Character character = null)
{
if (!attachable || item.body==null) return true;
if (character != null && !character.GetInputState(InputType.SecondaryHeld)) return false;
item.Drop();
@@ -202,6 +203,8 @@ namespace Barotrauma.Items.Components
attached = true;
item.NewComponentEvent(this, true);
return true;
}
@@ -247,5 +250,29 @@ namespace Barotrauma.Items.Components
Msg = "";
}
}
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
{
message.Write(item.SimPosition.X);
message.Write(item.SimPosition.Y);
}
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
{
Vector2 newPos = Vector2.Zero;
try
{
newPos = new Vector2(message.ReadFloat(), message.ReadFloat());
}
catch
{
return;
}
item.SetTransform(newPos, 0.0f);
if (!attached) Use(1.0f);
}
}
}
@@ -46,6 +46,21 @@ namespace Barotrauma.Items.Components
item.linkedTo[i].RemoveLinked(item);
item.linkedTo.Clear();
var connectionPanel = item.GetComponent<ConnectionPanel>();
if (connectionPanel!=null)
{
foreach (Connection c in connectionPanel.connections)
{
foreach (Wire w in c.Wires)
{
if (w == null) continue;
w.Item.Drop(picker);
w.Item.SetTransform(item.SimPosition, 0.0f);
}
}
}
ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
//foreach (StatusEffect effect in item.Prefab.statusEffects)