You can now see paper on crates (with color!) (#26834)

* Implement changes on not-cooked branch

* Made it work

* Fix update appearance calls

* Fix extra indents, clean-up code, fix tests hopefully

* Fix hammy cagecrate

* Fix messing up the yml, add artifact crate specific labels back in

* Visual Studio hates yml, sad

* Seperate the colors for cargonia

* sorry json

* make label move with artifact door

* Apply suggestion changes

Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>

* Fix remaining crate offsets, add a few for livestock and graves (why are you labeling graves) and coffin label sprites (why are you labeling coffins??)

---------

Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
Verm
2024-04-13 22:39:02 -05:00
committed by GitHub
parent cb4561fe96
commit 96ad9002f1
33 changed files with 275 additions and 61 deletions

View File

@@ -84,10 +84,7 @@ namespace Content.Server.Labels
{
_itemSlotsSystem.AddItemSlot(uid, ContainerName, component.LabelSlot);
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return;
_appearance.SetData(uid, PaperLabelVisuals.HasLabel, false, appearance);
UpdateAppearance((uid, component));
}
private void OnComponentRemove(EntityUid uid, PaperLabelComponent component, ComponentRemove args)
@@ -131,10 +128,18 @@ namespace Content.Server.Labels
if (args.Container.ID != label.LabelSlot.ID)
return;
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
UpdateAppearance((uid, label));
}
private void UpdateAppearance(Entity<PaperLabelComponent, AppearanceComponent?> ent)
{
if (!Resolve(ent, ref ent.Comp2, false))
return;
_appearance.SetData(uid, PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem, appearance);
var slot = ent.Comp1.LabelSlot;
_appearance.SetData(ent, PaperLabelVisuals.HasLabel, slot.HasItem, ent.Comp2);
if (TryComp<PaperLabelTypeComponent>(slot.Item, out var type))
_appearance.SetData(ent, PaperLabelVisuals.LabelType, type.PaperType, ent.Comp2);
}
}
}