-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Description Ports MODsuits from Goobstation PR Goob-Station/Goob-Station#1242. The PR author has confirmed that he is okay with me doing this. --- # TODO - [X] Port in sprites - [x] Port in YMLs - [X] Port code - [x] Port code PATCHES - [x] Update EE with required fixes --- <details><summary><h1>Media</h1></summary> <p> ## Modsuit crafting https://github.com/user-attachments/assets/8ff03d3a-0fc1-4818-b710-bfc43f0e2a68 ## Modsuit sealing https://github.com/user-attachments/assets/6671459a-7767-499b-8678-062fc1db7134 </p> </details> --- # Changelog :cl: - add: Modsuits have been ported from Goobstation! --------- Signed-off-by: Eris <[email protected]> Co-authored-by: DEATHB4DEFEAT <[email protected]> Co-authored-by: VMSolidus <[email protected]>
- Loading branch information
1 parent
f81925a
commit cb06c41
Showing
120 changed files
with
2,704 additions
and
184 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
11 changes: 11 additions & 0 deletions
11
Content.Client/_Goobstation/Clothing/Components/SealableClothingVisualsComponent.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,11 @@ | ||
namespace Content.Client._Goobstation.Clothing.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class SealableClothingVisualsComponent : Component | ||
{ | ||
[DataField] | ||
public string SpriteLayer = "sealed"; | ||
|
||
[DataField] | ||
public Dictionary<string, List<PrototypeLayerData>> VisualLayers = new(); | ||
} |
7 changes: 7 additions & 0 deletions
7
Content.Client/_Goobstation/Clothing/EntitySystems/PoweredSealableClothingSystem.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,7 @@ | ||
using Content.Shared._Goobstation.Clothing.Systems; | ||
|
||
namespace Content.Client._Goobstation.Clothing.EntitySystems; | ||
|
||
public sealed class PoweredSealableClothingSystem : SharedPoweredSealableClothingSystem | ||
{ | ||
} |
7 changes: 7 additions & 0 deletions
7
Content.Client/_Goobstation/Clothing/EntitySystems/SealableClothingSystem.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,7 @@ | ||
using Content.Shared._Goobstation.Clothing.Systems; | ||
|
||
namespace Content.Client._Goobstation.Clothing.EntitySystems; | ||
|
||
public sealed partial class SealableClothingSystem : SharedSealableClothingSystem | ||
{ | ||
} |
57 changes: 57 additions & 0 deletions
57
Content.Client/_Goobstation/Clothing/EntitySystems/SealableClothingVisualizerSystem.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,57 @@ | ||
using Content.Client._Goobstation.Clothing.Components; | ||
using Content.Client.Clothing; | ||
using Content.Shared._Goobstation.Clothing; | ||
using Content.Shared.Clothing; | ||
using Content.Shared.Item; | ||
using Robust.Client.GameObjects; | ||
using System.Linq; | ||
|
||
namespace Content.Client._Goobstation.Clothing.EntitySystems; | ||
|
||
public sealed class SealableClothingVisualizerSystem : VisualizerSystem<SealableClothingVisualsComponent> | ||
{ | ||
[Dependency] private readonly SharedItemSystem _itemSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<SealableClothingVisualsComponent, GetEquipmentVisualsEvent>(OnGetEquipmentVisuals, after: new[] { typeof(ClientClothingSystem) }); | ||
} | ||
|
||
protected override void OnAppearanceChange(EntityUid uid, SealableClothingVisualsComponent component, ref AppearanceChangeEvent args) | ||
{ | ||
if (!AppearanceSystem.TryGetData<bool>(uid, SealableClothingVisuals.Sealed, out var isSealed, args.Component)) | ||
return; | ||
|
||
if (args.Sprite != null && component.SpriteLayer != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer)) | ||
args.Sprite.LayerSetVisible(layer, isSealed); | ||
|
||
_itemSystem.VisualsChanged(uid); | ||
} | ||
|
||
private void OnGetEquipmentVisuals(Entity<SealableClothingVisualsComponent> sealable, ref GetEquipmentVisualsEvent args) | ||
{ | ||
var (uid, comp) = sealable; | ||
|
||
if (!TryComp(uid, out AppearanceComponent? appearance) | ||
|| !AppearanceSystem.TryGetData<bool>(uid, SealableClothingVisuals.Sealed, out var isSealed, appearance) | ||
|| !isSealed) | ||
return; | ||
|
||
if (!comp.VisualLayers.TryGetValue(args.Slot, out var layers)) | ||
return; | ||
|
||
var i = 0; | ||
foreach (var layer in layers) | ||
{ | ||
var key = layer.MapKeys?.FirstOrDefault(); | ||
if (key == null) | ||
{ | ||
key = i == 0 ? $"{args.Slot}-sealed" : $"{args.Slot}-sealed-{i}"; | ||
i++; | ||
} | ||
|
||
args.Layers.Add((key, layer)); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Content.Client/_Goobstation/Clothing/ToggleableClothingBoundUserInterface.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,39 @@ | ||
using Content.Shared.Clothing.Components; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Input; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client._Goobstation.Clothing; | ||
|
||
public sealed class ToggleableClothingBoundUserInterface : BoundUserInterface | ||
{ | ||
[Dependency] private readonly IClyde _displayManager = default!; | ||
[Dependency] private readonly IInputManager _inputManager = default!; | ||
|
||
private IEntityManager _entityManager; | ||
private ToggleableClothingRadialMenu? _menu; | ||
|
||
public ToggleableClothingBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
_entityManager = IoCManager.Resolve<IEntityManager>(); | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = this.CreateWindow<ToggleableClothingRadialMenu>(); | ||
_menu.SetEntity(Owner); | ||
_menu.SendToggleClothingMessageAction += SendToggleableClothingMessage; | ||
|
||
var vpSize = _displayManager.ScreenSize; | ||
_menu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / vpSize); | ||
} | ||
|
||
private void SendToggleableClothingMessage(EntityUid uid) | ||
{ | ||
var message = new ToggleableClothingUiMessage(_entityManager.GetNetEntity(uid)); | ||
SendPredictedMessage(message); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Content.Client/_Goobstation/Clothing/ToggleableClothingRadialMenu.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,6 @@ | ||
<ui:RadialMenu xmlns="https://spacestation14.io" | ||
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls" | ||
BackButtonStyleClass="RadialMenuBackButton" CloseButtonStyleClass="RadialMenuCloseButton" | ||
VerticalExpand="True" HorizontalExpand="True" MinSize="450 450"> | ||
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" Radius="64" ReserveSpaceForHiddenChildren="False" /> | ||
</ui:RadialMenu> |
96 changes: 96 additions & 0 deletions
96
Content.Client/_Goobstation/Clothing/ToggleableClothingRadialMenu.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,96 @@ | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.Clothing.Components; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Prototypes; | ||
using System.Numerics; | ||
|
||
namespace Content.Client._Goobstation.Clothing; | ||
|
||
public sealed partial class ToggleableClothingRadialMenu : RadialMenu | ||
{ | ||
[Dependency] private readonly EntityManager _entityManager = default!; | ||
|
||
public event Action<EntityUid>? SendToggleClothingMessageAction; | ||
|
||
public EntityUid Entity { get; set; } | ||
|
||
public ToggleableClothingRadialMenu() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void SetEntity(EntityUid uid) | ||
{ | ||
Entity = uid; | ||
RefreshUI(); | ||
} | ||
|
||
public void RefreshUI() | ||
{ | ||
// Even EmotesMenu has to call this, I'm assuming it's essential. | ||
var main = FindControl<RadialContainer>("Main"); | ||
|
||
if (!_entityManager.TryGetComponent<ToggleableClothingComponent>(Entity, out var clothing) | ||
|| clothing.Container is not { } clothingContainer) | ||
return; | ||
|
||
foreach (var attached in clothing.ClothingUids) | ||
{ | ||
// Change tooltip text if attached clothing is toggle/untoggled | ||
var tooltipText = Loc.GetString(clothing.UnattachTooltip); | ||
|
||
if (clothingContainer.Contains(attached.Key)) | ||
tooltipText = Loc.GetString(clothing.AttachTooltip); | ||
|
||
var button = new ToggleableClothingRadialMenuButton() | ||
{ | ||
StyleClasses = { "RadialMenuButton" }, | ||
SetSize = new Vector2(64, 64), | ||
ToolTip = tooltipText, | ||
AttachedClothingId = attached.Key | ||
}; | ||
|
||
var spriteView = new SpriteView() | ||
{ | ||
SetSize = new Vector2(48, 48), | ||
VerticalAlignment = VAlignment.Center, | ||
HorizontalAlignment = HAlignment.Center, | ||
Stretch = SpriteView.StretchMode.Fill | ||
}; | ||
|
||
spriteView.SetEntity(attached.Key); | ||
|
||
button.AddChild(spriteView); | ||
main.AddChild(button); | ||
} | ||
|
||
AddToggleableClothingMenuButtonOnClickAction(main); | ||
} | ||
|
||
private void AddToggleableClothingMenuButtonOnClickAction(Control control) | ||
{ | ||
if (control is not RadialContainer mainControl) | ||
return; | ||
|
||
foreach (var child in mainControl.Children) | ||
{ | ||
if (child is not ToggleableClothingRadialMenuButton castChild) | ||
continue; | ||
|
||
castChild.OnButtonDown += _ => | ||
{ | ||
SendToggleClothingMessageAction?.Invoke(castChild.AttachedClothingId); | ||
mainControl.DisposeAllChildren(); | ||
RefreshUI(); | ||
}; | ||
} | ||
} | ||
} | ||
|
||
public sealed class ToggleableClothingRadialMenuButton : RadialMenuTextureButton | ||
{ | ||
public EntityUid AttachedClothingId { get; set; } | ||
} |
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.