Remove server and shared sprite component (#15917)

This commit is contained in:
Leon Friedrich
2023-04-30 18:09:52 +12:00
committed by GitHub
parent 8f7a217413
commit f99533a7bf
12 changed files with 29 additions and 36 deletions

View File

@@ -3,7 +3,7 @@ using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;
using System.Linq;
using static Robust.Shared.GameObjects.SharedSpriteComponent;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
namespace Content.Client.AirlockPainter
{
@@ -28,7 +28,7 @@ namespace Content.Client.AirlockPainter
continue;
}
RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(TextureRoot / new ResPath(iconPath));
RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / new ResPath(iconPath));
if (!doorRsi.RSI.TryGetState("closed", out var icon))
{
Entries.Add(new AirlockPainterEntry(style, null));

View File

@@ -5,6 +5,7 @@ using Content.Shared.Atmos.Piping;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
namespace Content.Client.Atmos.EntitySystems;
@@ -27,7 +28,7 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
if (!TryComp(uid, out SpriteComponent? sprite))
return;
if (!_resCache.TryGetResource(SharedSpriteComponent.TextureRoot / component.RsiPath, out RSIResource? rsi))
if (!_resCache.TryGetResource(SpriteSpecifierSerializer.TextureRoot / component.RsiPath, out RSIResource? rsi))
{
Logger.Error($"{nameof(AtmosPipeAppearanceSystem)} could not load to load RSI {component.RsiPath}.");
return;

View File

@@ -11,8 +11,8 @@ using Content.Shared.Item;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using static Robust.Client.GameObjects.SpriteComponent;
using static Robust.Shared.GameObjects.SharedSpriteComponent;
namespace Content.Client.Clothing;
@@ -131,7 +131,7 @@ public sealed class ClientClothingSystem : ClothingSystem
RSI? rsi = null;
if (clothing.RsiPath != null)
rsi = _cache.GetResource<RSIResource>(TextureRoot / clothing.RsiPath).RSI;
rsi = _cache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / clothing.RsiPath).RSI;
else if (TryComp(uid, out SpriteComponent? sprite))
rsi = sprite.BaseRSI;

View File

@@ -4,8 +4,8 @@ using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Robust.Shared.Timing;
namespace Content.Client.Doors;
@@ -80,7 +80,7 @@ public sealed class DoorSystem : SharedDoorSystem
if (AppearanceSystem.TryGetData<string>(uid, DoorVisuals.BaseRSI, out var baseRsi, args.Component))
{
if (!_resourceCache.TryGetResource<RSIResource>(SharedSpriteComponent.TextureRoot / baseRsi, out var res))
if (!_resourceCache.TryGetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / baseRsi, out var res))
{
Logger.Error("Unable to load RSI '{0}'. Trace:\n{1}", baseRsi, Environment.StackTrace);
}

View File

@@ -1,12 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Shared.Hands;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Containers;
using static Robust.Shared.GameObjects.SharedSpriteComponent;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
namespace Content.Client.Items.Systems;
@@ -19,6 +19,20 @@ public sealed class ItemSystem : SharedItemSystem
base.Initialize();
SubscribeLocalEvent<ItemComponent, GetInhandVisualsEvent>(OnGetVisuals);
// TODO is this still needed? Shouldn't containers occlude them?
SubscribeLocalEvent<SpriteComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<SpriteComponent, GotUnequippedEvent>(OnUnequipped);
}
private void OnUnequipped(EntityUid uid, SpriteComponent component, GotUnequippedEvent args)
{
component.Visible = true;
}
private void OnEquipped(EntityUid uid, SpriteComponent component, GotEquippedEvent args)
{
component.Visible = false;
}
#region InhandVisuals
@@ -75,7 +89,7 @@ public sealed class ItemSystem : SharedItemSystem
RSI? rsi = null;
if (item.RsiPath != null)
rsi = _resCache.GetResource<RSIResource>(TextureRoot / item.RsiPath).RSI;
rsi = _resCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / item.RsiPath).RSI;
else if (TryComp(uid, out SpriteComponent? sprite))
rsi = sprite.BaseRSI;

View File

@@ -1,5 +1,4 @@
using Content.Shared.Hands.Components;
using static Robust.Shared.GameObjects.SharedSpriteComponent;
namespace Content.Client.Toggleable;

View File

@@ -73,7 +73,7 @@ namespace Content.MapRenderer.Painters
foreach (var entity in _sEntityManager.GetEntities())
{
if (!_sEntityManager.HasComponent<SharedSpriteComponent>(entity))
if (!_sEntityManager.HasComponent<SpriteComponent>(entity))
{
continue;
}

View File

@@ -1,4 +1,3 @@
using static Robust.Shared.GameObjects.SharedSpriteComponent;
namespace Content.Shared.Clothing;

View File

@@ -16,7 +16,7 @@ public sealed class ClothingComponent : Component
{
[DataField("clothingVisuals")]
[Access(typeof(ClothingSystem), typeof(InventorySystem), Other = AccessPermissions.ReadExecute)] // TODO remove execute permissions.
public Dictionary<string, List<SharedSpriteComponent.PrototypeLayerData>> ClothingVisuals = new();
public Dictionary<string, List<PrototypeLayerData>> ClothingVisuals = new();
[ViewVariables(VVAccess.ReadWrite)]
[DataField("quickEquip")]

View File

@@ -2,8 +2,6 @@ using Content.Shared.Hands.Components;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
using static Robust.Shared.GameObjects.SharedSpriteComponent;
namespace Content.Shared.Hands
{

View File

@@ -20,7 +20,7 @@ public sealed class ItemComponent : Component
[Access(typeof(SharedItemSystem))]
[DataField("inhandVisuals")]
public Dictionary<HandLocation, List<SharedSpriteComponent.PrototypeLayerData>> InhandVisuals = new();
public Dictionary<HandLocation, List<PrototypeLayerData>> InhandVisuals = new();
[Access(typeof(SharedItemSystem))]
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -19,9 +19,6 @@ public abstract class SharedItemSystem : EntitySystem
{
base.Initialize();
SubscribeLocalEvent<ItemComponent, GetVerbsEvent<InteractionVerb>>(AddPickupVerb);
SubscribeLocalEvent<SharedSpriteComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<SharedSpriteComponent, GotUnequippedEvent>(OnUnequipped);
SubscribeLocalEvent<ItemComponent, InteractHandEvent>(OnHandInteract);
SubscribeLocalEvent<ItemComponent, ComponentGetState>(OnGetState);
@@ -92,21 +89,6 @@ public abstract class SharedItemSystem : EntitySystem
args.State = new ItemComponentState(component.Size, component.HeldPrefix);
}
// Although netsync is being set to false for items client can still update these
// Realistically:
// Container should already hide these
// Client is the only thing that matters.
private void OnUnequipped(EntityUid uid, SharedSpriteComponent component, GotUnequippedEvent args)
{
component.Visible = true;
}
private void OnEquipped(EntityUid uid, SharedSpriteComponent component, GotEquippedEvent args)
{
component.Visible = false;
}
private void AddPickupVerb(EntityUid uid, ItemComponent component, GetVerbsEvent<InteractionVerb> args)
{
if (args.Hands == null ||