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 0000000000..65991686cf Binary files /dev/null and b/Resources/Textures/White/Objects/Devices/walkman.rsi/equipped-BELT.png differ 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 0000000000..6c41a4b2b5 Binary files /dev/null and b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-right.png b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-right.png new file mode 100644 index 0000000000..d20b17323a Binary files /dev/null and b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman-inhand-right.png differ diff --git a/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman.png b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman.png new file mode 100644 index 0000000000..0d052945e5 Binary files /dev/null and b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman.png differ 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 0000000000..8e82b7e2b2 Binary files /dev/null and b/Resources/Textures/White/Objects/Devices/walkman.rsi/walkman_working_overlay.png differ