Skip to content

Commit

Permalink
Merge pull request #178 from Mnemotechnician/feat/floof-upstream-merg…
Browse files Browse the repository at this point in the history
…e-2024-09-05

Upstream Merge 2024-09-08
  • Loading branch information
Fansana committed Sep 8, 2024
2 parents e542c39 + 51506c3 commit 149d5cc
Show file tree
Hide file tree
Showing 290 changed files with 9,927 additions and 4,462 deletions.
4 changes: 0 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Request a Feature
about: "Template for noting future planned features. Please ask for approval in the Discord if you aren't an organization Member before posting a feature request"
name: Request a feature
about: "Please outline your request in Discord first if you aren't a maintainer."
title: ''
labels: ''
labels: ["Type: Feature"]
assignees: ''

---
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/issue_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Report an Issue
about: "Any general issues you have during play or with the codebase"
name: Report an issue
about: "Any issues found in gameplay or the codebase"
title: ''
labels: ''
labels: 'Type: Bug'
assignees: ''

---
Expand Down
65 changes: 32 additions & 33 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,40 @@ jobs:
permissions:
contents: write
steps:
- name: Checkout Master
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: "${{ vars.CHANGELOG_BRANCH }}"
- name: Checkout Master
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: ${{ vars.CHANGELOG_BRANCH }}

- name: Setup Git
run: |
git config --global user.name "${{ vars.CHANGELOG_USER }}"
git config --global user.email "${{ vars.CHANGELOG_EMAIL }}"
shell: bash
- name: Setup Git
run: |
git config --global user.name "${{ vars.CHANGELOG_USER }}"
git config --global user.email "${{ vars.CHANGELOG_EMAIL }}"
shell: bash

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install Dependencies
run: |
cd "Tools/changelogs"
npm install
shell: bash
continue-on-error: true
- name: Install Dependencies
run: |
cd "Tools/changelogs"
npm install
shell: bash

- name: Generate Changelog
run: |
cd "Tools/changelogs"
node changelog.js
shell: bash
continue-on-error: true
- name: Generate Changelog
run: |
cd "Tools/changelogs"
node changelog.js
shell: bash

- name: Commit Changelog
run: |
git add *.yml
git commit -m "${{ vars.CHANGELOG_MESSAGE }} (#${{ env.PR_NUMBER }})"
git push
shell: bash
continue-on-error: true
- name: Commit Changelog
run: |
git pull origin master
git add *.yml
git commit -m "${{ vars.CHANGELOG_MESSAGE }} (#${{ env.PR_NUMBER }})"
git push
shell: bash
continue-on-error: true
24 changes: 24 additions & 0 deletions .github/workflows/discord-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Discord Changelog

on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'

jobs:
publish_changelog:
runs-on: ubuntu-latest
steps:

- name: checkout
uses: actions/checkout@v3
with:
ref: master

- name: Publish changelog
run: Tools/actions_changelogs_since_last_run.py
env:
CHANGELOG_DIR: ${{ vars.CHANGELOG_DIR }}
CHANGELOG_WEBHOOK: ${{ secrets.CHANGELOG_WEBHOOK }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
continue-on-error: true
2 changes: 1 addition & 1 deletion Content.Client/Administration/UI/AdminUIHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static bool TryConfirm(Button button, Dictionary<Button, ConfirmationData
button.Text = data.OriginalText;
}, data.Cancellation.Token);

button.ModulateSelfOverride = StyleNano.ButtonColorCautionDefault;
button.ModulateSelfOverride = StyleNano.ButtonColorDangerDefault;
button.Text = Loc.GetString("admin-player-actions-confirm");
return false;
}
Expand Down
119 changes: 119 additions & 0 deletions Content.Client/Audio/Jukebox/JukeboxBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using Content.Shared.Audio.Jukebox;
using Robust.Client.Audio;
using Robust.Client.Player;
using Robust.Shared.Audio.Components;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Audio.Jukebox;

public sealed class JukeboxBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;

[ViewVariables]
private JukeboxMenu? _menu;

public JukeboxBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void Open()
{
base.Open();

_menu = new JukeboxMenu();
_menu.OnClose += Close;
_menu.OpenCentered();

_menu.OnPlayPressed += args =>
{
if (args)
{
SendMessage(new JukeboxPlayingMessage());
}
else
{
SendMessage(new JukeboxPauseMessage());
}
};

_menu.OnStopPressed += () =>
{
SendMessage(new JukeboxStopMessage());
};

_menu.OnSongSelected += SelectSong;

_menu.SetTime += SetTime;
PopulateMusic();
Reload();
}

/// <summary>
/// Reloads the attached menu if it exists.
/// </summary>
public void Reload()
{
if (_menu == null || !EntMan.TryGetComponent(Owner, out JukeboxComponent? jukebox))
return;

_menu.SetAudioStream(jukebox.AudioStream);

if (_protoManager.TryIndex(jukebox.SelectedSongId, out var songProto))
{
var length = EntMan.System<AudioSystem>().GetAudioLength(songProto.Path.Path.ToString());
_menu.SetSelectedSong(songProto.Name, (float) length.TotalSeconds);
}
else
{
_menu.SetSelectedSong(string.Empty, 0f);
}
}

public void PopulateMusic()
{
_menu?.Populate(_protoManager.EnumeratePrototypes<JukeboxPrototype>());
}

public void SelectSong(ProtoId<JukeboxPrototype> songid)
{
SendMessage(new JukeboxSelectedMessage(songid));
}

public void SetTime(float time)
{
var sentTime = time;

// You may be wondering, what the fuck is this
// Well we want to be able to predict the playback slider change, of which there are many ways to do it
// We can't just use SendPredictedMessage because it will reset every tick and audio updates every frame
// so it will go BRRRRT
// Using ping gets us close enough that it SHOULD, MOST OF THE TIME, fall within the 0.1 second tolerance
// that's still on engine so our playback position never gets corrected.
if (EntMan.TryGetComponent(Owner, out JukeboxComponent? jukebox) &&
EntMan.TryGetComponent(jukebox.AudioStream, out AudioComponent? audioComp))
{
audioComp.PlaybackPosition = time;
}

SendMessage(new JukeboxSetTimeMessage(sentTime));
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

if (_menu == null)
return;

_menu.OnClose -= Close;
_menu.Dispose();
_menu = null;
}
}

18 changes: 18 additions & 0 deletions Content.Client/Audio/Jukebox/JukeboxMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<ui:FancyWindow xmlns="https://spacestation14.io" xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
SetSize="400 500" Title="{Loc 'jukebox-menu-title'}">
<BoxContainer Margin="4 0" Orientation="Vertical">
<ItemList Name="MusicList" SelectMode="Button" Margin="3 3 3 3"
HorizontalExpand="True" VerticalExpand="True" SizeFlagsStretchRatio="8"/>
<BoxContainer Orientation="Vertical">
<Label Name="SongSelected" Text="{Loc 'jukebox-menu-selectedsong'}" />
<Label Name="SongName" Text="---" />
<Slider Name="PlaybackSlider" HorizontalExpand="True" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True"
VerticalExpand="False" SizeFlagsStretchRatio="1">
<Button Name="PlayButton" Text="{Loc 'jukebox-menu-buttonplay'}" />
<Button Name="StopButton" Text="{Loc 'jukebox-menu-buttonstop'}" />
<Label Name="DurationLabel" Text="00:00 / 00:00" HorizontalAlignment="Right" HorizontalExpand="True"/>
</BoxContainer>
</BoxContainer>
</ui:FancyWindow>
Loading

0 comments on commit 149d5cc

Please sign in to comment.