Skip to content

Commit

Permalink
Merge branch 'master' into Sort-departments
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian16199 authored Mar 5, 2024
2 parents 1d8429a + f96b6a5 commit 54ba5c9
Show file tree
Hide file tree
Showing 1,378 changed files with 158,086 additions and 60,833 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-map-renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
strategy:
matrix:
os: [ubuntu-latest]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
strategy:
matrix:
os: [ubuntu-latest]
Expand Down
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 .github/workflows/conflict-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
Label:
if: github.actor != 'PJBot'
if: github.actor != 'PJBot' && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- name: Check for Merge Conflicts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
labeler:
if: github.actor != 'PJBot'
if: github.actor != 'PJBot' && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
jobs:
build:
name: Test Packaging
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-rgas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
yaml-schema-validation:
name: YAML RGA schema validator
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate_mapfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
yaml-schema-validation:
name: YAML map schema validator
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build:
name: YAML Linter
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand Down
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));
};
}
}
42 changes: 32 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,44 @@ 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);
}

/// <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);

}
}
8 changes: 8 additions & 0 deletions Content.Client/Atmos/EntitySystems/FirestarterSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Atmos.EntitySystems;

namespace Content.Client.Atmos.EntitySystems;

public sealed class FirestarterSystem : SharedFirestarterSystem
{

}
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
Loading

0 comments on commit 54ba5c9

Please sign in to comment.