Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into bluespace-goat-upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Roudenn committed Feb 3, 2024
2 parents 405081b + 473630b commit 4da74cc
Show file tree
Hide file tree
Showing 448 changed files with 172,877 additions and 185,439 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/close-master-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Close PR's on master

on:
pull_request_target:
types: [ opened, ready_for_review ]

jobs:
run:
runs-on: ubuntu-latest
if: ${{github.head_ref == 'master' || github.head_ref == 'main' || github.head_ref == 'develop'}}

steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: "Thank you for contributing to the Space Station 14 repository. Unfortunately, it looks like you submitted your pull request from the master branch. We suggest you follow [our git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html) \n\n You can move your current work from the master branch to another branch by doing `git branch <branch_name` and resetting the master branch."

# If you prefer to just comment on the pr and not close it, uncomment the bellow and comment the above

# - uses: actions/github-script@v7
# with:
# script: |
# github.rest.issues.createComment({
# issue_number: ${{ github.event.number }},
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: "Thank you for contributing to the Space Station 14 repository. Unfortunately, it looks like you submitted your pull request from the master branch. We suggest you follow [our git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html) \n\n You can move your current work from the master branch to another branch by doing `git branch <branch_name` and resetting the master branch. \n\n This pr won't be automatically closed. However, a maintainer may close it for this reason."
# })
2 changes: 1 addition & 1 deletion .run/Content Server+Client.run.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<component name="ProjectRunConfigurationManager">
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Content Server+Client" type="CompoundRunConfigurationType">
<toRun name="Content.Client" type="DotNetProject" />
<toRun name="Content.Server" type="DotNetProject" />
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeMana

foreach (var job in jobs)
{
if (!job.SetPreference)
if (!job.OverrideConsoleVisibility.GetValueOrDefault(job.SetPreference))
{
continue;
}
Expand Down
154 changes: 11 additions & 143 deletions Content.Client/Administration/QuickDialogSystem.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using System.Linq;
using Content.Client.UserInterface.Controls;
using Content.Shared.Administration;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;

namespace Content.Client.Administration;

// mfw they ported input() from BYOND

/// <summary>
/// This handles the client portion of quick dialogs.
/// </summary>
Expand All @@ -21,149 +16,22 @@ public override void Initialize()

private void OpenDialog(QuickDialogOpenEvent ev)
{
var window = new FancyWindow()
{
Title = ev.Title
};

var entryContainer = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Vertical,
Margin = new Thickness(8),
};

var promptsDict = new Dictionary<string, LineEdit>();

for (var index = 0; index < ev.Prompts.Count; index++)
{
var entry = ev.Prompts[index];
var entryBox = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Horizontal
};

entryBox.AddChild(new Label { Text = entry.Prompt, HorizontalExpand = true, SizeFlagsStretchRatio = 0.5f });
var edit = new LineEdit() { HorizontalExpand = true };
entryBox.AddChild(edit);
switch (entry.Type)
{
case QuickDialogEntryType.Integer:
edit.IsValid += VerifyInt;
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-integer");
break;
case QuickDialogEntryType.Float:
edit.IsValid += VerifyFloat;
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-float");
break;
case QuickDialogEntryType.ShortText:
edit.IsValid += VerifyShortText;
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-short-text");
break;
case QuickDialogEntryType.LongText:
edit.IsValid += VerifyLongText;
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-long-text");
break;
default:
throw new ArgumentOutOfRangeException();
}

promptsDict.Add(entry.FieldId, edit);
entryContainer.AddChild(entryBox);

if (index == ev.Prompts.Count - 1)
{
// Last text box gets enter confirmation.
// Only the last so you don't accidentally confirm early.
edit.OnTextEntered += _ => Confirm();
}
}
var ok = (ev.Buttons & QuickDialogButtonFlag.OkButton) != 0;
var cancel = (ev.Buttons & QuickDialogButtonFlag.CancelButton) != 0;
var window = new DialogWindow(ev.Title, ev.Prompts, ok: ok, cancel: cancel);

var buttonsBox = new BoxContainer()
window.OnConfirmed += responses =>
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
HorizontalAlignment = Control.HAlignment.Center,
};

var alreadyReplied = false;

if ((ev.Buttons & QuickDialogButtonFlag.OkButton) != 0)
{
var okButton = new Button()
{
Text = Loc.GetString("quick-dialog-ui-ok"),
};

okButton.OnPressed += _ => Confirm();

buttonsBox.AddChild(okButton);
}

if ((ev.Buttons & QuickDialogButtonFlag.OkButton) != 0)
{
var cancelButton = new Button()
{
Text = Loc.GetString("quick-dialog-ui-cancel"),
};

cancelButton.OnPressed += _ =>
{
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
new(),
QuickDialogButtonFlag.CancelButton));
alreadyReplied = true;
window.Close();
};

buttonsBox.AddChild(cancelButton);
}

window.OnClose += () =>
{
if (!alreadyReplied)
{
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
new(),
QuickDialogButtonFlag.CancelButton));
}
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
responses,
QuickDialogButtonFlag.OkButton));
};

entryContainer.AddChild(buttonsBox);

window.ContentsContainer.AddChild(entryContainer);

window.MinWidth *= 2; // Just double it.

window.OpenCentered();

return;

void Confirm()
window.OnCancelled += () =>
{
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
promptsDict.Select(x => (x.Key, x.Value.Text)).ToDictionary(x => x.Key, x => x.Text),
QuickDialogButtonFlag.OkButton));
alreadyReplied = true;
window.Close();
}
}

private bool VerifyInt(string input)
{
return int.TryParse(input, out var _);
}

private bool VerifyFloat(string input)
{
return float.TryParse(input, out var _);
}

private bool VerifyShortText(string input)
{
return input.Length <= 100;
}

private bool VerifyLongText(string input)
{
return input.Length <= 2000;
new(),
QuickDialogButtonFlag.CancelButton));
};
}
}
48 changes: 38 additions & 10 deletions Content.Client/Antag/AntagStatusIconSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Content.Shared.Ghost;
using Content.Shared.Antag;
using Content.Shared.Revolutionary.Components;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Content.Shared.Zombies;
using Robust.Client.Player;
using Robust.Shared.Prototypes;

Expand All @@ -9,24 +11,50 @@ namespace Content.Client.Antag;
/// <summary>
/// Used for assigning specified icons for antags.
/// </summary>
public abstract class AntagStatusIconSystem<T> : SharedStatusIconSystem
where T : IComponent
public sealed class AntagStatusIconSystem : SharedStatusIconSystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<RevolutionaryComponent, GetStatusIconsEvent>(GetRevIcon);
SubscribeLocalEvent<ZombieComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<HeadRevolutionaryComponent, GetStatusIconsEvent>(GetIcon);

//start-backmen: antag
SubscribeLocalEvent<Shared.Backmen.Flesh.FleshCultistComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<Shared.Backmen.Blob.BlobObserverComponent, GetStatusIconsEvent>(GetIcon);
SubscribeLocalEvent<Shared.Backmen.Blob.BlobCarrierComponent, GetStatusIconsEvent>(GetIcon);
//end-backmen: antag
}

/// <summary>
/// Will check if the local player has the same component as the one who called it and give the status icon.
/// Adds a Status Icon on an entity if the player is supposed to see it.
/// </summary>
/// <param name="antagStatusIcon">The status icon that your antag uses</param>
/// <param name="args">The GetStatusIcon event.</param>
protected virtual void GetStatusIcon(string antagStatusIcon, ref GetStatusIconsEvent args)
private void GetIcon<T>(EntityUid uid, T comp, ref GetStatusIconsEvent ev) where T: IAntagStatusIconComponent
{
var ent = _player.LocalPlayer?.ControlledEntity;
var ent = _player.LocalSession?.AttachedEntity;

var canEv = new CanDisplayStatusIconsEvent(ent);
RaiseLocalEvent(uid, ref canEv);

if (!canEv.Cancelled)
ev.StatusIcons.Add(_prototype.Index(comp.StatusIcon));
}


if (!HasComp<T>(ent) && !HasComp<GhostComponent>(ent))
/// <summary>
/// Adds the Rev Icon on an entity if the player is supposed to see it. This additional function is needed to deal
/// with a special case where if someone is a head rev we only want to display the headrev icon.
/// </summary>
private void GetRevIcon(EntityUid uid, RevolutionaryComponent comp, ref GetStatusIconsEvent ev)
{
if (HasComp<HeadRevolutionaryComponent>(uid))
return;

args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(antagStatusIcon));
GetIcon(uid, comp, ref ev);

}
}
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasAnalyzerBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected override void Open()

_window = new GasAnalyzerWindow();
_window.OnClose += OnClose;
_window.OpenCentered();
_window.OpenCenteredLeft();
}

protected override void ReceiveMessage(BoundUserInterfaceMessage message)
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Audio/ContentAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem
public const float AmbientMusicMultiplier = 3f;
public const float LobbyMultiplier = 3f;
public const float InterfaceMultiplier = 2f;
public const float TtsMultiplier = 3f; // Corvax-TTS
public const float TtsMultiplier = 5f; // Corvax-TTS
public const float TtsAnnounceMultiplier = 2f; // Corvax-TTS

public override void Initialize()
{
Expand Down
28 changes: 27 additions & 1 deletion Content.Client/Backmen/Blob/BlobObserverSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Content.Shared.Backmen.Blob;
using Content.Shared.Antag;
using Content.Shared.Backmen.Blob;
using Content.Shared.GameTicking;
using Content.Shared.Ghost;
using Content.Shared.StatusIcon.Components;
using Robust.Client.Graphics;
using Robust.Shared.Player;

Expand All @@ -15,9 +18,32 @@ public override void Initialize()

SubscribeLocalEvent<BlobObserverComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<BlobObserverComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

SubscribeLocalEvent<BlobCarrierComponent, CanDisplayStatusIconsEvent>(OnCanShowBlobIcon);
SubscribeLocalEvent<BlobObserverComponent, CanDisplayStatusIconsEvent>(OnCanShowBlobIcon);

SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup);
}

private void OnCanShowBlobIcon<T>(EntityUid uid, T comp, ref CanDisplayStatusIconsEvent args) where T : IAntagStatusIconComponent
{
args.Cancelled = !CanDisplayIcon(args.User, comp.IconVisibleToGhost);
}

/// <summary>
/// The criteria that determine whether a client should see Rev/Head rev icons.
/// </summary>
private bool CanDisplayIcon(EntityUid? uid, bool visibleToGhost)
{
if (HasComp<BlobCarrierComponent>(uid))
return true;

if (visibleToGhost && HasComp<GhostComponent>(uid))
return true;

return HasComp<BlobObserverComponent>(uid);
}

private void OnPlayerAttached(EntityUid uid, BlobObserverComponent component, LocalPlayerAttachedEvent args)
{
_lightManager.DrawLighting = false;
Expand Down
40 changes: 40 additions & 0 deletions Content.Client/Backmen/Flesh/FleshCultist.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Content.Shared.Antag;
using Content.Shared.Backmen.Flesh;
using Content.Shared.Ghost;
using Content.Shared.StatusIcon.Components;
using Content.Shared.Tag;

namespace Content.Client.Backmen.Flesh;

public sealed class FleshCultistSystem : EntitySystem
{
[Dependency] private readonly TagSystem _tag = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<FleshCultistComponent, CanDisplayStatusIconsEvent>(OnCanShowCultIcon);
}

private void OnCanShowCultIcon<T>(EntityUid uid, T comp, ref CanDisplayStatusIconsEvent args) where T : IAntagStatusIconComponent
{
args.Cancelled = !CanDisplayIcon(args.User, comp.IconVisibleToGhost);
}

[ValidatePrototypeId<TagPrototype>]
private const string TagFlesh = "Flesh";

/// <summary>
/// The criteria that determine whether a client should see Rev/Head rev icons.
/// </summary>
private bool CanDisplayIcon(EntityUid? uid, bool visibleToGhost)
{
if (HasComp<FleshCultistComponent>(uid))
return true;

if (visibleToGhost && HasComp<GhostComponent>(uid))
return true;

return uid.HasValue && _tag.HasTag(uid.Value, TagFlesh);
}
}
8 changes: 8 additions & 0 deletions Content.Client/Botany/Components/ProduceComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Botany.Components;

namespace Content.Client.Botany.Components;

[RegisterComponent]
public sealed partial class ProduceComponent : SharedProduceComponent
{
}
Loading

0 comments on commit 4da74cc

Please sign in to comment.