v0.2.2: updated Lidgren, railgun shells can be bought, autorestart server, netstats, tutorial moloch spawning in a wall fix, misc error checks

This commit is contained in:
Regalis
2015-10-18 22:44:30 +03:00
parent aa3882a815
commit 0e5e86e363
85 changed files with 2763 additions and 1866 deletions
@@ -131,6 +131,18 @@ namespace Barotrauma.Items.Components
{
picker = character;
if (item.body == null)
{
if (body!=null)
{
item.body = body;
}
else
{
return;
}
}
if (!item.body.Enabled)
{
Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
@@ -41,6 +41,7 @@ namespace Barotrauma.Items.Components
null, null, true);
textBlock.Font = GUI.SmallFont;
textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
textBlock.TextDepth = item.Sprite.Depth - 0.0001f;
}
return textBlock;
}
@@ -103,7 +103,11 @@ namespace Barotrauma.Items.Components
if (stickJoint != null && doesStick)
{
if (stickTarget!=null) item.body.FarseerBody.RestoreCollisionWith(stickTarget);
if (stickTarget != null)
{
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
stickTarget = null;
}
GameMain.World.RemoveJoint(stickJoint);
stickJoint = null;
}
@@ -111,25 +115,19 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
if (stickJoint != null)
if (stickJoint != null && stickJoint.JointTranslation < 0.01f)
{
if (stickJoint.JointTranslation < 0.01f)
if (stickTarget!=null)
{
if (stickTarget!=null)
{
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
}
GameMain.World.RemoveJoint(stickJoint);
stickJoint = null;
IsActive = false;
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
stickTarget = null;
}
}
else
{
IsActive = false;
}
GameMain.World.RemoveJoint(stickJoint);
stickJoint = null;
IsActive = false;
}
}
private bool OnProjectileCollision(Fixture f1, Fixture f2, Contact contact)
+8
View File
@@ -230,6 +230,13 @@ namespace Barotrauma
int itemCapacity = item.Capacity;
if (itemCapacity == 0) return;
#if DEBUG
System.Diagnostics.Debug.Assert(slotIndex>=0 && slotIndex<items.Length);
#else
if (slotIndex<0 || slotIndex>=items.Length) return;
#endif
Rectangle containerRect = new Rectangle(rect.X - 5, rect.Y - (rect.Height + 10) * itemCapacity - 5,
rect.Width + 10, rect.Height + (rect.Height + 10) * itemCapacity + 10);
@@ -253,6 +260,7 @@ namespace Barotrauma
protected void DrawSlot(SpriteBatch spriteBatch, Rectangle rect, Item item, bool isHighLighted, bool isSubSlot)
{
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * ((isSubSlot) ? 0.1f : 0.3f), true);
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * ((isSubSlot) ? 0.2f : 0.4f), false);
if (item == null) return;
+19 -6
View File
@@ -1163,11 +1163,19 @@ namespace Barotrauma
switch (type)
{
case NetworkEventType.DropItem:
if (body != null) body.FillNetworkData(type, message);
if (body != null)
{
message.Write(body.SimPosition.X);
message.Write(body.SimPosition.Y);
}
break;
case NetworkEventType.UpdateComponent:
message.Write((int)data);
components[(int)data].FillNetworkData(type, message);
int componentIndex = (int)data;
if (componentIndex < 0 || componentIndex >= components.Count) return;
message.Write((byte)componentIndex);
components[componentIndex].FillNetworkData(type, message);
break;
case NetworkEventType.UpdateProperty:
var allProperties = GetProperties<InGameEditable>();
@@ -1215,11 +1223,16 @@ namespace Barotrauma
switch (type)
{
case NetworkEventType.DropItem:
if (body != null) body.ReadNetworkData(type, message);
Vector2 newSimPos = Vector2.Zero;
if (body != null)
{
newSimPos = new Vector2(message.ReadFloat(), message.ReadFloat());
}
SetTransform(newSimPos, body.Rotation);
Drop(null, false);
break;
case NetworkEventType.UpdateComponent:
int componentIndex = message.ReadInt32();
int componentIndex = message.ReadByte();
if (componentIndex < 0 || componentIndex > components.Count - 1) return;
components[componentIndex].ReadNetworkData(type, message);
break;
@@ -1272,7 +1285,7 @@ namespace Barotrauma
base.Remove();
//sprite.Remove();
if (body != null) body.Remove();
//if (body != null) body.Remove();
foreach (ItemComponent ic in components)
{