Improved level generation algorithm, fixed invisible hulls, turret projectile fix, fabricators work in mp
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
|
||||
[HasDefaultValue(false, true)]
|
||||
public bool Attached
|
||||
{
|
||||
get { return attached; }
|
||||
get { return attached && item.Inventory == null; }
|
||||
set { attached = value; }
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Barotrauma.Items.Components
|
||||
Msg = "";
|
||||
}
|
||||
|
||||
if (attachedByDefault || (Screen.Selected == GameMain.EditMapScreen && Submarine.Loaded!=null)) Use(1.0f);
|
||||
if (attachedByDefault || (Screen.Selected == GameMain.EditMapScreen && Submarine.Loaded!=null)) Use(1.0f);
|
||||
|
||||
|
||||
//holdAngle = ToolBox.GetAttributeFloat(element, "holdangle", 0.0f);
|
||||
@@ -259,12 +259,22 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
//prevRequiredItems = new List<RelatedItem>(requiredItems);
|
||||
|
||||
if (attached)
|
||||
if (Attached)
|
||||
{
|
||||
Use(1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if (item.Inventory!=null)
|
||||
{
|
||||
if (body != null)
|
||||
{
|
||||
item.body = body;
|
||||
body.Enabled = false;
|
||||
}
|
||||
attached = false;
|
||||
}
|
||||
|
||||
requiredItems.Clear();
|
||||
Msg = "";
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
class ItemContainer : ItemComponent
|
||||
{
|
||||
public const int MaxInventoryCount = 4;
|
||||
|
||||
List<RelatedItem> containableItems;
|
||||
public ItemInventory Inventory;
|
||||
|
||||
|
||||
@@ -301,6 +301,10 @@ namespace Barotrauma.Items.Components
|
||||
int itemIndex = fabricatedItem == null ? -1 : fabricableItems.IndexOf(fabricatedItem);
|
||||
|
||||
message.WriteRangedInteger(-1, fabricableItems.Count-1, itemIndex);
|
||||
|
||||
var containers = item.GetComponents<ItemContainer>();
|
||||
containers[0].Inventory.FillNetworkData(type, message, null);
|
||||
containers[1].Inventory.FillNetworkData(type, message, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -311,6 +315,10 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
int itemIndex = message.ReadRangedInteger(-1, fabricableItems.Count-1);
|
||||
|
||||
var containers = item.GetComponents<ItemContainer>();
|
||||
containers[0].Inventory.ReadNetworkData(type, message, sendingTime);
|
||||
containers[1].Inventory.ReadNetworkData(type, message, sendingTime);
|
||||
|
||||
if (itemIndex == -1)
|
||||
{
|
||||
CancelFabricating();
|
||||
@@ -324,7 +332,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
SelectItem(null, fabricableItems[itemIndex]);
|
||||
StartFabricating(fabricableItems[itemIndex]);
|
||||
timeUntilReady -= sendingTime - (float)Lidgren.Network.NetTime.Now;
|
||||
}
|
||||
|
||||
lastNetworkUpdate = sendingTime;
|
||||
|
||||
@@ -177,6 +177,8 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.OnUse, 1.0f, null);
|
||||
|
||||
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
|
||||
|
||||
item.body.FarseerBody.IsBullet = false;
|
||||
|
||||
@@ -172,6 +172,8 @@ namespace Barotrauma.Items.Components
|
||||
projectile.body.ResetDynamics();
|
||||
projectile.body.Enabled = true;
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
|
||||
projectile.FindHull();
|
||||
projectile.Submarine = projectile.body.Submarine;
|
||||
|
||||
projectiles[0].Use(deltaTime);
|
||||
projectiles[0].User = character;
|
||||
|
||||
Reference in New Issue
Block a user