Skip to content

Commit

Permalink
Merge pull request #86 from SS14-Classic/Update-10/20/2024
Browse files Browse the repository at this point in the history
Update-10/20/2024
  • Loading branch information
VMSolidus authored Oct 20, 2024
2 parents 5a7341b + 19860ff commit fe30609
Show file tree
Hide file tree
Showing 382 changed files with 18,504 additions and 5,192 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
- any-glob-to-any-file:
- "**/*.yml"
- all-globs-to-all-files:
- "!Resources/Maps/**/*.yml",
- "!Resources/Maps/**/*.yml"
- "!Resources/Prototypes/Maps/**/*.yml"

"Changes: Workflow":
Expand Down
42 changes: 10 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,17 @@ jobs:
- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py

- name: Shuffle files around
run: |
mkdir "release/${{ github.sha }}"
mv release/*.zip "release/${{ github.sha }}"
- name: Upload files to centcomm
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PUBLISH_HOST }}
username: ${{ secrets.PUBLISH_USER }}
key: ${{ secrets.PUBLISH_KEY }}
port: ${{ secrets.PUBLISH_PORT }}
source: "release/${{ github.sha }}"
target: "/var/www/builds.delta-v.org/delta-v/builds/"
strip_components: 1

- name: Update manifest JSON
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PUBLISH_HOST }}
username: ${{ secrets.PUBLISH_USER }}
key: ${{ secrets.PUBLISH_KEY }}
port: ${{ secrets.PUBLISH_PORT }}
script: /home/deltav/publish/push.ps1 ${{ github.sha }}

- name: Publish changelog (Discord)
run: Tools/actions_changelogs_since_last_run.py
- name: Publish version
run: Tools/publish_multi_request.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
GITHUB_REPOSITORY: ${{ vars.GITHUB_REPOSITORY }}

# - name: Publish changelog (Discord)
# run: Tools/actions_changelogs_since_last_run.py
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# DISCORD_WEBHOOK_URL: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }}

- name: Publish changelog (RSS)
run: Tools/actions_changelog_rss.py
Expand Down
11 changes: 11 additions & 0 deletions Content.Client/Administration/UI/DepartmentWhitelistPanel.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<PanelContainer
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI"
StyleClasses="BackgroundDark"
HorizontalExpand="True"
Margin="4">
<BoxContainer Orientation="Vertical">
<CheckBox Name="Department"/> <!-- Toggles all jobs in the department at once -->
<GridContainer Name="JobsContainer" Columns="4"/> <!-- Populated with each job to toggle individually-->
</BoxContainer>
</PanelContainer>
49 changes: 49 additions & 0 deletions Content.Client/Administration/UI/DepartmentWhitelistPanel.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;

namespace Content.Client.Administration.UI;

[GenerateTypedNameReferences]
public sealed partial class DepartmentWhitelistPanel : PanelContainer
{
public Action<ProtoId<JobPrototype>, bool>? OnSetJob;

public DepartmentWhitelistPanel(DepartmentPrototype department, IPrototypeManager proto, HashSet<ProtoId<JobPrototype>> whitelists)
{
RobustXamlLoader.Load(this);

var allWhitelisted = true;
var grey = Color.FromHex("#ccc");
foreach (var id in department.Roles)
{
var thisJob = id; // closure capturing funny
var button = new CheckBox();
button.Text = proto.Index<JobPrototype>(id).LocalizedName;
if (!proto.Index<JobPrototype>(id).Whitelisted)
button.Modulate = grey; // Let admins know whitelisting this job is only for futureproofing.
button.Pressed = whitelists.Contains(id);
button.OnPressed += _ => OnSetJob?.Invoke(thisJob, button.Pressed);
JobsContainer.AddChild(button);

allWhitelisted &= button.Pressed;
}

Department.Text = Loc.GetString(department.ID);
Department.Modulate = department.Color;
Department.Pressed = allWhitelisted;
Department.OnPressed += args =>
{
foreach (var id in department.Roles)
{
// only request to whitelist roles that aren't already whitelisted, and vice versa
if (whitelists.Contains(id) != Department.Pressed)
OnSetJob?.Invoke(id, Department.Pressed);
}
};
}
}
40 changes: 40 additions & 0 deletions Content.Client/Administration/UI/JobWhitelistsEui.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Content.Client.Eui;
using Content.Shared.Administration;
using Content.Shared.Eui;

namespace Content.Client.Administration.UI;

public sealed class JobWhitelistsEui : BaseEui
{
private JobWhitelistsWindow Window;

public JobWhitelistsEui()
{
Window = new JobWhitelistsWindow();
Window.OnClose += () => SendMessage(new CloseEuiMessage());
Window.OnSetJob += (id, whitelisted) => SendMessage(new SetJobWhitelistedMessage(id, whitelisted));
}

public override void HandleState(EuiStateBase state)
{
if (state is not JobWhitelistsEuiState cast)
return;

Window.HandleState(cast);
}

public override void Opened()
{
base.Opened();

Window.OpenCentered();
}

public override void Closed()
{
base.Closed();

Window.Close();
Window.Dispose();
}
}
11 changes: 11 additions & 0 deletions Content.Client/Administration/UI/JobWhitelistsWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<controls:FancyWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc player-panel-job-whitelists}" MinSize="750 600">
<BoxContainer Orientation="Vertical">
<Label Name="PlayerName" Margin="4"/>
<ScrollContainer VerticalExpand="True">
<BoxContainer Name="Departments" Orientation="Vertical"/> <!-- Populated with DepartmentWhitelistPanel -->
</ScrollContainer>
</BoxContainer>
</controls:FancyWindow>
46 changes: 46 additions & 0 deletions Content.Client/Administration/UI/JobWhitelistsWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Database;
using Content.Shared.Administration;
using Content.Shared.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;

namespace Content.Client.Administration.UI;

/// <summary>
/// An admin panel to toggle whitelists for individual jobs or entire departments.
/// This should generally be preferred to a blanket whitelist (Whitelisted: True) since
/// being good with a batong doesn't mean you know engineering and vice versa.
/// </summary>
[GenerateTypedNameReferences]
public sealed partial class JobWhitelistsWindow : FancyWindow
{
[Dependency] private readonly IPrototypeManager _proto = default!;

public Action<ProtoId<JobPrototype>, bool>? OnSetJob;

public JobWhitelistsWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

PlayerName.Text = "???";
}

public void HandleState(JobWhitelistsEuiState state)
{
PlayerName.Text = state.PlayerName;

Departments.RemoveAllChildren();
foreach (var proto in _proto.EnumeratePrototypes<DepartmentPrototype>())
{
var panel = new DepartmentWhitelistPanel(proto, _proto, state.Whitelists);
panel.OnSetJob += (id, whitelisting) => OnSetJob?.Invoke(id, whitelisting);
Departments.AddChild(panel);
}
}
}
33 changes: 33 additions & 0 deletions Content.Client/Cocoon/CocoonSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Content.Shared.Cocoon;
using Content.Shared.Humanoid;
using Robust.Client.GameObjects;
using Robust.Shared.Containers;
using System.Numerics;

namespace Content.Client.Cocoon
{
public sealed class CocoonSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CocoonComponent, EntInsertedIntoContainerMessage>(OnCocEntInserted);
}

private void OnCocEntInserted(EntityUid uid, CocoonComponent component, EntInsertedIntoContainerMessage args)
{
if (!TryComp<SpriteComponent>(uid, out var cocoonSprite))
return;

if (TryComp<HumanoidAppearanceComponent>(args.Entity, out var humanoidAppearance)) // If humanoid, use height and width
cocoonSprite.Scale = new Vector2(humanoidAppearance.Width, humanoidAppearance.Height);
else if (!TryComp<SpriteComponent>(args.Entity, out var entSprite))
return;
else if (entSprite.BaseRSI != null) // Set scale based on sprite scale + sprite dimensions. Ideally we would somehow get a bounding box from the sprite size not including transparent pixels, but FUCK figuring that out.
cocoonSprite.Scale = entSprite.Scale * (entSprite.BaseRSI.Size / 32);
else if (entSprite.Scale != cocoonSprite.Scale) // if basersi somehow not found (?) just use scale
cocoonSprite.Scale = entSprite.Scale;
}
}
}
2 changes: 1 addition & 1 deletion Content.Client/FlavorText/FlavorText.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public FlavorText()

var loc = IoCManager.Resolve<ILocalizationManager>();
CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
CFlavorTextInput.OnKeyBindDown += _ => FlavorTextChanged();
CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged();
}

public void FlavorTextChanged()
Expand Down
19 changes: 18 additions & 1 deletion Content.Client/LateJoin/LateJoinGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,24 @@ private void RebuildUI()

jobButton.OnPressed += _ => SelectedId.Invoke((id, jobButton.JobId));

if (!_characterRequirements.CheckRequirementsValid(
if (!_jobRequirements.CheckJobWhitelist(prototype, out var reason))
{
jobButton.Disabled = true;

var tooltip = new Tooltip();
tooltip.SetMessage(reason);
jobButton.TooltipSupplier = _ => tooltip;

jobSelector.AddChild(new TextureRect
{
TextureScale = new Vector2(0.4f, 0.4f),
Stretch = TextureRect.StretchMode.KeepCentered,
Texture = _sprites.Frame0(new SpriteSpecifier.Texture(new ("/Textures/Interface/Nano/lock.svg.192dpi.png"))),
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Right,
});
}
else if (!_characterRequirements.CheckRequirementsValid(
prototype.Requirements ?? new(),
prototype,
(HumanoidCharacterProfile) (_prefs.Preferences?.SelectedCharacter
Expand Down
14 changes: 8 additions & 6 deletions Content.Client/Lobby/LobbyUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ public override void Initialize()
_requirements.Updated += OnRequirementsUpdated;

_configurationManager.OnValueChanged(CCVars.FlavorText, _ => _profileEditor?.RefreshFlavorText());
_configurationManager.OnValueChanged(CCVars.GameRoleTimers,
_ =>
{
_profileEditor?.RefreshAntags();
_profileEditor?.RefreshJobs();
});
_configurationManager.OnValueChanged(CCVars.GameRoleTimers, _ => RefreshProfileEditor());
_configurationManager.OnValueChanged(CCVars.GameRoleWhitelist, _ => RefreshProfileEditor());

_preferencesManager.OnServerDataLoaded += PreferencesDataLoaded;
}
Expand Down Expand Up @@ -168,6 +164,12 @@ private void RefreshLobbyPreview()
PreviewPanel.SetSummaryText(humanoid.Summary);
}

private void RefreshProfileEditor()
{
_profileEditor?.RefreshAntags();
_profileEditor?.RefreshJobs();
}

private void SaveProfile()
{
DebugTools.Assert(EditedProfile != null);
Expand Down
Loading

0 comments on commit fe30609

Please sign in to comment.