Re-enabled repairtool character damage
This commit is contained in:
@@ -69,6 +69,13 @@ namespace Barotrauma
|
|||||||
if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch);
|
if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
|
||||||
|
{
|
||||||
|
base.AddDamage(causeOfDeath, amount, attacker);
|
||||||
|
|
||||||
|
if (attacker!=null) aiController.OnAttacked(attacker, amount);
|
||||||
|
}
|
||||||
|
|
||||||
public override AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false)
|
public override AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false)
|
||||||
{
|
{
|
||||||
AttackResult result = base.AddDamage(attacker, position, attack, deltaTime, playSound);
|
AttackResult result = base.AddDamage(attacker, position, attack, deltaTime, playSound);
|
||||||
|
|||||||
@@ -1044,9 +1044,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (isDead) return;
|
if (isDead) return;
|
||||||
|
|
||||||
Vector2 healthBarPos = new Vector2(pos.X - 50, pos.Y - 100.0f);
|
Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f);
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
|
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
|
|
||||||
|
|
||||||
|
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health/maxHealth, Color.Lerp(Color.Red, Color.Green, health/maxHealth)*0.8f);
|
||||||
|
|
||||||
|
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
|
||||||
|
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlaySound(AIController.AiState state)
|
public void PlaySound(AIController.AiState state)
|
||||||
@@ -1069,7 +1074,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddDamage(CauseOfDeath causeOfDeath, float amount)
|
public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
|
||||||
{
|
{
|
||||||
health = MathHelper.Clamp(health-amount, 0.0f, maxHealth);
|
health = MathHelper.Clamp(health-amount, 0.0f, maxHealth);
|
||||||
if (amount>0.0f) lastAttackCauseOfDeath = causeOfDeath;
|
if (amount>0.0f) lastAttackCauseOfDeath = causeOfDeath;
|
||||||
@@ -1105,7 +1110,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
AttackResult attackResult = closestLimb.AddDamage(simPosition, damageType, amount, bleedingAmount, playSound);
|
AttackResult attackResult = closestLimb.AddDamage(simPosition, damageType, amount, bleedingAmount, playSound);
|
||||||
|
|
||||||
AddDamage(damageType == DamageType.Burn ? CauseOfDeath.Burn : causeOfDeath, attackResult.Damage);
|
AddDamage(damageType == DamageType.Burn ? CauseOfDeath.Burn : causeOfDeath, attackResult.Damage, null);
|
||||||
|
|
||||||
//health -= attackResult.Damage;
|
//health -= attackResult.Damage;
|
||||||
//if (health <= 0.0f && damageType == DamageType.Burn) Kill(CauseOfDeath.Burn);
|
//if (health <= 0.0f && damageType == DamageType.Burn) Kill(CauseOfDeath.Burn);
|
||||||
|
|||||||
@@ -205,6 +205,18 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DrawProgressBar(SpriteBatch sb, Vector2 start, Vector2 size, float progress, Color clr, float depth = 0.0f)
|
||||||
|
{
|
||||||
|
//outlinecolor = "0.5, 0.57, 0.6, 1.0" >
|
||||||
|
|
||||||
|
DrawRectangle(sb, new Vector2(start.X, -start.Y), size, new Color(0.5f, 0.57f, 0.6f, 1.0f), false, depth);
|
||||||
|
|
||||||
|
int padding = 2;
|
||||||
|
DrawRectangle(sb, new Rectangle((int)start.X + padding, -(int)(start.Y - padding), (int)((size.X - padding * 2)*progress), (int)size.Y - padding * 2),
|
||||||
|
clr, true, depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Texture2D CreateCircle(int radius)
|
public static Texture2D CreateCircle(int radius)
|
||||||
{
|
{
|
||||||
int outerRadius = radius * 2 + 2; // So circle doesn't go out of bounds
|
int outerRadius = radius * 2 + 2; // So circle doesn't go out of bounds
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace Barotrauma.Items.Components
|
|||||||
List<Body> ignoredBodies = new List<Body>();
|
List<Body> ignoredBodies = new List<Body>();
|
||||||
foreach (Limb limb in character.AnimController.Limbs)
|
foreach (Limb limb in character.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (Rand.Range(0.0f, 1.0f) > degreeOfSuccess) continue;
|
if (Rand.Range(0.0f, 0.5f) > degreeOfSuccess) continue;
|
||||||
ignoredBodies.Add(limb.body.FarseerBody);
|
ignoredBodies.Add(limb.body.FarseerBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (character.IsKeyDown(InputType.Aim))
|
if (character.IsKeyDown(InputType.Aim))
|
||||||
{
|
{
|
||||||
targetLimb.character.AddDamage(CauseOfDeath.Damage, LimbFixAmount * degreeOfSuccess);
|
targetLimb.character.AddDamage(CauseOfDeath.Damage, -LimbFixAmount * degreeOfSuccess, character);
|
||||||
//isActive = true;
|
//isActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user