- crouching (allows placing signal items at the bottom of a room and may be useful when doctors are added (CPR animation, using medical items on dead bodies?))

- changes to the dying logic: characters will be unconscious when their health or oxygen goes below 0.0, and die when it drops to -100.0 (if either of the values is below zero, it will automatically decrease so the character will quickly die without medical care)
- fixed LightSprite being drawn on LightComponents even if the item is inside an inventory
- characters extend their arm more when placing signal items
This commit is contained in:
Regalis
2016-03-20 20:15:47 +02:00
parent fc8b30c974
commit 0dbfb54b5f
11 changed files with 160 additions and 83 deletions

View File

@@ -235,6 +235,11 @@ namespace Barotrauma
}
}
public bool IsUnconscious
{
get { return (needsAir && oxygen < 0.0f) || health < 0.0f; }
}
public bool NeedsAir
{
get { return needsAir; }
@@ -246,8 +251,8 @@ namespace Barotrauma
set
{
if (!MathUtils.IsValid(value)) return;
oxygen = MathHelper.Clamp(value, 0.0f, 100.0f);
if (oxygen == 0.0f) Kill(AnimController.InWater ? CauseOfDeath.Drowning : CauseOfDeath.Suffocation);
oxygen = MathHelper.Clamp(value, -100.0f, 100.0f);
if (oxygen == -100.0f) Kill(AnimController.InWater ? CauseOfDeath.Drowning : CauseOfDeath.Suffocation);
}
}
@@ -269,7 +274,7 @@ namespace Barotrauma
set
{
if (!MathUtils.IsValid(value)) return;
health = MathHelper.Clamp(value, 0.0f, maxHealth);
health = MathHelper.Clamp(value, -100.0f, maxHealth);
}
}
@@ -656,9 +661,13 @@ namespace Barotrauma
Vector2 targetMovement = GetTargetMovement();
AnimController.TargetMovement = targetMovement;
AnimController.IgnorePlatforms = AnimController.TargetMovement.Y < 0.0f;
if (AnimController is HumanoidAnimController)
{
((HumanoidAnimController) AnimController).Crouching = IsKeyDown(InputType.Crouch);
}
if (AnimController.onGround &&
!AnimController.InWater &&
AnimController.Anim != AnimController.Animation.UsingConstruction)
@@ -988,7 +997,7 @@ namespace Barotrauma
networkUpdateSent = false;
}
if (needsAir)
{
bool protectedFromPressure = PressureProtection > 0.0f;
@@ -1016,7 +1025,7 @@ namespace Barotrauma
PressureTimer = 0.0f;
}
}
if (controlled == this)
{
Lights.LightManager.ViewTarget = this;
@@ -1024,6 +1033,12 @@ namespace Barotrauma
ControlLocalPlayer(deltaTime, cam);
}
if (IsUnconscious)
{
UpdateUnconscious(deltaTime);
return;
}
if (controlled==this || !(this is AICharacter)) Control(deltaTime, cam);
UpdateSightRange();
@@ -1052,12 +1067,19 @@ namespace Barotrauma
Health -= bleeding * deltaTime;
Bleeding -= BleedingDecreaseSpeed * deltaTime;
if (health <= 0.0f) Kill(CauseOfDeath.Bloodloss, false);
if (health <= 0.0f) Kill(CauseOfDeath.Bloodloss);
if (!IsDead) LockHands = false;
}
private void UpdateUnconscious(float deltaTime)
{
Stun = Math.Max(5.0f, Stun);
if (oxygen < 0.0f) Oxygen -= deltaTime;
if (health < 0.0f) Health -= Math.Max(bleeding, 1.0f) * deltaTime;
}
private void UpdateSightRange()
{