Unstable 1.8.4.0
This commit is contained in:
@@ -213,7 +213,9 @@ namespace Barotrauma
|
||||
public readonly Ragdoll ragdoll;
|
||||
public readonly LimbParams Params;
|
||||
|
||||
//the physics body of the limb
|
||||
/// <summary>
|
||||
/// The physics body of the limb
|
||||
/// </summary>
|
||||
public PhysicsBody body;
|
||||
|
||||
public Vector2 StepOffset => ConvertUnits.ToSimUnits(Params.StepOffset) * ragdoll.RagdollParams.JointScale;
|
||||
@@ -258,10 +260,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!mouthPos.HasValue)
|
||||
{
|
||||
mouthPos = Params.MouthPos;
|
||||
}
|
||||
mouthPos ??= Params.MouthPos;
|
||||
return mouthPos.Value;
|
||||
}
|
||||
set
|
||||
@@ -366,7 +365,7 @@ namespace Barotrauma
|
||||
if (isSevered)
|
||||
{
|
||||
ragdoll.SubtractMass(this);
|
||||
if (type == LimbType.Head)
|
||||
if (type == LimbType.Head && character.Params.Health.DieFromBeheading)
|
||||
{
|
||||
character.Kill(CauseOfDeathType.Unknown, null);
|
||||
}
|
||||
@@ -386,10 +385,18 @@ namespace Barotrauma
|
||||
|
||||
public Submarine Submarine => character?.Submarine;
|
||||
|
||||
private bool _hidden;
|
||||
public bool Hidden
|
||||
{
|
||||
get => Params.Hide;
|
||||
set => Params.Hide = value;
|
||||
get => _hidden || Params.Hide;
|
||||
set => _hidden = value;
|
||||
}
|
||||
|
||||
// Just a wrapper for Hidden, but both can be used via status effects, so it's not safe to remove it.
|
||||
public bool Hide
|
||||
{
|
||||
get => Hidden;
|
||||
set => Hidden = value;
|
||||
}
|
||||
|
||||
public Vector2 WorldPosition
|
||||
@@ -523,6 +530,9 @@ namespace Barotrauma
|
||||
|
||||
public readonly List<WearableSprite> WearingItems = new List<WearableSprite>();
|
||||
|
||||
/// <summary>
|
||||
/// Other wearables attached to the head. I.e. husk sprite, hair, beard, moustache, and face attachments.
|
||||
/// </summary>
|
||||
public readonly List<WearableSprite> OtherWearables = new List<WearableSprite>();
|
||||
|
||||
public bool PullJointEnabled
|
||||
@@ -636,7 +646,7 @@ namespace Barotrauma
|
||||
//if (character.Params.CanInteract) { return false; }
|
||||
if (this == character.AnimController.MainLimb) { return false; }
|
||||
bool canBeSevered = Params.CanBeSeveredAlive;
|
||||
if (character.AnimController.CanWalk)
|
||||
if (character.AnimController.CanWalk && !character.Params.Health.AllowSeveringLegs)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -671,7 +681,7 @@ namespace Barotrauma
|
||||
this.character = character;
|
||||
this.Params = limbParams;
|
||||
dir = Direction.Right;
|
||||
body = new PhysicsBody(limbParams);
|
||||
body = new PhysicsBody(limbParams, findNewContacts: false);
|
||||
type = limbParams.Type;
|
||||
IgnoreCollisions = limbParams.IgnoreCollisions;
|
||||
body.UserData = this;
|
||||
@@ -716,7 +726,7 @@ namespace Barotrauma
|
||||
var attackElement = character.Params.VariantFile.GetRootExcludingOverride().GetChildElement("attack");
|
||||
if (attackElement != null)
|
||||
{
|
||||
attack.DamageMultiplier = attackElement.GetAttributeFloat("damagemultiplier", 1f);
|
||||
attack.SetInitialDamageMultiplier(attackElement.GetAttributeFloat("damagemultiplier", 1f));
|
||||
attack.RangeMultiplier = attackElement.GetAttributeFloat("rangemultiplier", 1f);
|
||||
attack.ImpactMultiplier = attackElement.GetAttributeFloat("impactmultiplier", 1f);
|
||||
}
|
||||
@@ -937,7 +947,7 @@ namespace Barotrauma
|
||||
severedFadeOutTimer = SeveredFadeOutTime;
|
||||
}
|
||||
}
|
||||
else if (!IsDead)
|
||||
else if (!IsDead && (character.IsPlayer || character.AIState is not AIState.PlayDead))
|
||||
{
|
||||
if (Params.BlinkFrequency > 0)
|
||||
{
|
||||
@@ -989,6 +999,7 @@ namespace Barotrauma
|
||||
public void ReEnable()
|
||||
{
|
||||
if (!temporarilyDisabled) { return; }
|
||||
temporarilyDisabled = false;
|
||||
Hidden = false;
|
||||
Disabled = false;
|
||||
IgnoreCollisions = originalIgnoreCollisions;
|
||||
@@ -1008,6 +1019,7 @@ namespace Barotrauma
|
||||
float dist = distance > -1 ? distance : ConvertUnits.ToDisplayUnits(Vector2.Distance(simPos, attackSimPos));
|
||||
bool wasRunning = attack.IsRunning;
|
||||
attack.UpdateAttackTimer(deltaTime, character);
|
||||
|
||||
if (attack.Blink)
|
||||
{
|
||||
if (attack.ForceOnLimbIndices != null && attack.ForceOnLimbIndices.Any())
|
||||
@@ -1156,7 +1168,7 @@ namespace Barotrauma
|
||||
// Set the main collider where the body lands after the attack
|
||||
if (Vector2.DistanceSquared(character.AnimController.Collider.SimPosition, character.AnimController.MainLimb.body.SimPosition) > 0.1f * 0.1f)
|
||||
{
|
||||
character.AnimController.Collider.SetTransform(character.AnimController.MainLimb.body.SimPosition, rotation: character.AnimController.Collider.Rotation);
|
||||
character.AnimController.Collider.SetTransformIgnoreContacts(character.AnimController.MainLimb.body.SimPosition, rotation: character.AnimController.Collider.Rotation);
|
||||
}
|
||||
}
|
||||
return wasHit;
|
||||
@@ -1172,9 +1184,11 @@ namespace Barotrauma
|
||||
LastAttackSoundTime = SoundInterval;
|
||||
}
|
||||
#endif
|
||||
if (damageTarget is Character targetCharacter && targetLimb != null)
|
||||
{
|
||||
attackResult = attack.DoDamageToLimb(character, targetLimb, WorldPosition, 1.0f, playSound, body, this);
|
||||
attack.ResetDamageMultiplier();
|
||||
attack.DamageMultiplier *= 1.0f + character.GetStatValue(attack.Ranged ? StatTypes.NaturalRangedAttackMultiplier : StatTypes.NaturalMeleeAttackMultiplier);
|
||||
if (damageTarget is Character && targetLimb != null)
|
||||
{
|
||||
attackResult = attack.DoDamageToLimb(character, targetLimb, WorldPosition, deltaTime: 1.0f, playSound, body, sourceLimb: this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1184,7 +1198,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
attackResult = attack.DoDamage(character, damageTarget, WorldPosition, 1.0f, playSound, body, this);
|
||||
attackResult = attack.DoDamage(character, damageTarget, WorldPosition, deltaTime: 1.0f, playSound, body, sourceLimb: this);
|
||||
}
|
||||
}
|
||||
/*if (structureBody != null && attack.StickChance > Rand.Range(0.0f, 1.0f, Rand.RandSync.ServerAndClient))
|
||||
@@ -1434,6 +1448,7 @@ namespace Barotrauma
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
ragdoll.SubtractMass(this);
|
||||
body?.Remove();
|
||||
body = null;
|
||||
if (pullJoint != null)
|
||||
|
||||
Reference in New Issue
Block a user