Fix item/clothing visual & networking bugs (#10116)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Item;
|
||||
@@ -8,11 +9,13 @@ namespace Content.Shared.Item;
|
||||
/// like backpacks.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[Access(typeof(SharedItemSystem))]
|
||||
public sealed class ItemComponent : Component
|
||||
{
|
||||
[Access(typeof(SharedItemSystem), Other = AccessPermissions.ReadExecute)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("size")]
|
||||
[Access(typeof(SharedItemSystem), Other = AccessPermissions.ReadExecute)]
|
||||
public int Size = 5;
|
||||
|
||||
[DataField("inhandVisuals")]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -38,7 +38,10 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
|
||||
public void SetHeldPrefix(EntityUid uid, string? heldPrefix, ItemComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return;
|
||||
|
||||
if (component.HeldPrefix == heldPrefix)
|
||||
return;
|
||||
|
||||
component.HeldPrefix = heldPrefix;
|
||||
@@ -62,7 +65,7 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.Size = state.Size;
|
||||
component.HeldPrefix = state.HeldPrefix;
|
||||
SetHeldPrefix(uid, state.HeldPrefix, component);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, ItemComponent component, ref ComponentGetState args)
|
||||
|
||||
Reference in New Issue
Block a user