Clothing/item ECS & cleanup (#9706)

This commit is contained in:
Kara
2022-07-27 03:53:47 -07:00
committed by GitHub
parent 0f0420eca9
commit 258ec0cac1
164 changed files with 938 additions and 918 deletions

View File

@@ -1,5 +1,6 @@
using Content.Server.Clothing.Components;
using Content.Server.Light.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Light.Component;
@@ -14,6 +15,9 @@ namespace Content.Server.Light.EntitySystems
[UsedImplicitly]
public sealed class ExpendableLightSystem : EntitySystem
{
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly ClothingSystem _clothing = default!;
public override void Initialize()
{
base.Initialize();
@@ -59,9 +63,9 @@ namespace Content.Server.Light.EntitySystems
UpdateSpriteAndSounds(component);
UpdateVisualizer(component);
if (TryComp<SharedItemComponent>(component.Owner, out var item))
if (TryComp<ItemComponent>(component.Owner, out var item))
{
item.EquippedPrefix = "unlit";
_item.SetHeldPrefix(component.Owner, "unlit", item);
}
break;
@@ -76,9 +80,9 @@ namespace Content.Server.Light.EntitySystems
{
if (!component.Activated && component.CurrentState == ExpendableLightState.BrandNew)
{
if (TryComp<SharedItemComponent>(component.Owner, out var item))
if (TryComp<ItemComponent>(component.Owner, out var item))
{
item.EquippedPrefix = "lit";
_item.SetHeldPrefix(component.Owner, "lit", item);
}
component.CurrentState = ExpendableLightState.Lit;
@@ -154,15 +158,15 @@ namespace Content.Server.Light.EntitySystems
if (TryComp<ClothingComponent>(component.Owner, out var clothing))
{
clothing.EquippedPrefix = component.Activated ? "Activated" : string.Empty;
_clothing.SetEquippedPrefix(component.Owner, component.Activated ? "Activated" : string.Empty, clothing);
}
}
private void OnExpLightInit(EntityUid uid, ExpendableLightComponent component, ComponentInit args)
{
if (TryComp<SharedItemComponent?>(uid, out var item))
if (TryComp<ItemComponent?>(uid, out var item))
{
item.EquippedPrefix = "unlit";
_item.SetHeldPrefix(uid, "unlit", item);
}
component.CurrentState = ExpendableLightState.BrandNew;