mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster
# Changelog
🆑 Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.
(cherry picked from commit 3c9db94102cb25b28a83d51ac8d659fa31fe7d12)
83 lines
2.7 KiB
C#
83 lines
2.7 KiB
C#
using Content.Client.Gameplay;
|
|
using Content.Client._Shitmed.UserInterface.Systems.PartStatus.Widgets;
|
|
using Content.Shared._Shitmed.Targeting;
|
|
using Content.Client._Shitmed.Targeting;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface.Controllers;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Utility;
|
|
using Robust.Client.Graphics;
|
|
|
|
|
|
namespace Content.Client._Shitmed.UserInterface.Systems.PartStatus;
|
|
|
|
public sealed class PartStatusUIController : UIController, IOnStateEntered<GameplayState>, IOnSystemChanged<TargetingSystem>
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
[Dependency] private readonly IEntityNetworkManager _net = default!;
|
|
private SpriteSystem _spriteSystem = default!;
|
|
private TargetingComponent? _targetingComponent;
|
|
private PartStatusControl? PartStatusControl => UIManager.GetActiveUIWidgetOrNull<PartStatusControl>();
|
|
|
|
public void OnSystemLoaded(TargetingSystem system)
|
|
{
|
|
system.PartStatusStartup += AddPartStatusControl;
|
|
system.PartStatusShutdown += RemovePartStatusControl;
|
|
system.PartStatusUpdate += UpdatePartStatusControl;
|
|
}
|
|
|
|
public void OnSystemUnloaded(TargetingSystem system)
|
|
{
|
|
system.PartStatusStartup -= AddPartStatusControl;
|
|
system.PartStatusShutdown -= RemovePartStatusControl;
|
|
system.PartStatusUpdate -= UpdatePartStatusControl;
|
|
}
|
|
|
|
public void OnStateEntered(GameplayState state)
|
|
{
|
|
if (PartStatusControl != null)
|
|
{
|
|
PartStatusControl.SetVisible(_targetingComponent != null);
|
|
|
|
if (_targetingComponent != null)
|
|
PartStatusControl.SetTextures(_targetingComponent.BodyStatus);
|
|
}
|
|
}
|
|
|
|
public void AddPartStatusControl(TargetingComponent component)
|
|
{
|
|
_targetingComponent = component;
|
|
|
|
if (PartStatusControl != null)
|
|
{
|
|
PartStatusControl.SetVisible(_targetingComponent != null);
|
|
|
|
if (_targetingComponent != null)
|
|
PartStatusControl.SetTextures(_targetingComponent.BodyStatus);
|
|
}
|
|
|
|
}
|
|
|
|
public void RemovePartStatusControl()
|
|
{
|
|
if (PartStatusControl != null)
|
|
PartStatusControl.SetVisible(false);
|
|
|
|
_targetingComponent = null;
|
|
}
|
|
|
|
public void UpdatePartStatusControl(TargetingComponent component)
|
|
{
|
|
if (PartStatusControl != null && _targetingComponent != null)
|
|
PartStatusControl.SetTextures(_targetingComponent.BodyStatus);
|
|
}
|
|
|
|
public Texture GetTexture(SpriteSpecifier specifier)
|
|
{
|
|
if (_spriteSystem == null)
|
|
_spriteSystem = _entManager.System<SpriteSystem>();
|
|
|
|
return _spriteSystem.Frame0(specifier);
|
|
}
|
|
}
|