From a315c02107c15dab743913d8b54bf747cb0e167f Mon Sep 17 00:00:00 2001 From: RavMorgan <48182970+RavMorgan@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:33:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A5=D0=BE=D0=B4=D0=B8=D1=82=D1=8C=20=D1=87?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D0=B2=D0=B5=D0=BA=20=D0=B3=D1=83=D1=81=D1=8C?= =?UTF-8?q?=D0=BC=D0=BE=D0=BF=D1=81=D0=B8=D0=BA=20=D0=B4=D0=B0=D0=B2=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B4=D0=B5=D0=BD=D1=8C=D0=B3=D0=B8=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Апдейт жукбокс системы Добавлен волкман --- Content.Client/White/Jukebox/JukeboxSystem.cs | 12 +++--- .../Jukebox/JukeboxComponentsAndStuff.cs | 8 +++- Content.Shared/White/WhiteCVars.cs | 3 -- .../white/entities/jukebox/jukebox.ftl | 4 ++ .../MeatyOrePanel/meatyore_catalog.yml | 15 +++++++ .../White/JukeboxAndStuff/jukebox_stuff.yml | 33 ++++++++++++++++ .../Devices/walkman.rsi/equipped-BELT.png | Bin 0 -> 384 bytes .../Objects/Devices/walkman.rsi/meta.json | 37 ++++++++++++++++++ .../walkman.rsi/walkman-inhand-left.png | Bin 0 -> 492 bytes .../walkman.rsi/walkman-inhand-right.png | Bin 0 -> 500 bytes .../Objects/Devices/walkman.rsi/walkman.png | Bin 0 -> 589 bytes .../walkman.rsi/walkman_working_overlay.png | Bin 0 -> 184 bytes 12 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 Resources/Textures/White/Objects/Devices/walkman.rsi/equipped-BELT.png create mode 100644 Resources/Textures/White/Objects/Devices/walkman.rsi/meta.json create mode 100644 Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-left.png create mode 100644 Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-right.png create mode 100644 Resources/Textures/White/Objects/Devices/walkman.rsi/walkman.png create mode 100644 Resources/Textures/White/Objects/Devices/walkman.rsi/walkman_working_overlay.png diff --git a/Content.Client/White/Jukebox/JukeboxSystem.cs b/Content.Client/White/Jukebox/JukeboxSystem.cs index a0d50abc6a..3f06ce8d68 100644 --- a/Content.Client/White/Jukebox/JukeboxSystem.cs +++ b/Content.Client/White/Jukebox/JukeboxSystem.cs @@ -26,14 +26,12 @@ public sealed class JukeboxSystem : EntitySystem private readonly Dictionary _playingJukeboxes = new(); - private float _maxAudioRange; private float _jukeboxVolume; public override void Initialize() { base.Initialize(); - _cfg.OnValueChanged(WhiteCVars.MaxJukeboxSoundRange, range => _maxAudioRange = range, true); _cfg.OnValueChanged(WhiteCVars.JukeboxVolume, JukeboxVolumeChanged, true); SubscribeLocalEvent(OnStateChanged); @@ -116,7 +114,7 @@ public sealed class JukeboxSystem : EntitySystem foreach (var (jukeboxComponent, jukeboxXform) in jukeboxes) { - if (jukeboxXform.MapID != playerXform.MapID || (jukeboxXform.MapPosition.Position - playerXform.MapPosition.Position).Length() > _maxAudioRange) + if (jukeboxXform.MapID != playerXform.MapID || (jukeboxXform.MapPosition.Position - playerXform.MapPosition.Position).Length() > jukeboxComponent.MaxAudioRange) { if (_playingJukeboxes.TryGetValue(jukeboxComponent, out var stream)) { @@ -143,7 +141,7 @@ public sealed class JukeboxSystem : EntitySystem continue; } - SetOcclusion(playerXform, jukeboxXform, jukeboxAudio); + SetRolloffAndOcclusion(jukeboxComponent, playerXform, jukeboxXform, jukeboxAudio); SetPosition(jukeboxXform, jukeboxAudio); } else @@ -172,7 +170,7 @@ public sealed class JukeboxSystem : EntitySystem jukeboxAudio.PlayingStream.Position = jukeboxXform.MapPosition.Position; } - private void SetOcclusion(TransformComponent playerXform, TransformComponent jukeboxXform, JukeboxAudio jukeboxAudio) + private void SetRolloffAndOcclusion(JukeboxComponent jukeboxComponent, TransformComponent playerXform, TransformComponent jukeboxXform, JukeboxAudio jukeboxAudio) { var collisionMask = CollisionGroup.Impassable; var sourceRelative = playerXform.MapPosition.Position - jukeboxXform.MapPosition.Position; @@ -186,6 +184,7 @@ public sealed class JukeboxSystem : EntitySystem } jukeboxAudio.PlayingStream.Occlusion = occlusion; + jukeboxAudio.PlayingStream.RolloffFactor = (jukeboxXform.MapPosition.Position - playerXform.MapPosition.Position).Length() * jukeboxComponent.RolloffFactor; } private void HandleSongChanged(JukeboxAudio jukeboxAudio, JukeboxComponent jukeboxComponent, TransformComponent jukeboxXform, TransformComponent playerXform) @@ -255,14 +254,13 @@ public sealed class JukeboxSystem : EntitySystem return null!; playingStream.Volume = _jukeboxVolume; - playingStream.RolloffFactor = 3.5f; playingStream.PlaybackPosition = jukeboxComponent.PlayingSongData.PlaybackPosition; playingStream.Position = jukeboxXform.MapPosition.Position; var jukeboxAudio = new JukeboxAudio(playingStream!, audio, jukeboxComponent.PlayingSongData); - SetOcclusion(playerXform, jukeboxXform, jukeboxAudio); + SetRolloffAndOcclusion(jukeboxComponent, playerXform, jukeboxXform, jukeboxAudio); playingStream.StartPlaying(); return jukeboxAudio; diff --git a/Content.Shared/White/Jukebox/JukeboxComponentsAndStuff.cs b/Content.Shared/White/Jukebox/JukeboxComponentsAndStuff.cs index 2153b99744..3d2110b356 100644 --- a/Content.Shared/White/Jukebox/JukeboxComponentsAndStuff.cs +++ b/Content.Shared/White/Jukebox/JukeboxComponentsAndStuff.cs @@ -40,9 +40,15 @@ public sealed partial class JukeboxComponent : Component [ViewVariables(VVAccess.ReadOnly)] public bool Repeating { get; set; } = true; - [ViewVariables(VVAccess.ReadOnly)] + [DataField("volume") ,ViewVariables(VVAccess.ReadOnly)] public float Volume { get; set; } + [DataField("maxAudioRange")] + public float MaxAudioRange { get; set; } = 20f; + + [DataField("rolloffFactor")] + public float RolloffFactor { get; set; } = 0.3f; + public PlayingSongData? PlayingSongData { get; set; } } diff --git a/Content.Shared/White/WhiteCVars.cs b/Content.Shared/White/WhiteCVars.cs index 8e0d179224..7ccf568c31 100644 --- a/Content.Shared/White/WhiteCVars.cs +++ b/Content.Shared/White/WhiteCVars.cs @@ -186,9 +186,6 @@ public sealed class WhiteCVars public static readonly CVarDef MaxJukeboxSongSizeInMb = CVarDef.Create("white.max_jukebox_song_size", 3.5f, CVar.SERVER | CVar.REPLICATED | CVar.ARCHIVE); - public static readonly CVarDef MaxJukeboxSoundRange = CVarDef.Create("white.max_jukebox_sound_range", 20f, - CVar.SERVER | CVar.REPLICATED | CVar.ARCHIVE); - public static readonly CVarDef JukeboxVolume = CVarDef.Create("white.jukebox_volume", 0f, CVar.CLIENTONLY | CVar.ARCHIVE); diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/white/entities/jukebox/jukebox.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/white/entities/jukebox/jukebox.ftl index f50ebe7966..b9843cb9d0 100644 --- a/Resources/Locale/ru-RU/ss14-ru/prototypes/white/entities/jukebox/jukebox.ftl +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/white/entities/jukebox/jukebox.ftl @@ -7,3 +7,7 @@ ent-TapeRecorder = Мысль ent-TapeEmpty = Аудиокассета .desc = Старая аудиокассета, возможно на ней что-то есть. .suffix = { "" } + +ent-Walkman = Портативный аудиоплеер + .desc = Удобно крепится на пояс. + .suffix = { "" } diff --git a/Resources/Prototypes/Catalog/MeatyOrePanel/meatyore_catalog.yml b/Resources/Prototypes/Catalog/MeatyOrePanel/meatyore_catalog.yml index ed00443da5..5eaf0f4a15 100644 --- a/Resources/Prototypes/Catalog/MeatyOrePanel/meatyore_catalog.yml +++ b/Resources/Prototypes/Catalog/MeatyOrePanel/meatyore_catalog.yml @@ -1838,6 +1838,21 @@ - !type:DonationTierLockCondition tier: 5 +- type: listing + id: DjWalkman + productEntity: Walkman + cost: + MeatyOreCoin: 0 + categories: + - DjJukeboxCategory + conditions: + - !type:ListingLimitedStockCondition + stock: 1 + - !type:DonationTierLockCondition + tier: 5 + + + - type: listing id: DjTapeRecorder productEntity: TapeRecorder diff --git a/Resources/Prototypes/White/JukeboxAndStuff/jukebox_stuff.yml b/Resources/Prototypes/White/JukeboxAndStuff/jukebox_stuff.yml index 4b174034f6..b2b8875ecb 100644 --- a/Resources/Prototypes/White/JukeboxAndStuff/jukebox_stuff.yml +++ b/Resources/Prototypes/White/JukeboxAndStuff/jukebox_stuff.yml @@ -6,6 +6,7 @@ suffix: Empty components: - type: Jukebox + maxAudioRange: 15 - type: Sprite sprite: White/Objects/Devices/jukebox.rsi layers: @@ -28,6 +29,38 @@ jukebox_tapes: !type:Container jukebox_default_tapes: !type:Container +- type: entity + parent: ClothingBeltBase + id: Walkman + name: Walkman + description: Mini cassette player + suffix: Empty + components: + - type: Jukebox + maxAudioRange: 5 + rolloffFactor: 3.5 + - type: Sprite + sprite: White/Objects/Devices/walkman.rsi + layers: + - state: walkman + - state: walkman_working_overlay + map: [ "bars" ] + - type: Item + sprite: White/Objects/Devices/walkman.rsi + heldPrefix: walkman + size: 20 + - type: UserInterface + interfaces: + - key: enum.JukeboxUIKey.Key + type: JukeboxBUI + - type: ActivatableUI + key: enum.JukeboxUIKey.Key + - type: ContainerContainer + containers: + jukebox_tapes: !type:Container + jukebox_default_tapes: !type:Container + + - type: entity parent: BaseItem id: TapeRecorder diff --git a/Resources/Textures/White/Objects/Devices/walkman.rsi/equipped-BELT.png b/Resources/Textures/White/Objects/Devices/walkman.rsi/equipped-BELT.png new file mode 100644 index 0000000000000000000000000000000000000000..65991686cf93a4b4869f831778d0ade62f5c79ac GIT binary patch literal 384 zcmV-`0e}99P)Px$I!Q!9RCt{2+P_M}P!z}UBRJ@4H~+RnhrC3%uaIUDI<*u*mzF|tDTvT#P;d`) zQC~oDNoXlPK%qlXaBNo{gySG7B2{SGB((j0rsRf@b5Gzd=O+RH00000ux2*WE+8t` zDQI|odw;jI`-~4?z=xf~h0FmzuLYPOGCbf(}Qu%-&=&0{^)!1esDUryd>@cG< z8ja=U^-Z?6H>KIUkYe#T*73OKwYAl{l#lmMIXc{vOlC(!qUVGbQtZ|B&7|{j=L3@b e761UiO8WxLiF~yIrF#Yd0000qR literal 0 HcmV?d00001 diff --git a/Resources/Textures/White/Objects/Devices/walkman.rsi/meta.json b/Resources/Textures/White/Objects/Devices/walkman.rsi/meta.json new file mode 100644 index 0000000000..bf516a10f3 --- /dev/null +++ b/Resources/Textures/White/Objects/Devices/walkman.rsi/meta.json @@ -0,0 +1,37 @@ +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "license": "CC0-1.0", + "copyright": "ГусьМопсик", + "states": [ + { + "name": "walkman_working_overlay", + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + }, + { + "name": "equipped-BELT", + "directions": 4 + }, + { + "name": "walkman" + }, + { + "name": "walkman-inhand-right", + "directions": 4 + }, + { + "name": "walkman-inhand-left", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-left.png b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-left.png new file mode 100644 index 0000000000000000000000000000000000000000..6c41a4b2b5ab1945e31a0bcc1c04071f5ce3c7b8 GIT binary patch literal 492 zcmVPx$rb$FWRCt{2+RsV?Q4|L7Ga)V~$X%9>3n5=Z<`pW07Q$F$P|qNQFmIrY;1dMC zLeU^fAw57b3$=fn7Lm3;t%N}^aXfdL^!u%c?_SQFnZ-Sq2mk;800000003Z(Xwre( zyF1*vYSCaYq_5G4F3!&aui-SBys7JC7-=dT73lrtReZl2(t%~GM9do5c2y+LwyVUf zQQ0bqU-sC9d%p(2?Oe7Lpk;<7xSpnAC>G6qZ+e+v8Dd_-R*XKUtx~^#6 zzq3dIR9gFg01EKe8<-aMrxCdV0000000000s3tmYlAH{OMf5~SdNLda(Kpoh9{J<* zo5rItJ$YVe9nkIGab&vA%$uAsvOJmWs&-kaaHn(6xm=E&Ml+N(=Tbe<_3L|&-0MB? z&Gl`d0>o5oO7%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Xu0mjf{GJiN literal 0 HcmV?d00001 diff --git a/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman_working_overlay.png b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman_working_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..8e82b7e2b23232d1e973e0fc2dc466fb70674b8d GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|iacE$Ln`LH zy|tUS!GMR=q1!iuS(R1zf}zOeROz$@3*Aq61RlA|@Xuyv2@6p9`#GtrdVkB`lyY8F z+1s%-l;iuS+v18TZ7=>Y0cAm;qG(!X{+;?W*G~Llen^#A|> literal 0 HcmV?d00001