Partial hand ECS (#5634)
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com> Co-authored-by: Paul <ritter.paul1@googlemail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Content.Client.Items.UI
|
||||
private readonly PanelContainer _panel;
|
||||
|
||||
[ViewVariables]
|
||||
private EntityUid _entity;
|
||||
private EntityUid? _entity;
|
||||
|
||||
public ItemStatusPanel(Texture texture, StyleBox.Margin cutout, StyleBox.Margin flat, Label.AlignMode textAlign)
|
||||
{
|
||||
@@ -130,19 +130,19 @@ namespace Content.Client.Items.UI
|
||||
UpdateItemName();
|
||||
}
|
||||
|
||||
public void Update(EntityUid entity)
|
||||
public void Update(EntityUid? entity)
|
||||
{
|
||||
if (entity == default)
|
||||
if (entity == null)
|
||||
{
|
||||
ClearOldStatus();
|
||||
_entity = default;
|
||||
_entity = null;
|
||||
_panel.Visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity != _entity)
|
||||
{
|
||||
_entity = entity;
|
||||
_entity = entity.Value;
|
||||
BuildNewEntityStatus();
|
||||
|
||||
UpdateItemName();
|
||||
@@ -153,7 +153,7 @@ namespace Content.Client.Items.UI
|
||||
|
||||
private void UpdateItemName()
|
||||
{
|
||||
if (_entity == default)
|
||||
if (_entity == null)
|
||||
return;
|
||||
|
||||
if (_entityManager.TryGetComponent(_entity, out HandVirtualItemComponent? virtualItem)
|
||||
@@ -163,7 +163,7 @@ namespace Content.Client.Items.UI
|
||||
}
|
||||
else
|
||||
{
|
||||
_itemNameLabel.Text = _entityManager.GetComponent<MetaDataComponent>(_entity).EntityName;
|
||||
_itemNameLabel.Text = _entityManager.GetComponent<MetaDataComponent>(_entity.Value).EntityName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Content.Client.Items.UI
|
||||
|
||||
ClearOldStatus();
|
||||
|
||||
foreach (var statusComponent in _entityManager.GetComponents<IItemStatus>(_entity))
|
||||
foreach (var statusComponent in _entityManager.GetComponents<IItemStatus>(_entity!.Value))
|
||||
{
|
||||
var control = statusComponent.MakeControl();
|
||||
_statusContents.AddChild(control);
|
||||
@@ -194,7 +194,7 @@ namespace Content.Client.Items.UI
|
||||
}
|
||||
|
||||
var collectMsg = new ItemStatusCollectMessage();
|
||||
_entityManager.EventBus.RaiseLocalEvent(_entity, collectMsg);
|
||||
_entityManager.EventBus.RaiseLocalEvent(_entity!.Value, collectMsg);
|
||||
|
||||
foreach (var control in collectMsg.Controls)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user