diff --git a/BarotraumaClient/BarotraumaClient.csproj b/BarotraumaClient/BarotraumaClient.csproj
index e7ab3ca74..5986851b1 100644
--- a/BarotraumaClient/BarotraumaClient.csproj
+++ b/BarotraumaClient/BarotraumaClient.csproj
@@ -69,6 +69,7 @@
+
@@ -80,6 +81,7 @@
+
diff --git a/BarotraumaClient/Source/Characters/AI/HumanAIController.cs b/BarotraumaClient/Source/Characters/AI/HumanAIController.cs
index 4daacaff6..0e9e56964 100644
--- a/BarotraumaClient/Source/Characters/AI/HumanAIController.cs
+++ b/BarotraumaClient/Source/Characters/AI/HumanAIController.cs
@@ -5,6 +5,21 @@ namespace Barotrauma
{
partial class HumanAIController : AIController
{
+ partial void InitProjSpecific()
+ {
+ if (GameMain.GameSession != null && GameMain.GameSession.CrewManager != null)
+ {
+ CurrentOrder = Order.PrefabList.Find(o => o.Name.ToLowerInvariant() == "dismissed");
+ objectiveManager.SetOrder(CurrentOrder, "");
+ GameMain.GameSession.CrewManager.SetCharacterOrder(Character, CurrentOrder);
+ }
+ }
+
+ partial void SetOrderProjSpecific(Order order)
+ {
+ GameMain.GameSession.CrewManager.SetCharacterOrder(Character, order);
+ }
+
public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
{
if (selectedAiTarget != null)
diff --git a/BarotraumaClient/Source/Characters/AICharacter.cs b/BarotraumaClient/Source/Characters/AICharacter.cs
index 9758b9833..65574e299 100644
--- a/BarotraumaClient/Source/Characters/AICharacter.cs
+++ b/BarotraumaClient/Source/Characters/AICharacter.cs
@@ -5,6 +5,32 @@ namespace Barotrauma
{
partial class AICharacter : Character
{
+ partial void InitProjSpecific()
+ {
+ soundTimer = Rand.Range(0.0f, soundInterval);
+ }
+
+ partial void SoundUpdate(float deltaTime)
+ {
+ if (soundTimer > 0)
+ {
+ soundTimer -= deltaTime;
+ }
+ else
+ {
+ switch (aiController.State)
+ {
+ case AIController.AiState.Attack:
+ PlaySound(CharacterSound.SoundType.Attack);
+ break;
+ default:
+ PlaySound(CharacterSound.SoundType.Idle);
+ break;
+ }
+ soundTimer = soundInterval;
+ }
+ }
+
public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Camera cam)
{
base.DrawFront(spriteBatch, cam);
diff --git a/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
index a5e45a18f..a9af76732 100644
--- a/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
+++ b/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
@@ -13,6 +13,58 @@ namespace Barotrauma
{
partial class Ragdoll
{
+ partial void ImpactProjSpecific(float impact, Body body)
+ {
+ float volume = Math.Min(impact - 3.0f, 1.0f);
+
+ if (body.UserData is Limb)
+ {
+ Limb limb = (Limb)body.UserData;
+
+ if (impact > 3.0f && limb.HitSound != null && limb.soundTimer <= 0.0f)
+ {
+ limb.soundTimer = Limb.SoundInterval;
+ limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition);
+ }
+ }
+ else if (body == Collider.FarseerBody)
+ {
+ if (!character.IsRemotePlayer || GameMain.Server != null)
+ {
+ if (impact > ImpactTolerance)
+ {
+ SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, Collider);
+ }
+ }
+
+ if (Character.Controlled == character) GameMain.GameScreen.Cam.Shake = strongestImpact;
+ }
+ }
+
+ partial void Splash(Limb limb, Hull limbHull)
+ {
+ //create a splash particle
+ GameMain.ParticleManager.CreateParticle("watersplash",
+ new Vector2(limb.Position.X, limbHull.Surface) + limbHull.Submarine.Position,
+ new Vector2(0.0f, Math.Abs(-limb.LinearVelocity.Y * 20.0f)),
+ 0.0f, limbHull);
+
+ GameMain.ParticleManager.CreateParticle("bubbles",
+ new Vector2(limb.Position.X, limbHull.Surface) + limbHull.Submarine.Position,
+ limb.LinearVelocity * 0.001f,
+ 0.0f, limbHull);
+
+ //if the Character dropped into water, create a wave
+ if (limb.LinearVelocity.Y < 0.0f)
+ {
+ if (splashSoundTimer <= 0.0f)
+ {
+ SoundPlayer.PlaySplashSound(limb.WorldPosition, Math.Abs(limb.LinearVelocity.Y) + Rand.Range(-5.0f, 0.0f));
+ splashSoundTimer = 0.5f;
+ }
+ }
+ }
+
public virtual void Draw(SpriteBatch spriteBatch)
{
if (simplePhysicsEnabled) return;
diff --git a/BarotraumaClient/Source/Characters/Attack.cs b/BarotraumaClient/Source/Characters/Attack.cs
new file mode 100644
index 000000000..033bbab9c
--- /dev/null
+++ b/BarotraumaClient/Source/Characters/Attack.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml.Linq;
+using Microsoft.Xna.Framework;
+using Barotrauma.Particles;
+
+namespace Barotrauma
+{
+ partial class Attack
+ {
+ private Sound sound;
+
+ private ParticleEmitterPrefab particleEmitterPrefab;
+
+ partial void InitProjSpecific(XElement element)
+ {
+ string soundPath = ToolBox.GetAttributeString(element, "sound", "");
+ if (!string.IsNullOrWhiteSpace(soundPath))
+ {
+ sound = Sound.Load(soundPath);
+ }
+
+ foreach (XElement subElement in element.Elements())
+ {
+ switch (subElement.Name.ToString().ToLowerInvariant())
+ {
+ case "particleemitter":
+ particleEmitterPrefab = new ParticleEmitterPrefab(subElement);
+ break;
+ }
+
+ }
+ }
+
+ partial void DamageParticles(Vector2 worldPosition)
+ {
+ if (particleEmitterPrefab != null)
+ {
+ particleEmitterPrefab.Emit(worldPosition);
+ }
+
+ if (sound != null)
+ {
+ sound.Play(1.0f, 500.0f, worldPosition);
+ }
+ }
+ }
+}
diff --git a/BarotraumaClient/Source/Characters/Character.cs b/BarotraumaClient/Source/Characters/Character.cs
index f2b9e99e0..02435ed85 100644
--- a/BarotraumaClient/Source/Characters/Character.cs
+++ b/BarotraumaClient/Source/Characters/Character.cs
@@ -45,8 +45,10 @@ namespace Barotrauma
get { return hudProgressBars; }
}
- private void InitProjSpecific(XDocument doc)
+ partial void InitProjSpecific(XDocument doc)
{
+ soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f);
+
keys = new Key[Enum.GetNames(typeof(InputType)).Length];
for (int i = 0; i < Enum.GetNames(typeof(InputType)).Length; i++)
@@ -65,6 +67,195 @@ namespace Barotrauma
hudProgressBars = new Dictionary