Merge remote-tracking branch 'barotrauma/master' into new-netcode

# Conflicts:
#	Subsurface/Source/Characters/Character.cs
#	Subsurface/Source/Items/Components/Machines/Steering.cs
#	Subsurface/Source/Map/Structure.cs
#	Subsurface/Source/Networking/GameClient.cs
#	Subsurface/Source/Networking/GameServer.cs
This commit is contained in:
juanjp600
2016-11-05 18:09:44 -03:00
42 changed files with 431 additions and 177 deletions

View File

@@ -13,10 +13,7 @@ namespace Barotrauma
protected Character character;
protected float walkSpeed, swimSpeed;
//how large impacts the Character can take before being stunned
//protected float impactTolerance;
protected float stunTimer;
protected float walkPos;
@@ -47,14 +44,7 @@ namespace Barotrauma
walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f);
swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f);
//stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One);
//stepOffset = ConvertUnits.ToSimUnits(stepOffset);
//impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
legTorque = ToolBox.GetAttributeFloat(element, "legtorque", 0.0f);
}
public virtual void UpdateAnim(float deltaTime) { }

View File

@@ -224,6 +224,12 @@ namespace Barotrauma
}
}
public float ImpactTolerance
{
get;
private set;
}
public float StrongestImpact
{
get { return strongestImpact; }
@@ -257,6 +263,8 @@ namespace Barotrauma
torsoPosition = ConvertUnits.ToSimUnits(torsoPosition);
torsoAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "torsoangle", 0.0f));
ImpactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 50.0f);
CanEnterSubmarine = ToolBox.GetAttributeBool(element, "canentersubmarine", true);
foreach (XElement subElement in element.Elements())
@@ -471,11 +479,11 @@ namespace Barotrauma
{
if (!character.IsRemotePlayer || GameMain.Server != null)
{
if (impact > 8.0f)
if (impact > ImpactTolerance)
{
character.AddDamage(CauseOfDeath.Damage, impact - 8.0f, null);
character.AddDamage(CauseOfDeath.Damage, impact - ImpactTolerance, null);
SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, collider);
strongestImpact = Math.Max(strongestImpact, impact - 8.0f);
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
}
}
@@ -852,7 +860,6 @@ namespace Barotrauma
//limb.body.ApplyLinearImpulse(impulse);
int n = (int)((limb.Position.X - limbHull.Rect.X) / Hull.WaveWidth);
limbHull.WaveVel[n] = Math.Min(impulse.Y * 1.0f, 5.0f);
StrongestImpact = ((impulse.Length() * 0.5f) - limb.impactTolerance);
}
}
}