"Explosion" debug command
This commit is contained in:
@@ -72,6 +72,14 @@ namespace Barotrauma
|
|||||||
return (Duration == 0.0f) ? structureDamage : structureDamage * deltaTime;
|
return (Duration == 0.0f) ? structureDamage : structureDamage * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Attack(float damage, float structureDamage, float bleedingDamage, float range = 0.0f)
|
||||||
|
{
|
||||||
|
Range = range;
|
||||||
|
this.damage = damage;
|
||||||
|
this.structureDamage = structureDamage;
|
||||||
|
this.bleedingDamage = bleedingDamage;
|
||||||
|
}
|
||||||
|
|
||||||
public Attack(XElement element)
|
public Attack(XElement element)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -106,9 +114,7 @@ namespace Barotrauma
|
|||||||
Duration = ToolBox.GetAttributeFloat(element, "duration", 0.0f);
|
Duration = ToolBox.GetAttributeFloat(element, "duration", 0.0f);
|
||||||
|
|
||||||
priority = ToolBox.GetAttributeFloat(element, "priority", 1.0f);
|
priority = ToolBox.GetAttributeFloat(element, "priority", 1.0f);
|
||||||
|
|
||||||
statusEffects = new List<StatusEffect>();
|
|
||||||
|
|
||||||
foreach (XElement subElement in element.Elements())
|
foreach (XElement subElement in element.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
@@ -117,6 +123,10 @@ namespace Barotrauma
|
|||||||
particleEmitterPrefab = new ParticleEmitterPrefab(subElement);
|
particleEmitterPrefab = new ParticleEmitterPrefab(subElement);
|
||||||
break;
|
break;
|
||||||
case "statuseffect":
|
case "statuseffect":
|
||||||
|
if (statusEffects == null)
|
||||||
|
{
|
||||||
|
statusEffects = new List<StatusEffect>();
|
||||||
|
}
|
||||||
statusEffects.Add(StatusEffect.Load(subElement));
|
statusEffects.Add(StatusEffect.Load(subElement));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -141,6 +151,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var effectType = attackResult.Damage > 0.0f ? ActionType.OnUse : ActionType.OnFailure;
|
var effectType = attackResult.Damage > 0.0f ? ActionType.OnUse : ActionType.OnFailure;
|
||||||
|
|
||||||
|
if (statusEffects == null)
|
||||||
|
{
|
||||||
|
return attackResult;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (StatusEffect effect in statusEffects)
|
foreach (StatusEffect effect in statusEffects)
|
||||||
{
|
{
|
||||||
if (effect.Targets.HasFlag(StatusEffect.TargetType.This) && attacker is Character)
|
if (effect.Targets.HasFlag(StatusEffect.TargetType.This) && attacker is Character)
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ namespace Barotrauma
|
|||||||
healedCharacter.AddDamage(CauseOfDeath.Damage, -healedCharacter.MaxHealth, null);
|
healedCharacter.AddDamage(CauseOfDeath.Damage, -healedCharacter.MaxHealth, null);
|
||||||
healedCharacter.Oxygen = 100.0f;
|
healedCharacter.Oxygen = 100.0f;
|
||||||
healedCharacter.Bleeding = 0.0f;
|
healedCharacter.Bleeding = 0.0f;
|
||||||
healedCharacter.Stun = 0.0f;
|
healedCharacter.SetStun(0.0f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -600,6 +600,14 @@ namespace Barotrauma
|
|||||||
case "water":
|
case "water":
|
||||||
if (GameMain.Client == null) Hull.EditWater = !Hull.EditWater;
|
if (GameMain.Client == null) Hull.EditWater = !Hull.EditWater;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "explosion":
|
||||||
|
Vector2 explosionPos = GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||||
|
float range = 500, force = 10, damage=50;
|
||||||
|
if (commands.Length > 1) float.TryParse(commands[1], out range);
|
||||||
|
if (commands.Length > 2) float.TryParse(commands[2], out force);
|
||||||
|
if (commands.Length > 3) float.TryParse(commands[3], out damage);
|
||||||
|
new Explosion(range, force, damage, damage).Explode(explosionPos);
|
||||||
break;
|
break;
|
||||||
case "fire":
|
case "fire":
|
||||||
if (GameMain.Client == null) Hull.EditFire = !Hull.EditFire;
|
if (GameMain.Client == null) Hull.EditFire = !Hull.EditFire;
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool sparks, shockwave, flames, smoke;
|
private bool sparks, shockwave, flames, smoke;
|
||||||
|
|
||||||
|
public Explosion(float range, float force, float damage, float structureDamage)
|
||||||
|
{
|
||||||
|
attack = new Attack(damage, structureDamage, 0.0f, range);
|
||||||
|
this.force = force;
|
||||||
|
sparks = true;
|
||||||
|
shockwave = true;
|
||||||
|
flames = true;
|
||||||
|
}
|
||||||
|
|
||||||
public Explosion(XElement element)
|
public Explosion(XElement element)
|
||||||
{
|
{
|
||||||
attack = new Attack(element);
|
attack = new Attack(element);
|
||||||
|
|||||||
Reference in New Issue
Block a user