Zombie SFX (#9976)
This commit is contained in:
31
Content.Server/Zombies/ActiveZombieComponent.cs
Normal file
31
Content.Server/Zombies/ActiveZombieComponent.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
namespace Content.Server.Zombies;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class ActiveZombieComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The chance that on a random attempt
|
||||||
|
/// that a zombie will do a groan
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float GroanChance = 0.2f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum time between groans
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float GroanCooldown = 2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The length of time between each zombie's random groan
|
||||||
|
/// attempt.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float RandomGroanAttempt = 5;
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float LastDamageGroanCooldown = 0f;
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float Accumulator = 0f;
|
||||||
|
}
|
||||||
@@ -17,14 +17,14 @@ namespace Content.Server.Zombies
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The baseline infection chance you have if you are completely nude
|
/// The baseline infection chance you have if you are completely nude
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float MaxZombieInfectionChance = 0.75f;
|
public float MaxZombieInfectionChance = 0.75f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum infection chance possible. This is simply to prevent
|
/// The minimum infection chance possible. This is simply to prevent
|
||||||
/// being invincible by bundling up.
|
/// being invincible by bundling up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float MinZombieInfectionChance = 0.1f;
|
public float MinZombieInfectionChance = 0.1f;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
@@ -33,19 +33,19 @@ namespace Content.Server.Zombies
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The skin color of the zombie
|
/// The skin color of the zombie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables, DataField("skinColor")]
|
[DataField("skinColor")]
|
||||||
public Color SkinColor = new(0.45f, 0.51f, 0.29f);
|
public Color SkinColor = new(0.45f, 0.51f, 0.29f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The eye color of the zombie
|
/// The eye color of the zombie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables, DataField("eyeColor")]
|
[DataField("eyeColor")]
|
||||||
public Color EyeColor = new(0.96f, 0.13f, 0.24f);
|
public Color EyeColor = new(0.96f, 0.13f, 0.24f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The attack arc of the zombie
|
/// The attack arc of the zombie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables, DataField("attackArc", customTypeSerializer: typeof(PrototypeIdSerializer<MeleeWeaponAnimationPrototype>))]
|
[DataField("attackArc", customTypeSerializer: typeof(PrototypeIdSerializer<MeleeWeaponAnimationPrototype>))]
|
||||||
public string AttackArc = "claw";
|
public string AttackArc = "claw";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -8,8 +8,11 @@ using Content.Shared.Chemistry.Components;
|
|||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Server.Disease;
|
using Content.Server.Disease;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
|
using Content.Shared.MobState;
|
||||||
using Content.Server.Inventory;
|
using Content.Server.Inventory;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Content.Server.Speech;
|
||||||
|
using Content.Server.Chat.Systems;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
|
||||||
@@ -22,6 +25,8 @@ namespace Content.Server.Zombies
|
|||||||
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
|
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
|
||||||
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
|
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
|
||||||
[Dependency] private readonly ServerInventorySystem _inv = default!;
|
[Dependency] private readonly ServerInventorySystem _inv = default!;
|
||||||
|
[Dependency] private readonly VocalSystem _vocal = default!;
|
||||||
|
[Dependency] private readonly ChatSystem _chat = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
@@ -30,9 +35,25 @@ namespace Content.Server.Zombies
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
|
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
|
||||||
|
SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState);
|
||||||
|
SubscribeLocalEvent<ActiveZombieComponent, DamageChangedEvent>(OnDamage);
|
||||||
SubscribeLocalEvent<ZombieComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshSpeed);
|
SubscribeLocalEvent<ZombieComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args)
|
||||||
|
{
|
||||||
|
if (args.CurrentMobState == DamageState.Alive)
|
||||||
|
EnsureComp<ActiveZombieComponent>(uid);
|
||||||
|
else
|
||||||
|
RemComp<ActiveZombieComponent>(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDamage(EntityUid uid, ActiveZombieComponent component, DamageChangedEvent args)
|
||||||
|
{
|
||||||
|
if (args.DamageIncreased)
|
||||||
|
DoGroan(uid, component);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnRefreshSpeed(EntityUid uid, ZombieComponent component, RefreshMovementSpeedModifiersEvent args)
|
private void OnRefreshSpeed(EntityUid uid, ZombieComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||||
{
|
{
|
||||||
var mod = component.ZombieMovementSpeedDebuff;
|
var mod = component.ZombieMovementSpeedDebuff;
|
||||||
@@ -96,13 +117,13 @@ namespace Content.Server.Zombies
|
|||||||
if (HasComp<ZombieComponent>(entity))
|
if (HasComp<ZombieComponent>(entity))
|
||||||
args.BonusDamage = -args.BaseDamage * zombieComp.OtherZombieDamageCoefficient;
|
args.BonusDamage = -args.BaseDamage * zombieComp.OtherZombieDamageCoefficient;
|
||||||
|
|
||||||
if ((mobState.IsDead() || mobState.IsCritical())
|
if ((mobState.CurrentState == DamageState.Dead || mobState.CurrentState == DamageState.Critical)
|
||||||
&& !HasComp<ZombieComponent>(entity))
|
&& !HasComp<ZombieComponent>(entity))
|
||||||
{
|
{
|
||||||
_zombify.ZombifyEntity(entity);
|
_zombify.ZombifyEntity(entity);
|
||||||
args.BonusDamage = -args.BaseDamage;
|
args.BonusDamage = -args.BaseDamage;
|
||||||
}
|
}
|
||||||
else if (mobState.IsAlive()) //heals when zombies bite live entities
|
else if (mobState.CurrentState == DamageState.Alive) //heals when zombies bite live entities
|
||||||
{
|
{
|
||||||
var healingSolution = new Solution();
|
var healingSolution = new Solution();
|
||||||
healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem
|
healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem
|
||||||
@@ -110,5 +131,39 @@ namespace Content.Server.Zombies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DoGroan(EntityUid uid, ActiveZombieComponent component)
|
||||||
|
{
|
||||||
|
if (component.LastDamageGroanCooldown > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_robustRandom.Prob(0.5f)) //this message is never seen by players so it just says this for admins
|
||||||
|
_chat.TrySendInGameICMessage(uid, "[automated zombie groan]", InGameICChatType.Speak, false);
|
||||||
|
else
|
||||||
|
_vocal.TryScream(uid);
|
||||||
|
|
||||||
|
component.LastDamageGroanCooldown = component.GroanCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(float frameTime)
|
||||||
|
{
|
||||||
|
base.Update(frameTime);
|
||||||
|
|
||||||
|
foreach (var zombiecomp in EntityQuery<ActiveZombieComponent>())
|
||||||
|
{
|
||||||
|
zombiecomp.Accumulator += frameTime;
|
||||||
|
zombiecomp.LastDamageGroanCooldown -= frameTime;
|
||||||
|
|
||||||
|
if (zombiecomp.Accumulator < zombiecomp.RandomGroanAttempt)
|
||||||
|
continue;
|
||||||
|
zombiecomp.Accumulator -= zombiecomp.RandomGroanAttempt;
|
||||||
|
|
||||||
|
if (!_robustRandom.Prob(zombiecomp.GroanChance))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//either do a random accent line or scream
|
||||||
|
DoGroan(zombiecomp.Owner, zombiecomp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ using Content.Shared.Zombies;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Server.Atmos.Miasma;
|
using Content.Server.Atmos.Miasma;
|
||||||
using Content.Server.IdentityManagement;
|
using Content.Server.IdentityManagement;
|
||||||
|
using Content.Shared.Audio;
|
||||||
|
using Content.Shared.Sound;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
using Content.Server.Speech;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
|
|
||||||
namespace Content.Server.Zombies
|
namespace Content.Server.Zombies
|
||||||
@@ -111,6 +115,11 @@ namespace Content.Server.Zombies
|
|||||||
RemComp<CombatModeComponent>(target);
|
RemComp<CombatModeComponent>(target);
|
||||||
AddComp<CombatModeComponent>(target);
|
AddComp<CombatModeComponent>(target);
|
||||||
|
|
||||||
|
var vocal = EnsureComp<VocalComponent>(target);
|
||||||
|
var scream = new SoundCollectionSpecifier ("ZombieScreams");
|
||||||
|
vocal.FemaleScream = scream;
|
||||||
|
vocal.MaleScream = scream;
|
||||||
|
|
||||||
///This is the actual damage of the zombie. We assign the visual appearance
|
///This is the actual damage of the zombie. We assign the visual appearance
|
||||||
///and range here because of stuff we'll find out later
|
///and range here because of stuff we'll find out later
|
||||||
var melee = EnsureComp<MeleeWeaponComponent>(target);
|
var melee = EnsureComp<MeleeWeaponComponent>(target);
|
||||||
|
|||||||
12
Resources/Audio/Voice/Zombie/attributions.yml
Normal file
12
Resources/Audio/Voice/Zombie/attributions.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
- files: ["zombie-1.ogg"]
|
||||||
|
license: "CC-BY-NC-SA-3.0"
|
||||||
|
copyright: "Zombie 1 by Under7dude. Converted from MP3 to OGG."
|
||||||
|
source: "https://freesound.org/people/Under7dude/sounds/163440/"
|
||||||
|
- files: ["zombie-2.ogg"]
|
||||||
|
license: "CC-BY-NC-SA-3.0"
|
||||||
|
copyright: "Zombie gargles by Breviceps. Converted from MP3 to OGG."
|
||||||
|
source: "https://freesound.org/people/Breviceps/sounds/445983/"
|
||||||
|
- files: ["zombie-3.ogg"]
|
||||||
|
license: "CC-BY-NC-SA-3.0"
|
||||||
|
copyright: "Zombie Snarl by gneube. Converted from MP3 to OGG."
|
||||||
|
source: "https://freesound.org/people/gneube/sounds/315844/"
|
||||||
BIN
Resources/Audio/Voice/Zombie/zombie-1.ogg
Normal file
BIN
Resources/Audio/Voice/Zombie/zombie-1.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/Voice/Zombie/zombie-2.ogg
Normal file
BIN
Resources/Audio/Voice/Zombie/zombie-2.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/Voice/Zombie/zombie-3.ogg
Normal file
BIN
Resources/Audio/Voice/Zombie/zombie-3.ogg
Normal file
Binary file not shown.
@@ -40,6 +40,9 @@ accent-words-zombie-1 = Gruaahhhh...
|
|||||||
accent-words-zombie-2 = Mmuaaaa..
|
accent-words-zombie-2 = Mmuaaaa..
|
||||||
accent-words-zombie-3 = Braainnssss...
|
accent-words-zombie-3 = Braainnssss...
|
||||||
accent-words-zombie-4 = Grrrrr...
|
accent-words-zombie-4 = Grrrrr...
|
||||||
|
accent-words-zombie-5 = Ouuaahhhhh...
|
||||||
|
accent-words-zombie-6 = Graaaaaooohhlll...
|
||||||
|
accent-words-zombie-7 = Brainsss... Braaaiiinnsss..
|
||||||
|
|
||||||
# Generic Aggressive
|
# Generic Aggressive
|
||||||
accent-words-generic-aggressive-1 = Grr!
|
accent-words-generic-aggressive-1 = Grr!
|
||||||
|
|||||||
@@ -26,3 +26,10 @@
|
|||||||
- /Audio/Voice/Human/science_scream4.ogg
|
- /Audio/Voice/Human/science_scream4.ogg
|
||||||
- /Audio/Voice/Human/science_scream5.ogg
|
- /Audio/Voice/Human/science_scream5.ogg
|
||||||
- /Audio/Voice/Human/science_scream6.ogg
|
- /Audio/Voice/Human/science_scream6.ogg
|
||||||
|
|
||||||
|
- type: soundCollection
|
||||||
|
id: ZombieScreams
|
||||||
|
files:
|
||||||
|
- /Audio/Voice/Zombie/zombie-1.ogg
|
||||||
|
- /Audio/Voice/Zombie/zombie-2.ogg
|
||||||
|
- /Audio/Voice/Zombie/zombie-3.ogg
|
||||||
@@ -54,6 +54,9 @@
|
|||||||
- accent-words-zombie-2
|
- accent-words-zombie-2
|
||||||
- accent-words-zombie-3
|
- accent-words-zombie-3
|
||||||
- accent-words-zombie-4
|
- accent-words-zombie-4
|
||||||
|
- accent-words-zombie-5
|
||||||
|
- accent-words-zombie-6
|
||||||
|
- accent-words-zombie-7
|
||||||
|
|
||||||
- type: accent
|
- type: accent
|
||||||
id: genericAggressive
|
id: genericAggressive
|
||||||
|
|||||||
Reference in New Issue
Block a user