Fix rsi sprite access for verbs (#14284)

This commit is contained in:
metalgearsloth
2023-02-26 18:48:57 +11:00
committed by GitHub
parent a6d0c9b129
commit 44fb8a9e2d
53 changed files with 313 additions and 271 deletions

View File

@@ -7,6 +7,7 @@ using Content.Shared.Storage.Components;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Utility;
namespace Content.Server.Foldable
{
@@ -32,9 +33,9 @@ namespace Content.Server.Foldable
args.Cancelled = true;
}
public bool TryToggleFold(FoldableComponent comp)
public bool TryToggleFold(EntityUid uid, FoldableComponent comp)
{
return TrySetFolded(comp, !comp.IsFolded);
return TrySetFolded(uid, comp, !comp.IsFolded);
}
public bool CanToggleFold(EntityUid uid, FoldableComponent? fold = null)
@@ -62,18 +63,15 @@ namespace Content.Server.Foldable
/// <summary>
/// Try to fold/unfold
/// </summary>
/// <param name="comp"></param>
/// <param name="state">Folded state we want</param>
/// <returns>True if successful</returns>
public bool TrySetFolded(FoldableComponent comp, bool state)
public bool TrySetFolded(EntityUid uid, FoldableComponent comp, bool state)
{
if (state == comp.IsFolded)
return false;
if (!CanToggleFold(comp.Owner, comp))
if (!CanToggleFold(uid, comp))
return false;
SetFolded(comp, state);
SetFolded(uid, comp, state);
return true;
}
@@ -82,12 +80,12 @@ namespace Content.Server.Foldable
/// </summary>
/// <param name="component"></param>
/// <param name="folded">If true, the component will become folded, else unfolded</param>
public override void SetFolded(FoldableComponent component, bool folded)
public override void SetFolded(EntityUid uid, FoldableComponent component, bool folded)
{
base.SetFolded(component, folded);
base.SetFolded(uid, component, folded);
// You can't buckle an entity to a folded object
_buckle.StrapSetEnabled(component.Owner, !component.IsFolded);
_buckle.StrapSetEnabled(uid, !component.IsFolded);
}
public void OnStoreThisAttempt(EntityUid uid, FoldableComponent comp, ref StoreMobInItemContainerAttemptEvent args)
@@ -107,9 +105,9 @@ namespace Content.Server.Foldable
AlternativeVerb verb = new()
{
Act = () => TryToggleFold(component),
Act = () => TryToggleFold(uid, component),
Text = component.IsFolded ? Loc.GetString("unfold-verb") : Loc.GetString("fold-verb"),
IconTexture = "/Textures/Interface/VerbIcons/fold.svg.192dpi.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/fold.svg.192dpi.png")),
// If the object is unfolded and they click it, they want to fold it, if it's folded, they want to pick it up
Priority = component.IsFolded ? 0 : 2,