-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'EE-Master/master' into Update-10/20/2024
- Loading branch information
Showing
382 changed files
with
18,504 additions
and
5,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Content.Client/Administration/UI/DepartmentWhitelistPanel.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
49
Content.Client/Administration/UI/DepartmentWhitelistPanel.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
46
Content.Client/Administration/UI/JobWhitelistsWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.