Networking bugfixes, underwater scooter, fixed limbs going through walls when flipping the ragdoll

This commit is contained in:
Regalis
2015-11-13 00:52:42 +02:00
parent 9c2aec4c8e
commit 24ed95cd68
26 changed files with 301 additions and 119 deletions
@@ -4,35 +4,15 @@ namespace Barotrauma.Items.Components
{
class WaterDetector : ItemComponent
{
private Hull hull;
public WaterDetector(Item item, XElement element)
: base (item, element)
{
hull = Hull.FindHull(item.Position);
IsActive = true;
}
public override void OnMapLoaded()
{
hull = Hull.FindHull(item.Position);
}
public override void Move(Microsoft.Xna.Framework.Vector2 amount)
{
hull = Hull.FindHull(item.Position);
}
public override void Update(float deltaTime, Camera cam)
{
if (hull == null) return;
float waterDepth = hull.Volume / hull.Size.X;
bool underWater = (hull.Rect.Y-hull.Rect.Height + waterDepth)>item.Position.Y;
item.SendSignal(underWater ? "1" : "0", "signal_out");
item.SendSignal(item.InWater ? "1" : "0", "signal_out");
}
}
}