Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Felinids Fixes #556

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Content.Server/Labels/Label/HandLabelerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Labels;
using Content.Shared.Tag;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
Expand All @@ -22,7 +23,10 @@ public sealed class HandLabelerSystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly LabelSystem _labelSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;

[ValidatePrototypeId<TagPrototype>]
private const string PreventTag = "PreventLabel";
public override void Initialize()
{
base.Initialize();
Expand All @@ -35,7 +39,8 @@ public override void Initialize()

private void OnUtilityVerb(EntityUid uid, HandLabelerComponent handLabeler, GetVerbsEvent<UtilityVerb> args)
{
if (args.Target is not { Valid: true } target || !handLabeler.Whitelist.IsValid(target) || !args.CanAccess)
if (args.Target is not { Valid: true } target || !handLabeler.Whitelist.IsValid(target) || !args.CanAccess
|| _tagSystem.HasTag(target, PreventTag)) // DeltaV - Prevent labels on certain items
return;

string labelerText = handLabeler.AssignedLabel == string.Empty ? Loc.GetString("hand-labeler-remove-label-text") : Loc.GetString("hand-labeler-add-label-text");
Expand All @@ -56,7 +61,8 @@ private void OnUtilityVerb(EntityUid uid, HandLabelerComponent handLabeler, GetV

private void AfterInteractOn(EntityUid uid, HandLabelerComponent handLabeler, AfterInteractEvent args)
{
if (args.Target is not {Valid: true} target || !handLabeler.Whitelist.IsValid(target) || !args.CanReach)
if (args.Target is not { Valid: true } target || !handLabeler.Whitelist.IsValid(target) || !args.CanReach
|| _tagSystem.HasTag(target, PreventTag)) // DeltaV - Prevent labels on certain items
return;

AddLabelTo(uid, handLabeler, target, out string? result);
Expand Down
6 changes: 6 additions & 0 deletions Content.Server/Labels/Label/LabelSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Examine;
using Content.Shared.Labels;
using Content.Shared.Tag;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
Expand All @@ -19,8 +20,11 @@ public sealed class LabelSystem : EntitySystem
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;

public const string ContainerName = "paper_label";
[ValidatePrototypeId<TagPrototype>]
private const string PreventTag = "PreventLabel";

public override void Initialize()
{
Expand All @@ -45,6 +49,8 @@ public void Label(EntityUid uid, string? text, MetaDataComponent? metadata = nul
{
if (!Resolve(uid, ref metadata))
return;
if (_tagSystem.HasTag(uid, PreventTag)) // DeltaV - Prevent labels on certain items
return;
if (!Resolve(uid, ref label, false))
label = EnsureComp<LabelComponent>(uid);

Expand Down
16 changes: 11 additions & 5 deletions Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Server.DoAfter;
using Content.Shared.Tag;
using Content.Shared.Storage;
using Robust.Shared.Containers;

Expand All @@ -18,6 +19,11 @@ public sealed class PseudoItemSystem : EntitySystem
[Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly ItemSystem _itemSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;

[ValidatePrototypeId<TagPrototype>]
private const string PreventTag = "PreventLabel";

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -124,19 +130,19 @@ public bool TryInsert(EntityUid storageUid, EntityUid toInsert, PseudoItemCompon
return false;

var item = EnsureComp<ItemComponent>(toInsert);
_tagSystem.TryAddTag(toInsert, PreventTag);
_itemSystem.SetSize(toInsert, component.Size, item);

if (!_storageSystem.Insert(storageUid, toInsert, out _, storageComp: storage))
{
component.Active = false;
RemComp<ItemComponent>(toInsert);
return false;
} else
{
component.Active = true;
Transform(storageUid).AttachToGridOrMap();
return true;
}

component.Active = true;
Transform(storageUid).AttachToGridOrMap();
return true;
}
private void StartInsertDoAfter(EntityUid inserter, EntityUid toInsert, EntityUid storageEntity, PseudoItemComponent? pseudoItem = null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
action-name-insert-self = Insert yourself
action-name-insert-other = Insert {THE($target)}
2 changes: 2 additions & 0 deletions Resources/Prototypes/DeltaV/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- type: Tag
id: PreventLabel
Loading