forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request space-wizards#571 from space-syndicate/upstream-sync
Upstream sync
- Loading branch information
Showing
108 changed files
with
2,287 additions
and
216,529 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Content.Client.Implants.UI; | ||
using Content.Client.Items; | ||
using Content.Shared.Implants; | ||
using Content.Shared.Implants.Components; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Client.Implants; | ||
|
||
public sealed class ImplanterSystem : SharedImplanterSystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<ImplanterComponent, ComponentHandleState>(OnHandleImplanterState); | ||
SubscribeLocalEvent<ImplanterComponent, ItemStatusCollectMessage>(OnItemImplanterStatus); | ||
} | ||
|
||
private void OnHandleImplanterState(EntityUid uid, ImplanterComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not ImplanterComponentState state) | ||
return; | ||
|
||
component.CurrentMode = state.CurrentMode; | ||
component.ImplantOnly = state.ImplantOnly; | ||
component.UiUpdateNeeded = true; | ||
} | ||
|
||
private void OnItemImplanterStatus(EntityUid uid, ImplanterComponent component, ItemStatusCollectMessage args) | ||
{ | ||
args.Controls.Add(new ImplanterStatusControl(component)); | ||
} | ||
} |
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,53 @@ | ||
using Content.Client.Message; | ||
using Content.Client.Stylesheets; | ||
using Content.Shared.Implants.Components; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Client.Implants.UI; | ||
|
||
public sealed class ImplanterStatusControl : Control | ||
{ | ||
private readonly ImplanterComponent _parent; | ||
private readonly RichTextLabel _label; | ||
|
||
public ImplanterStatusControl(ImplanterComponent parent) | ||
{ | ||
_parent = parent; | ||
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } }; | ||
AddChild(_label); | ||
|
||
Update(); | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
if (!_parent.UiUpdateNeeded) | ||
return; | ||
|
||
Update(); | ||
} | ||
|
||
private void Update() | ||
{ | ||
_parent.UiUpdateNeeded = false; | ||
|
||
var modeStringLocalized = _parent.CurrentMode switch | ||
{ | ||
ImplanterToggleMode.Draw => Loc.GetString("implanter-draw-text"), | ||
ImplanterToggleMode.Inject => Loc.GetString("implanter-inject-text"), | ||
_ => Loc.GetString("injector-invalid-injector-toggle-mode") | ||
}; | ||
|
||
var entitiesStringLocalized = _parent.ImplanterSlot.HasItem switch | ||
{ | ||
false => Loc.GetString("implanter-empty-text"), | ||
true => Loc.GetString("implanter-implant-text", ("implantName", _parent.ImplantData.Item1), ("implantDescription", _parent.ImplantData.Item2), ("lineBreak", "\n")), | ||
}; | ||
|
||
|
||
_label.SetMarkup(Loc.GetString("implanter-label", ("currentEntities", entitiesStringLocalized), ("modeString", modeStringLocalized), ("lineBreak", "\n"))); | ||
} | ||
} |
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
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.