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

@@ -36,6 +36,7 @@ using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Server.Administration.Systems;
@@ -68,9 +69,9 @@ public sealed partial class AdminVerbSystem
{
Text = airlock.BoltsDown ? "Unbolt" : "Bolt",
Category = VerbCategory.Tricks,
IconTexture = airlock.BoltsDown
? "/Textures/Interface/AdminActions/unbolt.png"
: "/Textures/Interface/AdminActions/bolt.png",
Icon = airlock.BoltsDown
? new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/unbolt.png"))
: new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/bolt.png")),
Act = () =>
{
_airlockSystem.SetBoltsWithAudio(args.Target, airlock, !airlock.BoltsDown);
@@ -88,7 +89,7 @@ public sealed partial class AdminVerbSystem
{
Text = airlock.EmergencyAccess ? "Emergency Access Off" : "Emergency Access On",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/emergency_access.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/emergency_access.png")),
Act = () =>
{
_airlockSystem.ToggleEmergencyAccess(args.Target, airlock);
@@ -110,7 +111,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Rejuvenate",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/rejuvenate.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/rejuvenate.png")),
Act = () =>
{
RejuvenateCommand.PerformRejuvenate(args.Target);
@@ -128,7 +129,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Make Indestructible",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/VerbIcons/plus.svg.192dpi.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
Act = () =>
{
_godmodeSystem.EnableGodmode(args.Target);
@@ -145,7 +146,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Make Vulnerable",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/VerbIcons/plus.svg.192dpi.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
Act = () =>
{
_godmodeSystem.DisableGodmode(args.Target);
@@ -163,7 +164,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Battery",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/fill_battery.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/fill_battery.png")),
Act = () =>
{
battery.CurrentCharge = battery.MaxCharge;
@@ -179,7 +180,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Drain Battery",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/drain_battery.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/drain_battery.png")),
Act = () =>
{
battery.CurrentCharge = 0;
@@ -195,7 +196,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Infinite Battery",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/infinite_battery.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/infinite_battery.png")),
Act = () =>
{
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
@@ -215,7 +216,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Block Unanchoring",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/VerbIcons/anchor.svg.192dpi.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/anchor.svg.192dpi.png")),
Act = () =>
{
RemComp(args.Target, anchor);
@@ -233,7 +234,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Internals Oxygen",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Tanks/oxygen.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
Act = () =>
{
RefillGasTank(args.Target, Gas.Oxygen, tank);
@@ -248,7 +249,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Internals Nitrogen",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Tanks/red.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Tanks/red.rsi"), "icon"),
Act = () =>
{
RefillGasTank(args.Target, Gas.Nitrogen, tank);
@@ -263,7 +264,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Internals Plasma",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Tanks/plasma.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
Act = () =>
{
RefillGasTank(args.Target, Gas.Plasma, tank);
@@ -275,13 +276,13 @@ public sealed partial class AdminVerbSystem
args.Verbs.Add(refillInternalsPlasma);
}
if (TryComp<InventoryComponent>(args.Target, out var inventory))
if (HasComp<InventoryComponent>(args.Target))
{
Verb refillInternalsO2 = new()
{
Text = "Refill Internals Oxygen",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Tanks/oxygen.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
Act = () =>
{
foreach (var slot in _inventorySystem.GetSlots(args.Target))
@@ -289,7 +290,7 @@ public sealed partial class AdminVerbSystem
if (!_inventorySystem.TryGetSlotEntity(args.Target, slot.Name, out var entity))
continue;
if (!TryComp<GasTankComponent>(entity, out var tank))
if (!TryComp(entity, out tank))
continue;
RefillGasTank(entity.Value, Gas.Oxygen, tank);
@@ -297,7 +298,7 @@ public sealed partial class AdminVerbSystem
foreach (var held in _handsSystem.EnumerateHeld(args.Target))
{
if (!TryComp<GasTankComponent>(held, out var tank))
if (!TryComp(held, out tank))
continue;
RefillGasTank(held, Gas.Oxygen, tank);
@@ -313,7 +314,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Internals Nitrogen",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Tanks/red.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Tanks/red.rsi"), "icon"),
Act = () =>
{
foreach (var slot in _inventorySystem.GetSlots(args.Target))
@@ -321,7 +322,7 @@ public sealed partial class AdminVerbSystem
if (!_inventorySystem.TryGetSlotEntity(args.Target, slot.Name, out var entity))
continue;
if (!TryComp<GasTankComponent>(entity, out var tank))
if (!TryComp(entity, out tank))
continue;
RefillGasTank(entity.Value, Gas.Nitrogen, tank);
@@ -329,7 +330,7 @@ public sealed partial class AdminVerbSystem
foreach (var held in _handsSystem.EnumerateHeld(args.Target))
{
if (!TryComp<GasTankComponent>(held, out var tank))
if (!TryComp(held, out tank))
continue;
RefillGasTank(held, Gas.Nitrogen, tank);
@@ -345,7 +346,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Internals Plasma",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Tanks/plasma.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
Act = () =>
{
foreach (var slot in _inventorySystem.GetSlots(args.Target))
@@ -353,7 +354,7 @@ public sealed partial class AdminVerbSystem
if (!_inventorySystem.TryGetSlotEntity(args.Target, slot.Name, out var entity))
continue;
if (!TryComp<GasTankComponent>(entity, out var tank))
if (!TryComp(entity, out tank))
continue;
RefillGasTank(entity.Value, Gas.Plasma, tank);
@@ -361,7 +362,7 @@ public sealed partial class AdminVerbSystem
foreach (var held in _handsSystem.EnumerateHeld(args.Target))
{
if (!TryComp<GasTankComponent>(held, out var tank))
if (!TryComp(held, out tank))
continue;
RefillGasTank(held, Gas.Plasma, tank);
@@ -378,7 +379,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Send to test arena",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/VerbIcons/eject.svg.192dpi.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
Act = () =>
{
@@ -399,7 +400,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Grant All Access",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Misc/id_cards.rsi/centcom.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
Act = () =>
{
GiveAllAccess(activeId.Value);
@@ -414,7 +415,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Revoke All Access",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Misc/id_cards.rsi/default.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Misc/id_cards.rsi"), "default"),
Act = () =>
{
RevokeAllAccess(activeId.Value);
@@ -432,7 +433,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Grant All Access",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Misc/id_cards.rsi/centcom.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
Act = () =>
{
GiveAllAccess(args.Target);
@@ -447,7 +448,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Revoke All Access",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Misc/id_cards.rsi/default.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Misc/id_cards.rsi"), "default"),
Act = () =>
{
RevokeAllAccess(args.Target);
@@ -466,7 +467,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Adjust Stack",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/adjust-stack.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/adjust-stack.png")),
Act = () =>
{
// Unbounded intentionally.
@@ -485,7 +486,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Fill Stack",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/fill-stack.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/fill-stack.png")),
Act = () =>
{
_stackSystem.SetCount(args.Target, _stackSystem.GetMaxCount(stack), stack);
@@ -501,7 +502,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Rename",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/rename.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/rename.png")),
Act = () =>
{
_quickDialog.OpenDialog(player, "Rename", "Name", (string newName) =>
@@ -519,7 +520,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Redescribe",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/redescribe.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/redescribe.png")),
Act = () =>
{
_quickDialog.OpenDialog(player, "Redescribe", "Description", (LongString newDescription) =>
@@ -537,7 +538,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Redescribe",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/rename_and_redescribe.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/rename_and_redescribe.png")),
Act = () =>
{
_quickDialog.OpenDialog(player, "Rename & Redescribe", "Name", "Description",
@@ -562,7 +563,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Bar job slots",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/bar_jobslots.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/bar_jobslots.png")),
Act = () =>
{
foreach (var (job, _) in _stationJobsSystem.GetJobs(args.Target))
@@ -581,7 +582,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Locate Cargo Shuttle",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Clothing/Head/Soft/cargosoft.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Clothing/Head/Soft/cargosoft.rsi"), "icon"),
Act = () =>
{
var shuttle = Comp<StationCargoOrderDatabaseComponent>(args.Target).Shuttle;
@@ -604,7 +605,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Refill Battery",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/fill_battery.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/fill_battery.png")),
Act = () =>
{
foreach (var ent in childEnum)
@@ -626,7 +627,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Drain Battery",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/drain_battery.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/drain_battery.png")),
Act = () =>
{
foreach (var ent in childEnum)
@@ -648,7 +649,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Infinite Battery",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/infinite_battery.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/infinite_battery.png")),
Act = () =>
{
// this kills the sloth
@@ -677,7 +678,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Halt Movement",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/halt.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/halt.png")),
Act = () =>
{
_physics.SetLinearVelocity(args.Target, Vector2.Zero, body: physics);
@@ -700,7 +701,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Unpause Map",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/play.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/play.png")),
Act = () =>
{
_mapManager.SetMapPaused(map.WorldMap, false);
@@ -717,7 +718,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Pause Map",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/pause.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/pause.png")),
Act = () =>
{
_mapManager.SetMapPaused(map.WorldMap, true);
@@ -737,7 +738,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Snap Joints",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Interface/AdminActions/snap_joints.png",
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/AdminActions/snap_joints.png")),
Act = () =>
{
_jointSystem.ClearJoints(joints);
@@ -755,7 +756,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Make Minigun",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Weapons/Guns/HMGs/minigun.rsi/icon.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Weapons/Guns/HMGs/minigun.rsi"), "icon"),
Act = () =>
{
gun.FireRate = 15;
@@ -773,7 +774,7 @@ public sealed partial class AdminVerbSystem
{
Text = "Set Bullet Amount",
Category = VerbCategory.Tricks,
IconTexture = "/Textures/Objects/Fun/caps.rsi/mag-6.png",
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Fun/caps.rsi"), "mag-6"),
Act = () =>
{
_quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (max {ballisticAmmo.Capacity}):", (int amount) =>