Actions Rework (#6791)

* Rejig Actions

* fix merge errors

* lambda-b-gon

* fix PAI, add innate actions

* Revert "fix PAI, add innate actions"

This reverts commit 4b501ac083e979e31ebd98d7b98077e0dbdd344b.

* Just fix by making nullable.

if only require: true actually did something somehow.

* Make AddActions() ensure an actions component

and misc comments

* misc cleanup

* Limit range even when not checking for obstructions

* remove old guardian code

* rename function and make EntityUid nullable

* fix magboot bug

* fix action search menu

* make targeting toggle all equivalent actions

* fix combat popups (enabling <-> disabling)
This commit is contained in:
Leon Friedrich
2022-02-25 17:12:29 +13:00
committed by GitHub
parent b99b1f4008
commit 5ac5dd6a64
135 changed files with 3122 additions and 5168 deletions

View File

@@ -5,9 +5,6 @@ using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
namespace Content.Client.Hands
{
@@ -16,11 +13,15 @@ namespace Content.Client.Hands
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IEntityManager _entMan = default!;
private readonly IRenderTexture _renderBackbuffer;
public override OverlaySpace Space => OverlaySpace.ScreenSpace;
public Texture? IconOverride;
public EntityUid? EntityOverride;
public ShowHandItemOverlay()
{
IoCManager.InjectDependencies(this);
@@ -43,15 +44,25 @@ namespace Content.Client.Hands
protected override void Draw(in OverlayDrawArgs args)
{
var sys = EntitySystem.Get<HandsSystem>();
var handEntity = sys.GetActiveHandEntity();
if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve<IEntityManager>().HasComponent<ISpriteComponent>(handEntity))
if (!_cfg.GetCVar(CCVars.HudHeldItemShow))
return;
var screen = args.ScreenHandle;
var halfSize = _renderBackbuffer.Size / 2;
var offset = _cfg.GetCVar(CCVars.HudHeldItemOffset);
var mousePos = _inputManager.MouseScreenPosition.Position;
if (IconOverride != null)
{
screen.DrawTexture(IconOverride, mousePos - IconOverride.Size / 2 + offset, Color.White.WithAlpha(0.75f));
return;
}
var handEntity = EntityOverride ?? EntitySystem.Get<HandsSystem>().GetActiveHandEntity();
if (handEntity == null || !_entMan.HasComponent<ISpriteComponent>(handEntity))
return;
var halfSize = _renderBackbuffer.Size / 2;
var uiScale = (args.ViewportControl as Control)?.UIScale ?? 1f;
screen.RenderInRenderTarget(_renderBackbuffer, () =>
@@ -59,11 +70,7 @@ namespace Content.Client.Hands
screen.DrawEntity(handEntity.Value, halfSize, new Vector2(1f, 1f) * uiScale, Direction.South);
}, Color.Transparent);
var offset = _cfg.GetCVar(CCVars.HudHeldItemOffset);
var mousePos = _inputManager.MouseScreenPosition.Position;
screen.DrawTexture(_renderBackbuffer.Texture, mousePos - halfSize + offset, Color.White.WithAlpha(0.75f));
// screen.DrawRect(UIBox2.FromDimensions((offset, offset) + mousePos, (32, 32)), Color.Red);
}
}
}