Skip to content

Commit

Permalink
Merge pull request #1621 from space-syndicate/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Morb0 authored Dec 10, 2023
2 parents 57ed7f3 + 5ecee65 commit 83f41e7
Show file tree
Hide file tree
Showing 124 changed files with 3,968 additions and 2,720 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/update-credits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,29 @@ jobs:
# TODO
#- name: Get this week's Patreons
# run: Tools/script2dumppatreons > Resources/Credits/Patrons.yml

# MAKE SURE YOU ENABLED "Allow GitHub Actions to create and approve pull requests" IN YOUR ACTIONS, OTHERWISE IT WILL MOST LIKELY FAIL


# For this you can use a pat token of an account with direct push access to the repo if you have protected branches.
# Uncomment this and comment the other line if you do this.
# https://github.com/stefanzweifel/git-auto-commit-action#push-to-protected-branches

#- name: Commit new credit files
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: Update Credits
# commit_author: PJBot <[email protected]>

# This will make a PR
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV

- name: Commit new credit files
uses: stefanzweifel/git-auto-commit-action@v4
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit_message: Update Credits
commit_author: PJBot <[email protected]>
commit-message: Update Credits
title: Update Credits
body: This is an automated Pull Request. This PR updates the github contributors in the credits section.
author: PJBot <[email protected]>
branch: automated/credits-${{env.NOW}}
8 changes: 4 additions & 4 deletions Content.Client/Audio/AmbientSoundSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public override void Initialize()
_cfg.OnValueChanged(CCVars.AmbientCooldown, SetCooldown, true);
_cfg.OnValueChanged(CCVars.MaxAmbientSources, SetAmbientCount, true);
_cfg.OnValueChanged(CCVars.AmbientRange, SetAmbientRange, true);
_cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume, true);
_cfg.OnValueChanged(CCVars.AmbienceVolume, SetAmbienceGain, true);
SubscribeLocalEvent<AmbientSoundComponent, ComponentShutdown>(OnShutdown);
}

Expand All @@ -116,9 +116,9 @@ private void OnShutdown(EntityUid uid, AmbientSoundComponent component, Componen
_playingCount.Remove(sound.Path);
}

private void SetAmbienceVolume(float value)
private void SetAmbienceGain(float value)
{
_ambienceVolume = value;
_ambienceVolume = SharedAudioSystem.GainToVolume(value);

foreach (var (comp, values) in _playingSounds)
{
Expand All @@ -141,7 +141,7 @@ public override void Shutdown()
_cfg.UnsubValueChanged(CCVars.AmbientCooldown, SetCooldown);
_cfg.UnsubValueChanged(CCVars.MaxAmbientSources, SetAmbientCount);
_cfg.UnsubValueChanged(CCVars.AmbientRange, SetAmbientRange);
_cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceVolume);
_cfg.UnsubValueChanged(CCVars.AmbienceVolume, SetAmbienceGain);
}

private int PlayingCount(string countSound)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Audio/BackgroundAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void StartLobbyMusic()
}

_lobbyStream = _audio.PlayGlobal(file, Filter.Local(), false,
_lobbyParams.WithVolume(_lobbyParams.Volume + _configManager.GetCVar(CCVars.LobbyMusicVolume)))?.Entity;
_lobbyParams.WithVolume(_lobbyParams.Volume + SharedAudioSystem.GainToVolume(_configManager.GetCVar(CCVars.LobbyMusicVolume))))?.Entity;
}

private void EndLobbyMusic()
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void InitializeAmbientMusic()

private void AmbienceCVarChanged(float obj)
{
_volumeSlider = obj;
_volumeSlider = SharedAudioSystem.GainToVolume(obj);

if (_ambientMusicStream != null && _musicProto != null)
{
Expand Down
15 changes: 15 additions & 0 deletions Content.Client/Audio/ContentAudioSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Shared.Audio;
using Content.Shared.CCVar;
using Robust.Client.GameObjects;
using Robust.Shared;
using Robust.Shared.Audio;
using AudioComponent = Robust.Shared.Audio.Components.AudioComponent;

Expand All @@ -18,6 +20,19 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem
private const float MinVolume = -32f;
private const float DefaultDuration = 2f;

/*
* Gain multipliers for specific audio sliders.
* The float value will get multiplied by this when setting
* i.e. a gain of 0.5f x 3 will equal 1.5f which is supported in OpenAL.
*/

public const float MasterVolumeMultiplier = 3f;
public const float MidiVolumeMultiplier = 0.25f;
public const float AmbienceMultiplier = 3f;
public const float AmbientMusicMultiplier = 3f;
public const float LobbyMultiplier = 3f;
public const float TtsMultiplier = 3f; // Corvax-TTS

public override void Initialize()
{
base.Initialize();
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.OpenInventoryMenu);
human.AddFunction(ContentKeyFunctions.SmartEquipBackpack);
human.AddFunction(ContentKeyFunctions.SmartEquipBelt);
human.AddFunction(ContentKeyFunctions.OpenBackpack);
human.AddFunction(ContentKeyFunctions.OpenBelt);
human.AddFunction(ContentKeyFunctions.MouseMiddle);
human.AddFunction(ContentKeyFunctions.ArcadeUp);
human.AddFunction(ContentKeyFunctions.ArcadeDown);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
using Content.Shared.Medical.CrewMonitoring;
using Robust.Client.GameObjects;

namespace Content.Client.Medical.CrewMonitoring
namespace Content.Client.Medical.CrewMonitoring;

public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface
{
public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface
[ViewVariables]
private CrewMonitoringWindow? _menu;

public CrewMonitoringBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
[ViewVariables]
private CrewMonitoringWindow? _menu;
}

public CrewMonitoringBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
EntityUid? gridUid = null;
string stationName = string.Empty;

protected override void Open()
if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
{
EntityUid? gridUid = null;
gridUid = xform.GridUid;

if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
if (EntMan.TryGetComponent<MetaDataComponent>(gridUid, out var metaData))
{
gridUid = xform.GridUid;
stationName = metaData.EntityName;
}

_menu = new CrewMonitoringWindow(gridUid);

_menu.OpenCentered();
_menu.OnClose += Close;
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
_menu = new CrewMonitoringWindow(stationName, gridUid);

switch (state)
{
case CrewMonitoringState st:
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_menu.OpenCentered();
_menu.OnClose += Close;
}

_menu?.ShowSensors(st.Sensors, xform?.Coordinates, st.Snap, st.Precision);
break;
}
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

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

_menu?.Dispose();
case CrewMonitoringState st:
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_menu?.ShowSensors(st.Sensors, Owner, xform?.Coordinates);
break;
}
}

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

_menu?.Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Content.Client.Pinpointer.UI;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;

namespace Content.Client.Medical.CrewMonitoring;

public sealed partial class CrewMonitoringNavMapControl : NavMapControl
{
public NetEntity? Focus;
public Dictionary<NetEntity, string> LocalizedNames = new();

private Color _backgroundColor;
private Label _trackedEntityLabel;
private PanelContainer _trackedEntityPanel;

public CrewMonitoringNavMapControl() : base()
{
WallColor = new Color(250, 146, 255);
TileColor = new(71, 42, 72);

_backgroundColor = Color.FromSrgb(TileColor.WithAlpha(0.8f));

_trackedEntityLabel = new Label
{
Margin = new Thickness(10f, 8f),
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
Modulate = Color.White,
};

_trackedEntityPanel = new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = _backgroundColor,
},

Margin = new Thickness(5f, 10f),
HorizontalAlignment = HAlignment.Left,
VerticalAlignment = VAlignment.Bottom,
Visible = false,
};

_trackedEntityPanel.AddChild(_trackedEntityLabel);
this.AddChild(_trackedEntityPanel);
}

protected override void Draw(DrawingHandleScreen handle)
{
base.Draw(handle);

if (Focus == null)
{
_trackedEntityLabel.Text = string.Empty;
_trackedEntityPanel.Visible = false;

return;
}

foreach ((var netEntity, var blip) in TrackedEntities)
{
if (netEntity != Focus)
continue;

if (!LocalizedNames.TryGetValue(netEntity, out var name))
name = "Unknown";

var message = name + "\nLocation: [x = " + MathF.Round(blip.Coordinates.X) + ", y = " + MathF.Round(blip.Coordinates.Y) + "]";

_trackedEntityLabel.Text = message;
_trackedEntityPanel.Visible = true;

return;
}

_trackedEntityLabel.Text = string.Empty;
_trackedEntityPanel.Visible = false;
}
}
76 changes: 43 additions & 33 deletions Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.Pinpointer.UI"
xmlns:ui="clr-namespace:Content.Client.Medical.CrewMonitoring"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'crew-monitoring-user-interface-title'}"
SetSize="1130 700"
MinSize="1130 700">
<BoxContainer Orientation="Horizontal">
<ScrollContainer HorizontalExpand="True"
VerticalExpand="True"
Margin="8, 8, 8, 8">
<GridContainer Name="SensorsTable"
HorizontalExpand="True"
VerticalExpand="True"
HSeparationOverride="5"
VSeparationOverride="20"
Columns="4">
<!-- Table header -->
<Label Text="{Loc 'crew-monitoring-user-interface-name'}"
StyleClasses="LabelHeading"/>
<Label Text="{Loc 'crew-monitoring-user-interface-job'}"
StyleClasses="LabelHeading"/>
<Label Text="{Loc 'crew-monitoring-user-interface-status'}"
StyleClasses="LabelHeading"/>
<Label Text="{Loc 'crew-monitoring-user-interface-location'}"
StyleClasses="LabelHeading"/>
SetSize="1200 700"
MinSize="1200 700">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal" VerticalExpand="True" HorizontalExpand="True">
<ui:CrewMonitoringNavMapControl Name="NavMap" HorizontalExpand="True" VerticalExpand="True" Margin="5 20"/>
<BoxContainer Orientation="Vertical">
<controls:StripeBack>
<PanelContainer>
<Label Name="StationName" Text="Unknown station" Align="Center" />
</PanelContainer>
</controls:StripeBack>

<ScrollContainer Name="SensorScroller"
VerticalExpand="True"
SetWidth="520"
Margin="8, 8, 8, 8">
<BoxContainer Name="SensorsTable"
Orientation="Vertical"
HorizontalExpand="True"
Margin="0 0 10 0">
<!-- Table rows are filled by code -->
</BoxContainer>
<Label Name="NoServerLabel"
Text="{Loc 'crew-monitoring-user-interface-no-server'}"
StyleClasses="LabelHeading"
FontColorOverride="Red"
HorizontalAlignment="Center"
Visible="false"/>
</ScrollContainer>
</BoxContainer>
</BoxContainer>

<!-- Table rows are filled by code -->
</GridContainer>
<Label Name="NoServerLabel"
Text="{Loc 'crew-monitoring-user-interface-no-server'}"
StyleClasses="LabelHeading"
FontColorOverride="Red"
HorizontalAlignment="Center"
Visible="false"/>
</ScrollContainer>
<ui:NavMapControl Name="NavMap"
Margin="5 5"/>
<!-- Footer -->
<BoxContainer Orientation="Vertical">
<PanelContainer StyleClasses="LowDivider" />
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom">
<Label Text="{Loc 'crew-monitoring-user-interface-flavor-left'}" StyleClasses="WindowFooterText" />
<Label Text="{Loc 'crew-monitoring-user-interface-flavor-right'}" StyleClasses="WindowFooterText"
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" />
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered"
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
Loading

0 comments on commit 83f41e7

Please sign in to comment.