From 6206a0b4afde41fb20692f357d59141349b2b8e2 Mon Sep 17 00:00:00 2001
From: ThereDrD <88589686+ThereDrD0@users.noreply.github.com>
Date: Wed, 15 Jan 2025 18:26:32 +0300
Subject: [PATCH 1/2] =?UTF-8?q?=D0=97=D0=B2=D1=83=D0=BA=20=D1=81=D0=B5?=
=?UTF-8?q?=D1=80=D0=B4=D1=86=D0=B5=D0=B1=D0=B8=D0=B5=D0=BD=D0=B8=D0=B5=20?=
=?UTF-8?q?=D0=B2=20=D0=BA=D1=80=D0=B8=D1=82=D0=B5=20(#1114)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* add: crit heartbeat sound
* fix: fix strange things happening on second crit
* add: disable option for children in prototypes
* add: shitty implementation of health-relative pitch scale
* clean up
* review requested changes
* review requested changes
* changes 2
---
.../CritHeartbeat/CritHeartbeatComponent.cs | 18 +++++++
.../CritHeartbeat/CritHeartbeatSystem.cs | 45 ++++++++++++++++++
.../Audio/_Sunrise/Effects/heartbeat.ogg | Bin 0 -> 6739 bytes
.../Prototypes/Entities/Mobs/Species/base.yml | 6 +++
4 files changed, 69 insertions(+)
create mode 100644 Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatComponent.cs
create mode 100644 Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatSystem.cs
create mode 100644 Resources/Audio/_Sunrise/Effects/heartbeat.ogg
diff --git a/Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatComponent.cs b/Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatComponent.cs
new file mode 100644
index 00000000000..b4a62e87a6d
--- /dev/null
+++ b/Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatComponent.cs
@@ -0,0 +1,18 @@
+using Robust.Shared.Audio;
+
+namespace Content.Server._Sunrise.CritHeartbeat;
+
+[RegisterComponent]
+public sealed partial class CritHeartbeatComponent : Component
+{
+ [DataField]
+ public SoundSpecifier HeartbeatSound = new SoundPathSpecifier("/Audio/_Sunrise/Effects/heartbeat.ogg");
+
+ ///
+ /// Чтобы выключать это для наследников в прототипах
+ ///
+ [DataField]
+ public bool Enabled = true;
+
+ public EntityUid? AudioStream;
+}
diff --git a/Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatSystem.cs b/Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatSystem.cs
new file mode 100644
index 00000000000..dfa89d66846
--- /dev/null
+++ b/Content.Server/_Sunrise/CritHeartbeat/CritHeartbeatSystem.cs
@@ -0,0 +1,45 @@
+using Content.Shared.Damage;
+using Content.Shared.Mobs;
+using Robust.Server.Audio;
+using Robust.Shared.Audio;
+
+namespace Content.Server._Sunrise.CritHeartbeat;
+
+public sealed class CritHeartbeatSystem : EntitySystem
+{
+ [Dependency] private readonly AudioSystem _audio = default!;
+
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ SubscribeLocalEvent(OnMobStateChanged);
+ SubscribeLocalEvent(OnDamage);
+ }
+
+ private void OnMobStateChanged(Entity ent, ref MobStateChangedEvent args)
+ {
+ if (!ent.Comp.Enabled)
+ return;
+
+ ent.Comp.AudioStream = args.NewMobState == MobState.Critical
+ ? _audio.PlayEntity(ent.Comp.HeartbeatSound, ent, ent)?.Entity
+ : _audio.Stop(ent.Comp.AudioStream);
+ }
+
+ private void OnDamage(Entity ent, ref DamageChangedEvent args)
+ {
+ if (!ent.Comp.Enabled)
+ return;
+
+ if (!Exists(ent.Comp.AudioStream))
+ return;
+
+ var pitch = Math.Min(1, 100 / args.Damageable.TotalDamage.Float());
+
+ // Потому что игра говно, тут нельзя изменять аудиопарамс уже существующего звука. Поэтому я пересоздаю его заново
+ // Это приводит к проигрыванию звука через неравномерные промежутки времени, но зато работает и не очень заметно
+ _audio.Stop(ent.Comp.AudioStream);
+ ent.Comp.AudioStream = _audio.PlayEntity(ent.Comp.HeartbeatSound, ent, ent, AudioParams.Default.WithPitchScale(pitch))?.Entity;
+ }
+}
diff --git a/Resources/Audio/_Sunrise/Effects/heartbeat.ogg b/Resources/Audio/_Sunrise/Effects/heartbeat.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..288bc882613d6009b005e3e9957bb21b6745cd8e
GIT binary patch
literal 6739
zcmahtc|4Tc`>%b;m3>c?$xKlu>&TL^55h2En5Qd48)A0jc)B
zQ784_2lWrawX`_gyTJz^>K_(>k1z&l{vZvG;1E^L1o{0Ih1^3Ef&PG9+GIXnMk1t;a7CcOX-#iMG1y3ZzqJ=VgBPp=M^2
zoyc$YSdL_629AIq(IQ3aH@mGs+K&+2O;XVbkOr~=ptKyCRt^;wQ)mzd9s_{bQD>>X
zaHS_XN>AuYI|Tpm-~*Qd5Cr*b(kg5+-`bGXJjjskI)CMkMt{S0J-jV$0{~9WB9`G&
z0^4!{03cXukVbP)qXnidq-F||lB>CacmUu9yU{UsF|wvuJafg2HHA$6SM|)t%WsQ=
zHWV8PI$6n|s>LJEzr7CNFyh72w7TQ}F><^dO0-<41~F4SSLz{3MbQzviftGd$k)^L|AN7Z)ozGq3PSd#O3yR$X_+VdU|a_n82E*ATjWt(r?$l!dB
ziX~_GzJdvkECi}piTf!WUNU1ZY6&SM79-yeF9udn3`D0y_KeiNJd0
z2m^>kHHz3j(*ze3I4fnn?QgaXYIY-PgCiP_Uv(TMjh&?|M|Cj6(l}@R5NAF7s4mV$
z4~ID(;+7xc*+iTyz)!McXa1|=1h%Ir0RV>Ny)g0~7@rw=1a!p5FY>
zR=fQF)g9Xot_A>+YSs~I)@U_LGze^4H(rEeU8P5GHOmN%{t=zua~zg51`X;K`Fqp&
zdjSAIP#$Ms*w{LBk4h0`@tUFi=yFX|`Bh@EBTA
zI(7^(UokcSO(M&3Lj`RUcecQEBIr0w^GEA?Rz!LA;kV&v|faD
z<&784DEdw85frV-HF&NV{Cob#$FwF%D7=OjnGDi~}Yg;-Kx|Acb*}w8Thb
zT=E?-4E!^lka1VclnjR1g!f#Fb;~DCX*-N_K0zuG{KPedOcngA3Nz-4nbZTRy3Ua}
zXAIs0)EtHL7{j=+V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J!e*Mi4jWo
z(()teg3+4k>7H@uN2Z!LGMQKMR4iM6uj121rG+Ak%Xw*Tai?{D;N2(Tf{_;|#-(4x
zU0&$6i$TY4xlq-1m>6!ZM(N?FB(u5e!opJB%W$N3K3vB6$kc>%!NumAD`1$ljqFU+
z(A=kc>yL2KqR=X#(!RsBPFH76*^__25IpHj`)c$}rsKVoMrB<)L7{lV
zV{kF|+4-@IxWbN!9?zGqGxL$@0kq0FqRC@Fd2*+e{*LaS^X_hyyv}*j{nDDXIWIKG
zjol%g*jX|Kg)QuK3Tfg+*mW~r
zo)24Jdz2XH9@Woovtm3wb+CqpqnX;IN_eb_0*@X+DzGkW!5eKpN^?iL;T
zfyR~^dMIRFk>xr>*2wh|XUCrjnsKEAN^B$J*SgOqoc8V1@9L9Yb8=^qPBOfU3atgs
zF@!Enw>5>@UZlRT_PcYgr0285ao6M7s)YUBCwE>_dH>oeCQLJ}iK|>r?Icum@i(UXE)7}AaB+V>URUM7_H>LY?KO={52=~+dUi8vw4&T+a^;cV
zeHG&AU+(VZvgg(}QUxV4Qgj{?)p4Up$KdB)GXbYpQEWfpc3oJ&t}d_f7a7p?`aR)s
zfgdDBeR=QmLXh9l>KCsJHC_rR-IL7H_4iw69Kq^5xSe@l->PXhhKE1tF_NeK3PajF
z(u`Dbq{}2UX{cjut<6JCx!~uC0()LQzK)p-y^miZ3KMe_jd`{<4h}Z_Txh@l;gtfbTV_U(HFKJN20qL}eJ@D&%b)frf3Vn`Zd2dbHK5wH(O9}$
z6w-QfEB~EOlCIHEy_#Ke9#p7=4}S^UF!kx)r(@PWhXkhV4*!ueFZSZR_nz^xpQW11
XGS!2VpEY1Nf$>|V{#tjPyLkT(-rvi5
literal 0
HcmV?d00001
diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml
index 1da01fcde1e..a1114c20e41 100644
--- a/Resources/Prototypes/Entities/Mobs/Species/base.yml
+++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml
@@ -261,6 +261,12 @@
- type: Carriable
- type: CanEscapeInventory
- type: Mood
+ - type: CritHeartbeat
+ heartbeatSound:
+ path: /Audio/_Sunrise/Effects/heartbeat.ogg
+ params:
+ volume: -3
+ loop: True
# Sunrise-End
- type: Barotrauma
damage:
From 5c9923fb3bec9555ea4484afb0ebaa411fee472d Mon Sep 17 00:00:00 2001
From: GayBot
Date: Wed, 15 Jan 2025 18:23:02 +0300
Subject: [PATCH 2/2] Automatic changelog update
---
Resources/Changelog/ChangelogSunrise.yml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml
index 057f7a35e35..9a02eddbca3 100644
--- a/Resources/Changelog/ChangelogSunrise.yml
+++ b/Resources/Changelog/ChangelogSunrise.yml
@@ -10594,3 +10594,12 @@
id: 733
time: '2025-01-14T17:11:14.0000000+00:00'
url: https://github.com/space-sunrise/space-station-14/pull/1113
+- author: ThereDrD
+ changes:
+ - message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D \u0437\u0432\u0443\u043A\
+ \ \u0441\u0435\u0440\u0434\u0446\u0435\u0431\u0438\u0435\u043D\u0438\u044F \u0432\
+ \ \u043A\u0440\u0438\u0442\u0435"
+ type: Add
+ id: 734
+ time: '2025-01-15T15:26:33.0000000+00:00'
+ url: https://github.com/space-sunrise/space-station-14/pull/1114