Make held entity nullable (#5923)

This commit is contained in:
wrexbe
2021-12-30 18:27:15 -08:00
committed by GitHub
parent 761dfb48af
commit abba1e1c2c
11 changed files with 68 additions and 86 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.CCVar;
using Content.Shared.CCVar;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
@@ -46,7 +46,7 @@ namespace Content.Client.Hands
var sys = EntitySystem.Get<HandsSystem>();
var handEntity = sys.GetActiveHandEntity();
if (handEntity == default || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve<IEntityManager>().HasComponent<ISpriteComponent>(handEntity))
if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve<IEntityManager>().HasComponent<ISpriteComponent>(handEntity))
return;
var screen = args.ScreenHandle;
@@ -56,7 +56,7 @@ namespace Content.Client.Hands
screen.RenderInRenderTarget(_renderBackbuffer, () =>
{
screen.DrawEntity(handEntity, halfSize, new Vector2(1f, 1f) * uiScale, Direction.South);
screen.DrawEntity(handEntity.Value, halfSize, new Vector2(1f, 1f) * uiScale, Direction.South);
}, Color.Transparent);
var offset = _cfg.GetCVar(CCVars.HudHeldItemOffset);