diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index 6d0b466df..507d69e0c 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -93,6 +93,7 @@
+
@@ -496,6 +497,7 @@
PreserveNewest
+
PreserveNewest
Designer
@@ -803,6 +805,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -812,6 +817,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -1105,6 +1113,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -1267,12 +1278,27 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Subsurface/Content/Content.mgcb b/Subsurface/Content/Content.mgcb
index e7b71d44b..3b1a5e869 100644
--- a/Subsurface/Content/Content.mgcb
+++ b/Subsurface/Content/Content.mgcb
@@ -43,3 +43,9 @@
/processorParam:DebugMode=Auto
/build:blurshader.fx
+#begin damageshader.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:damageshader.fx
+
diff --git a/Subsurface/Content/Map/StructurePrefabs.xml b/Subsurface/Content/Map/StructurePrefabs.xml
index 7fc9df42a..b17970684 100644
--- a/Subsurface/Content/Map/StructurePrefabs.xml
+++ b/Subsurface/Content/Map/StructurePrefabs.xml
@@ -1,167 +1,239 @@
-
+
+
+
-
+
+
+
-
-
-
-
-
-
-
+
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
+
+
+
+
-
+
+
+
+
-
+
+
+
+
-
+
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Subsurface/Content/Map/structures2.png b/Subsurface/Content/Map/structures2.png
index 14866b4e6..06704256e 100644
Binary files a/Subsurface/Content/Map/structures2.png and b/Subsurface/Content/Map/structures2.png differ
diff --git a/Subsurface/Content/Map/testroom.png b/Subsurface/Content/Map/testroom.png
index 2c6332335..76b1db675 100644
Binary files a/Subsurface/Content/Map/testroom.png and b/Subsurface/Content/Map/testroom.png differ
diff --git a/Subsurface/Content/Map/walldamage.png b/Subsurface/Content/Map/walldamage.png
new file mode 100644
index 000000000..d713180be
Binary files /dev/null and b/Subsurface/Content/Map/walldamage.png differ
diff --git a/Subsurface/Content/Particles/ParticlePrefabs.xml b/Subsurface/Content/Particles/ParticlePrefabs.xml
index d2be342c8..7182505bc 100644
--- a/Subsurface/Content/Particles/ParticlePrefabs.xml
+++ b/Subsurface/Content/Particles/ParticlePrefabs.xml
@@ -234,4 +234,68 @@
velocitychange="0.0, 1.0">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Subsurface/Content/Particles/shrapnel.png b/Subsurface/Content/Particles/shrapnel.png
new file mode 100644
index 000000000..ad42c6eeb
Binary files /dev/null and b/Subsurface/Content/Particles/shrapnel.png differ
diff --git a/Subsurface/Content/Sounds/Damage/StructureBlunt10.ogg b/Subsurface/Content/Sounds/Damage/StructureBlunt10.ogg
new file mode 100644
index 000000000..d0409d67b
Binary files /dev/null and b/Subsurface/Content/Sounds/Damage/StructureBlunt10.ogg differ
diff --git a/Subsurface/Content/Sounds/Damage/StructureBlunt8.ogg b/Subsurface/Content/Sounds/Damage/StructureBlunt8.ogg
new file mode 100644
index 000000000..be7ae50bc
Binary files /dev/null and b/Subsurface/Content/Sounds/Damage/StructureBlunt8.ogg differ
diff --git a/Subsurface/Content/Sounds/Damage/StructureBlunt9.ogg b/Subsurface/Content/Sounds/Damage/StructureBlunt9.ogg
new file mode 100644
index 000000000..4eecdcab6
Binary files /dev/null and b/Subsurface/Content/Sounds/Damage/StructureBlunt9.ogg differ
diff --git a/Subsurface/Content/Sounds/Damage/StructureCrunch4.ogg b/Subsurface/Content/Sounds/Damage/StructureCrunch4.ogg
new file mode 100644
index 000000000..0eb5709af
Binary files /dev/null and b/Subsurface/Content/Sounds/Damage/StructureCrunch4.ogg differ
diff --git a/Subsurface/Content/Sounds/Damage/StructureCrunch5.ogg b/Subsurface/Content/Sounds/Damage/StructureCrunch5.ogg
new file mode 100644
index 000000000..3e4cffd12
Binary files /dev/null and b/Subsurface/Content/Sounds/Damage/StructureCrunch5.ogg differ
diff --git a/Subsurface/Content/Sounds/sounds.xml b/Subsurface/Content/Sounds/sounds.xml
index 22f05a258..8bab2245a 100644
--- a/Subsurface/Content/Sounds/sounds.xml
+++ b/Subsurface/Content/Sounds/sounds.xml
@@ -3,14 +3,20 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/Subsurface/Content/damageshader.fx b/Subsurface/Content/damageshader.fx
new file mode 100644
index 000000000..6b67aacd7
--- /dev/null
+++ b/Subsurface/Content/damageshader.fx
@@ -0,0 +1,38 @@
+
+Texture xTexture;
+sampler TextureSampler : register (s0) = sampler_state { Texture = ; };
+
+Texture xStencil;
+sampler StencilSampler = sampler_state { Texture = ; };
+
+
+float aCutoff;
+float aMultiplier;
+
+float cCutoff;
+float cMultiplier;
+
+float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
+{
+ float4 c = tex2D(TextureSampler, texCoord);
+
+ float4 stencilColor = tex2D(StencilSampler, texCoord);
+
+ float aDiff = stencilColor.a - aCutoff;
+
+ clip(aDiff);
+
+ float cDiff = stencilColor.a - cCutoff;
+
+ return float4(
+ lerp(stencilColor.rgb, c.rgb, clamp(cDiff * cMultiplier, 0.0f, 1.0f)),
+ min(aDiff * aMultiplier, c.a));
+}
+
+technique StencilShader
+{
+ pass Pass1
+ {
+ PixelShader = compile ps_4_0_level_9_3 main();
+ }
+}
diff --git a/Subsurface/Content/damageshader.xnb b/Subsurface/Content/damageshader.xnb
new file mode 100644
index 000000000..88484654f
Binary files /dev/null and b/Subsurface/Content/damageshader.xnb differ
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index 81224104d..b37b47ee2 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -93,6 +93,8 @@ namespace Barotrauma
protected Item closestItem;
private Character closestCharacter, selectedCharacter;
+ private Dictionary