- More gore particles when severing limbs!

- Explosions can sever limbs even if the target character is dead. Now explosive projectiles can explode creatures into pieces even if the creature dies of the initial projectile impact and not the explosion.
- Disabled blood particles on carriers and fractal guardians.
This commit is contained in:
Joonas Rikkonen
2017-12-29 21:06:11 +02:00
parent 454e0def3b
commit bcd2582cf9
11 changed files with 184 additions and 30 deletions

View File

@@ -17,7 +17,7 @@ namespace Barotrauma
private set;
}
Sound hitSound;
private Sound hitSound;
public Sound HitSound
{

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name="carrier" humanoid="false" health="1000" doesbleed="false">
<Character name="carrier" humanoid="false" health="1000" doesbleed="false" usebloodparticles="false">
<sound file="Content/Characters/Carrier/alarm1.ogg" state="Attack" range="2000"/>
<sound file="Content/Characters/Carrier/carrier1.ogg" state="Attack" range="2000"/>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name="fractalguardian" humanoid="false" health="500.0" doesbleed="false">
<Character name="fractalguardian" humanoid="false" health="500.0" doesbleed="false" usebloodparticles="false">
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name="fractalguardian" humanoid="false" health="800.0" doesbleed="false">
<Character name="fractalguardian" humanoid="false" health="800.0" doesbleed="false" usebloodparticles="false">
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />

View File

@@ -124,7 +124,7 @@
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">
<sound file="Content/Items/Weapons/bigexplosion.ogg"/>
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="0.8" decal="explosion" decalsize="1.0"/>
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="1.0" decal="explosion" decalsize="1.0"/>
</StatusEffect>
<StatusEffect type="OnActive" target="This">

View File

@@ -17,7 +17,7 @@
<sprite texture="Content/Particles/spatter.png" sourcerect="128,0,128,128"/>
<sprite texture="Content/Particles/spatter.png" sourcerect="0,128,128,128"/>
</watersplash>
<mist
startsizemin="0.4,0.4" startsizemax="0.5,0.5"
sizechangemin="0.25,0.25" sizechangemax="0.3,0.3"
@@ -81,7 +81,122 @@
velocitychange="0.0, 0.0">
<animatedsprite texture="Content/Particles/Smoke.png" sourcerect="0,0,4096,4096" columns="8" rows="8" origin="0.5,0.5"/>
</waterblood>
<bloodtrail
lifetime="0.5"
angularvelocitymin="0"
angularvelocitymax="0"
startrotationmin="0"
startrotationmax="360"
rotatetodirection="False"
drag="0"
waterdrag="0.8"
velocitychange="0,0"
collisionradius="30"
collideswithwalls="False"
deleteoncollision="False"
friction="0.01"
restitution="0.2"
startsizemin="0.6,0.6"
startsizemax="1,1"
sizechangemin="0.2,0.2"
sizechangemax="0.5,0.5"
growtime="0.05"
startcolor="0.4941176,0,0,0.4941176"
startalpha="0.5"
colorchange="0,0,0,-1"
drawtarget="Both"
blendstate="AlphaBlend"
animduration="1"
loopanim="True">
<sprite texture="Content/Particles/spatter.png" sourcerect="0,0,128,128"/>
<sprite texture="Content/Particles/spatter.png" sourcerect="128,0,128,128"/>
<sprite texture="Content/Particles/spatter.png" sourcerect="0,128,128,128"/>
</bloodtrail>
<gib
lifetime="5"
angularvelocitymin="-500"
angularvelocitymax="500"
startrotationmin="0"
startrotationmax="360"
rotatetodirection="True"
drag="0"
waterdrag="0.3"
velocitychange="0,-8"
velocitychangewater="0,-1"
collisionradius="10"
collideswithwalls="True"
deleteoncollision="False"
friction="0.5"
restitution="0.1"
startsizemin="0.3,0.3"
startsizemax="0.6,0.6"
sizechangemin="-0.1,-0.1"
sizechangemax="-0.1,-0.1"
growtime="0"
startcolor="0.2980392,0,0,1"
startalpha="1"
colorchange="0,0,0,-0.3"
drawtarget="Both"
blendstate="AlphaBlend"
animduration="1"
loopanim="True">
<sprite texture="Content/Particles/shrapnel.png" sourcerect="0,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="32,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="64,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="96,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="128,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="160,64,48,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="208,64,48,32"/>
</gib>
<heavygib
lifetime="1"
angularvelocitymin="-500"
angularvelocitymax="500"
startrotationmin="0"
startrotationmax="360"
rotatetodirection="False"
drag="0"
waterdrag="0.3"
velocitychange="0,-8"
velocitychangewater="0,-1"
collisionradius="10"
collideswithwalls="True"
deleteoncollision="True"
friction="0.5"
restitution="0.5"
startsizemin="0.8,0.8"
startsizemax="1,1"
sizechangemin="-0.5,-0.5"
sizechangemax="-0.5,-0.5"
growtime="0"
startcolor="0.2980392,0,0,1"
startalpha="1"
colorchange="0,0,0,-0.3"
drawtarget="Both"
blendstate="AlphaBlend"
animduration="1"
loopanim="True">
<sprite texture="Content/Particles/shrapnel.png" sourcerect="0,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="32,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="64,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="96,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="128,64,32,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="160,64,48,32"/>
<sprite texture="Content/Particles/shrapnel.png" sourcerect="208,64,48,32"/>
<ParticleEmitter
particle="bloodtrail"
particlespersecond="10"
position="0,0"
anglemin="0"
anglemax="360"
velocitymin="10"
velocitymax="20"/>
</heavygib>
<spark
startsizemin="0.5,0.2" startsizemax="1.0,0.7"
sizechangemin="-0.5,-0.5" sizechangemax="-1.0,-1.0"
@@ -314,7 +429,7 @@
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
colorchange="0.0, 0.0, 0.0, -0.3"
lifetime="10.0"
drawtarget="both"
drawtarget="water"
collideswithwalls="true"
collisionradius="10.0"
restitution="0.2"

View File

@@ -541,12 +541,29 @@ namespace Barotrauma
GetConnectedLimbs(connectedLimbs, checkedJoints, MainLimb);
foreach (Limb limb in Limbs)
{
if (!connectedLimbs.Contains(limb))
if (connectedLimbs.Contains(limb)) continue;
limb.IsSevered = true;
}
#if CLIENT
if (character.UseBloodParticles)
{
foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB })
{
limb.IsSevered = true;
for (int i = 0; i < MathHelper.Clamp(limb.Mass * 2.0f, 1.0f, 50.0f); i++)
{
GameMain.ParticleManager.CreateParticle("gib", limb.WorldPosition, Rand.Range(0.0f, MathHelper.TwoPi), Rand.Range(200.0f, 700.0f), character.CurrentHull);
}
for (int i = 0; i < MathHelper.Clamp(limb.Mass * 2.0f, 1.0f, 10.0f); i++)
{
GameMain.ParticleManager.CreateParticle("heavygib", limb.WorldPosition, Rand.Range(0.0f, MathHelper.TwoPi), Rand.Range(50.0f, 250.0f), character.CurrentHull);
}
}
}
#endif
if (GameMain.Server != null)
{
GameMain.Server.CreateEntityEvent(character, new object[] { NetEntityEvent.Type.Status });

View File

@@ -85,7 +85,7 @@ namespace Barotrauma
public float TargetForce { get; private set; }
[Serialize(0.0f, false)]
public float SeverLimbsProbability { get; private set; }
public float SeverLimbsProbability { get; set; }
[Serialize(0.0f, false)]
public float Priority { get; private set; }

View File

@@ -425,6 +425,12 @@ namespace Barotrauma
private set;
}
public bool UseBloodParticles
{
get;
private set;
}
public float BleedingDecreaseSpeed
{
get;
@@ -633,6 +639,7 @@ namespace Barotrauma
health = maxHealth;
DoesBleed = doc.Root.GetAttributeBool("doesbleed", true);
UseBloodParticles = doc.Root.GetAttributeBool("usebloodparticles", true);
BleedingDecreaseSpeed = doc.Root.GetAttributeFloat("bleedingdecreasespeed", 0.05f);
needsAir = doc.Root.GetAttributeBool("needsair", false);

View File

@@ -387,23 +387,25 @@ namespace Barotrauma
SoundPlayer.PlayDamageSound(damageSoundType, amount, position);
}
float bloodParticleAmount = bleedingAmount <= 0.0f ? 0 : (int)Math.Min(amount / 5, 10);
float bloodParticleSize = MathHelper.Clamp(amount / 50.0f, 0.1f, 1.0f);
for (int i = 0; i < bloodParticleAmount; i++)
if (character.UseBloodParticles)
{
var blood = GameMain.ParticleManager.CreateParticle(inWater ? "waterblood" : "blood", WorldPosition, Vector2.Zero, 0.0f, character.AnimController.CurrentHull);
if (blood != null)
float bloodParticleAmount = bleedingAmount <= 0.0f ? 0 : (int)Math.Min(amount / 5, 10);
float bloodParticleSize = MathHelper.Clamp(amount / 50.0f, 0.1f, 1.0f);
for (int i = 0; i < bloodParticleAmount; i++)
{
blood.Size *= bloodParticleSize;
var blood = GameMain.ParticleManager.CreateParticle(inWater ? "waterblood" : "blood", WorldPosition, Vector2.Zero, 0.0f, character.AnimController.CurrentHull);
if (blood != null)
{
blood.Size *= bloodParticleSize;
}
}
if (bloodParticleAmount > 0 && character.CurrentHull != null)
{
character.CurrentHull.AddDecal("blood", WorldPosition, MathHelper.Clamp(bloodParticleSize, 0.5f, 1.0f));
}
}
if (bloodParticleAmount > 0 && character.CurrentHull != null)
{
character.CurrentHull.AddDecal("blood", WorldPosition, MathHelper.Clamp(bloodParticleSize, 0.5f, 1.0f));
}
#endif
if (damageType == DamageType.Burn)

View File

@@ -23,6 +23,7 @@ namespace Barotrauma
public Explosion(float range, float force, float damage, float structureDamage)
{
attack = new Attack(damage, structureDamage, 0.0f, range);
attack.SeverLimbsProbability = 1.0f;
this.force = force;
sparks = true;
shockwave = true;
@@ -118,7 +119,7 @@ namespace Barotrauma
explosionPos = ConvertUnits.ToSimUnits(explosionPos);
bool wasDead = c.IsDead;
Dictionary<Limb, float> distFactors = new Dictionary<Limb, float>();
foreach (Limb limb in c.AnimController.Limbs)
{
float dist = Vector2.Distance(limb.WorldPosition, worldPosition);
@@ -134,6 +135,8 @@ namespace Barotrauma
//solid obstacles between the explosion and the limb reduce the effect of the explosion by 90%
if (Submarine.CheckVisibility(limb.SimPosition, explosionPos) != null) distFactor *= 0.1f;
distFactors.Add(limb, distFactor);
c.AddDamage(limb.WorldPosition, DamageType.None,
attack.GetDamage(1.0f) / c.AnimController.Limbs.Length * distFactor,
@@ -143,17 +146,27 @@ namespace Barotrauma
if (limb.WorldPosition != worldPosition && force > 0.0f)
{
limb.body.ApplyLinearImpulse(Vector2.Normalize(limb.WorldPosition - worldPosition) * distFactor * force);
Vector2 limbDiff = Vector2.Normalize(limb.WorldPosition - worldPosition);
Vector2 impulsePoint = limb.SimPosition - limbDiff * limbRadius;
limb.body.ApplyLinearImpulse(limbDiff * distFactor * force, impulsePoint);
}
}
if (!wasDead && c.IsDead)
//sever joints
if (c.IsDead && attack.SeverLimbsProbability > 0.0f)
{
foreach (LimbJoint joint in c.AnimController.LimbJoints)
foreach (Limb limb in c.AnimController.Limbs)
{
if (Rand.Range(0.0f, 1.0f) < attack.SeverLimbsProbability)
if (!distFactors.ContainsKey(limb)) continue;
foreach (LimbJoint joint in c.AnimController.LimbJoints)
{
c.AnimController.SeverLimbJoint(joint);
if (joint.IsSevered || (joint.LimbA != limb && joint.LimbB != limb)) continue;
if (Rand.Range(0.0f, 1.0f) < attack.SeverLimbsProbability * distFactors[limb])
{
c.AnimController.SeverLimbJoint(joint);
}
}
}
}