Files
Delta-v/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs
T
29e55b9464 Upstream Merge (June / July) attempt 2 electric boogaloo (#4607)
* Fix the sensor monitoring console forcing a GC every 3 seconds (#38146)

* Optimize sensor monitoring window graph drawing

* Add shared static Vector2 pool for all GraphView instances

* Address requested changes

* remove lock

* Update submodule to 264.0.0 (#38629)

* Toy/Plushie Inhands and Wearables (#38514)

* Fixed dependency injection and some other issues in a few places.

* More issue fixes

* patchfor broken NetworkConfiguratorLinkMenu (#38632)

fix

* Fix solutions flickering when transferring contents (#34838)

* Use Solution clones when applying SolutionComponent states

* Revert "Use Solution clones when applying SolutionComponent states"

This reverts commit 013fd111cf92b22562e00f98a7aaa49bc4b4ed62.

* Make Solution implement ICloneable and rename Clone method.

* Copy CanReact value when cloning a Solution

* Convert to IRobustCloneable

* Fix typos in guidebook: Buisness → Business (#38636)

* Fix typo in `MinorAntagonists.xml`

Buisness → Business

* Fix typo in `YourFirstCharacter.xml`

Buisness → Business

* Various Headphones Fixes and Tweaks (#38479)

* sprites, wearables

* neck

* icon-on sprite

* Cleanup prototype instantiation in `DamageTest` (#38639)

Cleanup prototype instantiation in DamageTest

* Cleanup prototype instantiation in `ExplosionSystem` (#38642)

Cleanup prototype instantiation in ExplosionSystem

* AddBodyPartCommand localization. (#38612)

commit

* fix ItemSlotsSystem debug assert (#38655)

* Allow the Command & Super door remotes to use the access of their user. (Re-creation of PR due to changes to game balance) (#35536)

* Added directional beacons (#38284)

* Added directional beacons

Signed-off-by: Nox38 <nebulousnox38@gmail.com>

* Fixed names

Signed-off-by: Nox38 <nebulousnox38@gmail.com>

---------

Signed-off-by: Nox38 <nebulousnox38@gmail.com>

* Power stat and nuke codes commands get some LEC love. (#38585)

* commit

* requested changes.

* Dsay Dirty and Follow commands converted to LEC and localized. (#38666)

* commit

* whoopwhoopwhoop

* Retro laser sprite fix (#38676)

* Fixed everything except the icon

Signed-off-by: Nox38 <nebulousnox38@gmail.com>

* fixed icon

Signed-off-by: Nox38 <nebulousnox38@gmail.com>

---------

Signed-off-by: Nox38 <nebulousnox38@gmail.com>

* fix water coolers (#38681)

* Monochromacy typo fix (#38686)

* fixes the typo

* Fixed cloning looking for the trait, not the component, RE https://github.com/space-wizards/space-station-14/pull/38686#issuecomment-3025093504

* Apply suggestions from code review

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Validate `CloningSettingsPrototype`s (#38688)

* Validate CloningSettingsPrototypes

* Update Content.IntegrationTests/Tests/Cloning/CloningSettingsPrototypeTest.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Check EventComponents too

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Add test of objective-related console commands (#36400)

* Add test of objective add/list/remove commands

* Not sure why we're validating test prototypes, but sure

* We don't need a map

* Improvements and fixups for New Status Effect API (#38660)

* Predict healing and bloodstream (#38690)

* initial commit

* reapply 38126

* fix rootable

* someone missed an important minus sign here

* try this

* fix

* fix

* reenable crit hits

* cleanup

* fix status time dirtying

* fix

* camelCase

* Healing and bloodstream prediction fixes.

* Resolving Wizard casting recall on nuke disk making it impossible to disarm (#38661)

* Resolving Wizard Recall on Nuke disk making it impossible to disarm
- Adding a DisarmBomb case to nuke status update loop
- Changing a few methods and parameters to properly follow formatting standards
- Updating some names to follow camelCase

* Updating missed tag

* Reverting DataField change

Should prevent this preventative bugfix being a breaking change.

* Switch HSV to the default colorspace for character customization (#38434)

* Made HSV default for character editor

* Adds/fixes comments to HSV defaulting

* Added dropbox fix, potentially cursed

* Revert "Added dropbox fix, potentially cursed"

This reverts commit a709883366fbee813e839742125e70844672af29.

---------

Co-authored-by: TrixxedHeart <46364955+TrixxedBit@users.noreply.github.com>

* Fix: Don't deploy foldables when clicking on items inside containers (#38709)

* Fix

* Apply suggestions from code review

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Pressure Relief Valve (#36708)

* initial system (this math is probably WRONG)

* General code cleanup and OnExamined support
(holy moly this code sucks)

* UICode and related events foundation
TODO:
- Actually write the XAML UI and the underlying system
- Un-shitcode the entire thing
- Actually test everything...

* Working UI code
TODO: Make predicted, as this certainly isn't predicted. Even though I said it was. It isn't.

* Remove one TODO for unshitcoding the examine code

* Add reminder
yea

* Make predicted (defenitely isn't)
(also defenitely isn't a copypaste from pressure pump code)

* It's predicted!
TODO:
- Give it snazzy predicted visuals!
- Have a different field for pressure entry, lest it gets bulldozed every UI update.

* Improve gas pressure relief valve UI
TODO: Reminder to reduce amount of dirties using deltafields

* Implement DirtyField prediction

* Entity<T> cleanup
A lot of Entity<T> conversions and lukewarm cleanup.

Also got caught copy pasting code in 4K UHD but it's not like you couldn't tell.

* More cleanup and comments

* Remove TODO comment on bulldozing window title

* """refactoring"""
- Move appearance out of shared and finally fix it. Pointless to predict appearance in this instance.
- More Entity<T> conversions because I like them.
- Move UI creation handling over entirely to the ActivatableUI system.
- Fix a hardcoded locale string (why????).

* Add visuals

* Revert debugging variable replacememt
yea

* Revert skissue

* Remove unused using directives and remove TODO

* Localize, cleanup, document

* Fix adminlogging discrepancy

* Add ability to construct, add guidebook entry

* Clear up comment

* Add guidebook tooltip to valve

* Convert GasPressureReliefValveBoundUserInterface declaration into primary constructor

* Adds more input handling and adds autofill on open

* Un-deepfry input validator shitcode
Genuinely what was I smoking

* improve visuals logic

* Refactor again
- Update math to the correct implementation
- Moved code that could be re-used in the future into a helper method under AtmosphereSystem.Gases.cs

* I'm sorry but I hate warnings

* Remove unused using directive in AtmosphereSystem.Gases.cs

* Review and cleanup

* Lukewarm UI glossup

* Maintainer for the upstream project btw

* Remove redundant state sets and messy logic

* Unduplicate valve updater code

* Redo UI (im sorry Slarti)

* run tests

* Test refactored UI messaging

* Second round of UI improvements
- God please find a way to improve this system. Feels bad.

* Update loop implementation

* Further predict UI

* Clear up SetToCurrentThreshold

* cleanup

* Update to master + pipe layers and bug fixes
want to run tests

* fixes

* Deploy rename pipebomb

* Documentation and requested changes

* Rename the method that wiggled away

* Undo rounding changes

* Fix comment

* Rename and cleanup

* Apply suggestions from code review

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Fix TextLinkTag (#32203)

* Adjust uplink buy button to be under item icon (#38596)

* Adjusted uplink buy button to be under item icon

* Put the discount subtext under the icon

* Indent fixes, added margin

---------

Co-authored-by: TrixxedHeart <46364955+TrixxedBit@users.noreply.github.com>

* Scurrets - Audio Improvements (#38482)

* Scurret audio tuning

* Add new sfx

* Update sneezing sfx

* YAML support

* Rename a folder

* make telesci wreck easier (#37569)

rel

* Validate `ShaderPrototype` IDs (#38728)

* Convert all shader prototype string literals to protoids in overlays

* Convert more shader prototype literal strings to protoids

* Convert ValidatePrototypeId to ProtoId

* Later

* [BUGFIX] Fixed revenant malfunction ability not working properly only MediBots and Stasis bed (#38664)

* fixed

* clean up

* orks fix smart

* review fix 1

* more requested changes

* less cursed

* more descriptive description

* better wording

* Tiny Tiny Cleanup of the EyeClosingSystem. (#38734)

Update EyeClosingSystem.cs

* Fix human skin tone distribution (#38701)

* fix: Use PredictedQueueDel for gib spell (#38729)

* fix: don't default to uncharged sprite state for cells (#38730)

* Fix Hristov description - remove inaccurate technical specs (#38746)

- Removes inaccurate 'armor piercing 14.5mm shells' reference
- Replaces it with a more funny description, matching the style of the other snipers and guns
- Keeps ammunition type '.60 anti-materiel ammo' specification
- Fixes issue #38590

Co-authored-by: Arthur Fiorese de Andrade <aandrade@cmcxs.gov.br>

* feat: allow mopping evaporating puddles (#38743)

* Validate remaining `ProtoId` strings (#38747)

Validate remaining ProtoId strings

* Validate `ProtoId`s in tests (#38745)

* Convert string literals to protoids in Content.Tests

* Convert string literals to protoids or consts in Content.IntegrationTests

* Fix linter failures
Tricksy static using misled me

* Cleanup warning in StomachSystem (#38748)

you did not see this

* Vox scars (#38592)

* Added vox scars n'stuff, renamed vox_tattoos.ftl to just vox.ftl

* Revert "Added vox scars n'stuff, renamed vox_tattoos.ftl to just vox.ftl"

This reverts commit c73da55ba3b39ddf93b493aecd85604c54dd8a15.

* locale key fix

* Changed top surgery scar names to be more generalized

* Adjusted face scars

* Formatting fixes

---------

Co-authored-by: TrixxedHeart <46364955+TrixxedBit@users.noreply.github.com>

* UnlockNode command to LEC. (#38751)

* commit

* Update UnlockNodeCommand.cs

* commit

* move command locale to its own file.

* Update Content.Server/Xenoarchaeology/Artifact/UnlockNodeCommand.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Typofixes for figurine dialogue (#38737)

* Typofixes for figurine dialogue

* Forgot two

* Janitor Tool: Wire Brush (#38667)

* Wow! It's -brush-

* spacing.

* Update Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Update Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* fixed changes

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Minor escape menu UX improvements (#38650)

* fix: spellbooks can have infinite charges (#38376)

* fix: spellbooks can have infinite charges

* refactor: indicate infinite spellbook charges with null

Not sure if I like this much better...
2025-11-06 18:22:39 +00:00

926 lines
37 KiB
C#

using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Content.Server.Administration.Components;
using Content.Server.Atmos;
using Content.Server.Atmos.Components;
using Content.Server.Cargo.Components;
using Content.Server.Doors.Systems;
using Content.Server.Hands.Systems;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Revenant.Components; // Imp
using Content.Server.Revenant.EntitySystems; // Imp
using Content.Server.Stack;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Access;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Construction.Components;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Database;
using Content.Shared.Doors.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
using Content.Shared.Item; // Imp
using Content.Shared.PDA;
using Content.Shared.Stacks;
using Content.Shared.Verbs;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Server.Physics;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Server.Administration.Systems;
public sealed partial class AdminVerbSystem
{
[Dependency] private readonly DoorSystem _door = default!;
[Dependency] private readonly AirlockSystem _airlockSystem = default!;
[Dependency] private readonly StackSystem _stackSystem = default!;
[Dependency] private readonly SharedAccessSystem _accessSystem = default!;
[Dependency] private readonly HandsSystem _handsSystem = default!;
[Dependency] private readonly QuickDialogSystem _quickDialog = default!;
[Dependency] private readonly AdminTestArenaSystem _adminTestArenaSystem = default!;
[Dependency] private readonly StationJobsSystem _stationJobsSystem = default!;
[Dependency] private readonly JointSystem _jointSystem = default!;
[Dependency] private readonly BatterySystem _batterySystem = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
[Dependency] private readonly GunSystem _gun = default!;
[Dependency] private readonly RevenantAnimatedSystem _revenantAnimate = default!; // Imp
private void AddTricksVerbs(GetVerbsEvent<Verb> args)
{
if (!TryComp(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;
if (!_adminManager.HasAdminFlag(player, AdminFlags.Admin))
return;
if (TryComp<DoorBoltComponent>(args.Target, out var bolts))
{
Verb bolt = new()
{
Text = bolts.BoltsDown ? "Unbolt" : "Bolt",
Category = VerbCategory.Tricks,
Icon = bolts.BoltsDown
? new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/unbolt.png"))
: new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/bolt.png")),
Act = () =>
{
_door.SetBoltsDown((args.Target, bolts), !bolts.BoltsDown);
},
Impact = LogImpact.Medium,
Message = Loc.GetString(bolts.BoltsDown
? "admin-trick-unbolt-description"
: "admin-trick-bolt-description"),
Priority = (int)(bolts.BoltsDown ? TricksVerbPriorities.Unbolt : TricksVerbPriorities.Bolt),
};
args.Verbs.Add(bolt);
}
if (TryComp<AirlockComponent>(args.Target, out var airlockComp))
{
Verb emergencyAccess = new()
{
Text = airlockComp.EmergencyAccess ? "Emergency Access Off" : "Emergency Access On",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/emergency_access.png")),
Act = () =>
{
_airlockSystem.SetEmergencyAccess((args.Target, airlockComp), !airlockComp.EmergencyAccess);
},
Impact = LogImpact.Medium,
Message = Loc.GetString(airlockComp.EmergencyAccess
? "admin-trick-emergency-access-off-description"
: "admin-trick-emergency-access-on-description"),
Priority = (int)(airlockComp.EmergencyAccess ? TricksVerbPriorities.EmergencyAccessOff : TricksVerbPriorities.EmergencyAccessOn),
};
args.Verbs.Add(emergencyAccess);
}
if (HasComp<DamageableComponent>(args.Target))
{
Verb rejuvenate = new()
{
Text = "Rejuvenate",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rejuvenate.png")),
Act = () =>
{
_rejuvenate.PerformRejuvenate(args.Target);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-rejuvenate-description"),
Priority = (int)TricksVerbPriorities.Rejuvenate,
};
args.Verbs.Add(rejuvenate);
}
if (!HasComp<GodmodeComponent>(args.Target))
{
Verb makeIndestructible = new()
{
Text = "Make Indestructible",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
Act = () =>
{
_sharedGodmodeSystem.EnableGodmode(args.Target);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-make-indestructible-description"),
Priority = (int)TricksVerbPriorities.MakeIndestructible,
};
args.Verbs.Add(makeIndestructible);
}
else
{
Verb makeVulnerable = new()
{
Text = "Make Vulnerable",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/plus.svg.192dpi.png")),
Act = () =>
{
_sharedGodmodeSystem.DisableGodmode(args.Target);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-make-vulnerable-description"),
Priority = (int)TricksVerbPriorities.MakeVulnerable,
};
args.Verbs.Add(makeVulnerable);
}
if (TryComp<BatteryComponent>(args.Target, out var battery))
{
Verb refillBattery = new()
{
Text = "Refill Battery",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill_battery.png")),
Act = () =>
{
_batterySystem.SetCharge(args.Target, battery.MaxCharge, battery);
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-refill-battery-description"),
Priority = (int)TricksVerbPriorities.RefillBattery,
};
args.Verbs.Add(refillBattery);
Verb drainBattery = new()
{
Text = "Drain Battery",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/drain_battery.png")),
Act = () =>
{
_batterySystem.SetCharge(args.Target, 0, battery);
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-drain-battery-description"),
Priority = (int)TricksVerbPriorities.DrainBattery,
};
args.Verbs.Add(drainBattery);
Verb infiniteBattery = new()
{
Text = "Infinite Battery",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/infinite_battery.png")),
Act = () =>
{
var recharger = EnsureComp<BatterySelfRechargerComponent>(args.Target);
recharger.AutoRecharge = true;
recharger.AutoRechargeRate = battery.MaxCharge; // Instant refill.
recharger.AutoRechargePause = false; // No delay.
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-infinite-battery-object-description"),
Priority = (int)TricksVerbPriorities.InfiniteBattery,
};
args.Verbs.Add(infiniteBattery);
}
if (TryComp<AnchorableComponent>(args.Target, out var anchor))
{
Verb blockUnanchor = new()
{
Text = "Block Unanchoring",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/anchor.svg.192dpi.png")),
Act = () =>
{
RemComp(args.Target, anchor);
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-block-unanchoring-description"),
Priority = (int)TricksVerbPriorities.BlockUnanchoring,
};
args.Verbs.Add(blockUnanchor);
}
if (TryComp<GasTankComponent>(args.Target, out var tank))
{
Verb refillInternalsO2 = new()
{
Text = "Refill Internals Oxygen",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
Act = () =>
{
RefillGasTank(args.Target, Gas.Oxygen, tank);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-internals-refill-oxygen-description"),
Priority = (int)TricksVerbPriorities.RefillOxygen,
};
args.Verbs.Add(refillInternalsO2);
Verb refillInternalsN2 = new()
{
Text = "Refill Internals Nitrogen",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
Act = () =>
{
RefillGasTank(args.Target, Gas.Nitrogen, tank);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-internals-refill-nitrogen-description"),
Priority = (int)TricksVerbPriorities.RefillNitrogen,
};
args.Verbs.Add(refillInternalsN2);
Verb refillInternalsPlasma = new()
{
Text = "Refill Internals Plasma",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
Act = () =>
{
RefillGasTank(args.Target, Gas.Plasma, tank);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-internals-refill-plasma-description"),
Priority = (int)TricksVerbPriorities.RefillPlasma,
};
args.Verbs.Add(refillInternalsPlasma);
}
if (HasComp<InventoryComponent>(args.Target))
{
Verb refillInternalsO2 = new()
{
Text = "Refill Internals Oxygen",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/oxygen.rsi"), "icon"),
Act = () => RefillEquippedTanks(args.User, Gas.Oxygen),
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-internals-refill-oxygen-description"),
Priority = (int)TricksVerbPriorities.RefillOxygen,
};
args.Verbs.Add(refillInternalsO2);
Verb refillInternalsN2 = new()
{
Text = "Refill Internals Nitrogen",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/red.rsi"), "icon"),
Act = () => RefillEquippedTanks(args.User, Gas.Nitrogen),
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-internals-refill-nitrogen-description"),
Priority = (int)TricksVerbPriorities.RefillNitrogen,
};
args.Verbs.Add(refillInternalsN2);
Verb refillInternalsPlasma = new()
{
Text = "Refill Internals Plasma",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Tanks/plasma.rsi"), "icon"),
Act = () => RefillEquippedTanks(args.User, Gas.Plasma),
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-internals-refill-plasma-description"),
Priority = (int)TricksVerbPriorities.RefillPlasma,
};
args.Verbs.Add(refillInternalsPlasma);
}
Verb sendToTestArena = new()
{
Text = "Send to test arena",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/eject.svg.192dpi.png")),
Act = () =>
{
var (mapUid, gridUid) = _adminTestArenaSystem.AssertArenaLoaded(player);
_transformSystem.SetCoordinates(args.Target, new EntityCoordinates(gridUid ?? mapUid, Vector2.One));
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-send-to-test-arena-description"),
Priority = (int)TricksVerbPriorities.SendToTestArena,
};
args.Verbs.Add(sendToTestArena);
var activeId = FindActiveId(args.Target);
if (activeId is not null)
{
Verb grantAllAccess = new()
{
Text = "Grant All Access",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
Act = () =>
{
GiveAllAccess(activeId.Value);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-grant-all-access-description"),
Priority = (int)TricksVerbPriorities.GrantAllAccess,
};
args.Verbs.Add(grantAllAccess);
Verb revokeAllAccess = new()
{
Text = "Revoke All Access",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
Act = () =>
{
RevokeAllAccess(activeId.Value);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-revoke-all-access-description"),
Priority = (int)TricksVerbPriorities.RevokeAllAccess,
};
args.Verbs.Add(revokeAllAccess);
}
if (HasComp<AccessComponent>(args.Target))
{
Verb grantAllAccess = new()
{
Text = "Grant All Access",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "centcom"),
Act = () =>
{
GiveAllAccess(args.Target);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-grant-all-access-description"),
Priority = (int)TricksVerbPriorities.GrantAllAccess,
};
args.Verbs.Add(grantAllAccess);
Verb revokeAllAccess = new()
{
Text = "Revoke All Access",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Misc/id_cards.rsi"), "default"),
Act = () =>
{
RevokeAllAccess(args.Target);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-revoke-all-access-description"),
Priority = (int)TricksVerbPriorities.RevokeAllAccess,
};
args.Verbs.Add(revokeAllAccess);
}
if (TryComp<StackComponent>(args.Target, out var stack))
{
Verb adjustStack = new()
{
Text = "Adjust Stack",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/adjust-stack.png")),
Act = () =>
{
// Unbounded intentionally.
_quickDialog.OpenDialog(player, "Adjust stack", $"Amount (max {_stackSystem.GetMaxCount(stack)})", (int newAmount) =>
{
_stackSystem.SetCount(args.Target, newAmount, stack);
});
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-adjust-stack-description"),
Priority = (int) TricksVerbPriorities.AdjustStack,
};
args.Verbs.Add(adjustStack);
Verb fillStack = new()
{
Text = "Fill Stack",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill-stack.png")),
Act = () =>
{
_stackSystem.SetCount(args.Target, _stackSystem.GetMaxCount(stack), stack);
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-fill-stack-description"),
Priority = (int) TricksVerbPriorities.FillStack,
};
args.Verbs.Add(fillStack);
}
Verb rename = new()
{
Text = "Rename",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rename.png")),
Act = () =>
{
_quickDialog.OpenDialog(player, "Rename", "Name", (string newName) =>
{
_metaSystem.SetEntityName(args.Target, newName);
});
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-rename-description"),
Priority = (int) TricksVerbPriorities.Rename,
};
args.Verbs.Add(rename);
Verb redescribe = new()
{
Text = "Redescribe",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/redescribe.png")),
Act = () =>
{
_quickDialog.OpenDialog(player, "Redescribe", "Description", (LongString newDescription) =>
{
_metaSystem.SetEntityDescription(args.Target, newDescription.String);
});
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-redescribe-description"),
Priority = (int) TricksVerbPriorities.Redescribe,
};
args.Verbs.Add(redescribe);
Verb renameAndRedescribe = new()
{
Text = "Redescribe",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/rename_and_redescribe.png")),
Act = () =>
{
_quickDialog.OpenDialog(player, "Rename & Redescribe", "Name", "Description",
(string newName, LongString newDescription) =>
{
var meta = MetaData(args.Target);
_metaSystem.SetEntityName(args.Target, newName, meta);
_metaSystem.SetEntityDescription(args.Target, newDescription.String, meta);
});
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-rename-and-redescribe-description"),
Priority = (int) TricksVerbPriorities.RenameAndRedescribe,
};
args.Verbs.Add(renameAndRedescribe);
if (TryComp<StationDataComponent>(args.Target, out var stationData))
{
if (_adminManager.HasAdminFlag(player, AdminFlags.Round))
{
Verb barJobSlots = new()
{
Text = "Bar job slots",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/bar_jobslots.png")),
Act = () =>
{
foreach (var (job, _) in _stationJobsSystem.GetJobs(args.Target))
{
_stationJobsSystem.TrySetJobSlot(args.Target, job, 0, true);
}
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-bar-job-slots-description"),
Priority = (int) TricksVerbPriorities.BarJobSlots,
};
args.Verbs.Add(barJobSlots);
}
Verb locateCargoShuttle = new()
{
Text = "Locate Cargo Shuttle",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Clothing/Head/Soft/cargosoft.rsi"), "icon"),
Act = () =>
{
var shuttle = Comp<StationCargoOrderDatabaseComponent>(args.Target).Shuttle;
if (shuttle is null)
return;
_transformSystem.SetCoordinates(args.User, new EntityCoordinates(shuttle.Value, Vector2.Zero));
},
Impact = LogImpact.Low,
Message = Loc.GetString("admin-trick-locate-cargo-shuttle-description"),
Priority = (int) TricksVerbPriorities.LocateCargoShuttle,
};
args.Verbs.Add(locateCargoShuttle);
}
if (TryGetGridChildren(args.Target, out var childEnum))
{
Verb refillBattery = new()
{
Text = "Refill Battery",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/fill_battery.png")),
Act = () =>
{
foreach (var ent in childEnum)
{
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
continue;
var battery = EnsureComp<BatteryComponent>(ent);
_batterySystem.SetCharge(ent, battery.MaxCharge, battery);
}
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-refill-battery-description"),
Priority = (int) TricksVerbPriorities.RefillBattery,
};
args.Verbs.Add(refillBattery);
Verb drainBattery = new()
{
Text = "Drain Battery",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/drain_battery.png")),
Act = () =>
{
foreach (var ent in childEnum)
{
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
continue;
var battery = EnsureComp<BatteryComponent>(ent);
_batterySystem.SetCharge(ent, 0, battery);
}
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-drain-battery-description"),
Priority = (int) TricksVerbPriorities.DrainBattery,
};
args.Verbs.Add(drainBattery);
Verb infiniteBattery = new()
{
Text = "Infinite Battery",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/infinite_battery.png")),
Act = () =>
{
// this kills the sloth
foreach (var ent in childEnum)
{
if (!HasComp<StationInfiniteBatteryTargetComponent>(ent))
continue;
var recharger = EnsureComp<BatterySelfRechargerComponent>(ent);
var battery = EnsureComp<BatteryComponent>(ent);
recharger.AutoRecharge = true;
recharger.AutoRechargeRate = battery.MaxCharge; // Instant refill.
recharger.AutoRechargePause = false; // No delay.
}
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-infinite-battery-description"),
Priority = (int) TricksVerbPriorities.InfiniteBattery,
};
args.Verbs.Add(infiniteBattery);
}
if (TryComp<PhysicsComponent>(args.Target, out var physics))
{
Verb haltMovement = new()
{
Text = "Halt Movement",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/halt.png")),
Act = () =>
{
_physics.SetLinearVelocity(args.Target, Vector2.Zero, body: physics);
_physics.SetAngularVelocity(args.Target, 0f, body: physics);
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-halt-movement-description"),
Priority = (int) TricksVerbPriorities.HaltMovement,
};
args.Verbs.Add(haltMovement);
}
if (TryComp<MapComponent>(args.Target, out var map))
{
if (_adminManager.HasAdminFlag(player, AdminFlags.Mapping))
{
if (_map.IsPaused(map.MapId))
{
Verb unpauseMap = new()
{
Text = "Unpause Map",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/play.png")),
Act = () =>
{
_map.SetPaused(map.MapId, false);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-unpause-map-description"),
Priority = (int) TricksVerbPriorities.Unpause,
};
args.Verbs.Add(unpauseMap);
}
else
{
Verb pauseMap = new()
{
Text = "Pause Map",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/pause.png")),
Act = () =>
{
_map.SetPaused(map.MapId, true);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-trick-pause-map-description"),
Priority = (int) TricksVerbPriorities.Pause,
};
args.Verbs.Add(pauseMap);
}
}
}
if (TryComp<JointComponent>(args.Target, out var joints))
{
Verb snapJoints = new()
{
Text = "Snap Joints",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/AdminActions/snap_joints.png")),
Act = () =>
{
_jointSystem.ClearJoints(args.Target, joints);
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-snap-joints-description"),
Priority = (int) TricksVerbPriorities.SnapJoints,
};
args.Verbs.Add(snapJoints);
}
if (TryComp<GunComponent>(args.Target, out var gun))
{
Verb minigunFire = new()
{
Text = "Make Minigun",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Weapons/Guns/HMGs/minigun.rsi"), "icon"),
Act = () =>
{
EnsureComp<AdminMinigunComponent>(args.Target);
_gun.RefreshModifiers((args.Target, gun));
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-minigun-fire-description"),
Priority = (int) TricksVerbPriorities.MakeMinigun,
};
args.Verbs.Add(minigunFire);
}
if (TryComp<BallisticAmmoProviderComponent>(args.Target, out var ballisticAmmo))
{
Verb setCapacity = new()
{
Text = "Set Bullet Amount",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Fun/caps.rsi"), "mag-6"),
Act = () =>
{
_quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (standard {ballisticAmmo.Capacity}):", (string amount) =>
{
if (!int.TryParse(amount, out var result))
return;
_gun.SetBallisticUnspawned((args.Target, ballisticAmmo), result);
_gun.UpdateBallisticAppearance(args.Target, ballisticAmmo);
});
},
Impact = LogImpact.Medium,
Message = Loc.GetString("admin-trick-set-bullet-amount-description"),
Priority = (int) TricksVerbPriorities.SetBulletAmount,
};
args.Verbs.Add(setCapacity);
}
if (TryComp<ItemComponent>(args.Target, out var item))
{
Verb makeAnimate = new()
{
Text = "Animate Item",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/Actions/animate.png")),
Act = () =>
{
_revenantAnimate.TryAnimateObject(args.Target, TimeSpan.FromSeconds(60));
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-trick-make-animate-description"),
Priority = (int) TricksVerbPriorities.MakeAnimate,
};
args.Verbs.Add(makeAnimate);
}
// Begin Imp Changes
if (TryComp<RevenantAnimatedComponent>(args.Target, out var animate))
{
Verb makeInanimate = new()
{
Text = "Inanimate Item",
Category = VerbCategory.Tricks,
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/Actions/inanimate.png")),
Act = () =>
{
_revenantAnimate.InanimateTarget(args.Target, animate);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-trick-make-inanimate-description"),
Priority = (int) TricksVerbPriorities.MakeInanimate,
};
args.Verbs.Add(makeInanimate);
}
// End Imp Changes
}
private void RefillEquippedTanks(EntityUid target, Gas gasType)
{
foreach (var held in _inventorySystem.GetHandOrInventoryEntities(target))
{
RefillGasTank(held, gasType);
}
}
private void RefillGasTank(EntityUid tank, Gas gasType, GasTankComponent? tankComponent = null)
{
if (!Resolve(tank, ref tankComponent, false))
return;
var mixSize = tankComponent.Air.Volume;
var newMix = new GasMixture(mixSize);
newMix.SetMoles(gasType, (1000.0f * mixSize) / (Atmospherics.R * Atmospherics.T20C)); // Fill the tank to 1000KPA.
newMix.Temperature = Atmospherics.T20C;
tankComponent.Air = newMix;
}
private bool TryGetGridChildren(EntityUid target, [NotNullWhen(true)] out IEnumerable<EntityUid>? enumerator)
{
if (!HasComp<MapComponent>(target) && !HasComp<MapGridComponent>(target) &&
!HasComp<StationDataComponent>(target))
{
enumerator = null;
return false;
}
enumerator = GetGridChildrenInner(target);
return true;
}
// ew. This finds everything supposedly on a grid.
private IEnumerable<EntityUid> GetGridChildrenInner(EntityUid target)
{
if (TryComp<StationDataComponent>(target, out var station))
{
foreach (var grid in station.Grids)
{
var enumerator = Transform(grid).ChildEnumerator;
while (enumerator.MoveNext(out var ent))
{
yield return ent;
}
}
}
else if (HasComp<MapComponent>(target))
{
var enumerator = Transform(target).ChildEnumerator;
while (enumerator.MoveNext(out var possibleGrid))
{
var enumerator2 = Transform(possibleGrid).ChildEnumerator;
while (enumerator2.MoveNext(out var ent))
{
yield return ent;
}
}
}
else
{
var enumerator = Transform(target).ChildEnumerator;
while (enumerator.MoveNext(out var ent))
{
yield return ent;
}
}
}
private EntityUid? FindActiveId(EntityUid target)
{
if (_inventorySystem.TryGetSlotEntity(target, "id", out var slotEntity))
{
if (HasComp<AccessComponent>(slotEntity))
{
return slotEntity.Value;
}
else if (TryComp<PdaComponent>(slotEntity, out var pda)
&& HasComp<IdCardComponent>(pda.ContainedId))
{
return pda.ContainedId;
}
}
else if (TryComp<HandsComponent>(target, out var hands))
{
foreach (var held in _handsSystem.EnumerateHeld((target, hands)))
{
if (HasComp<AccessComponent>(held))
{
return held;
}
}
}
return null;
}
private void GiveAllAccess(EntityUid entity)
{
var allAccess = _prototypeManager
.EnumeratePrototypes<AccessLevelPrototype>()
.Select(p => new ProtoId<AccessLevelPrototype>(p.ID)).ToArray();
_accessSystem.TrySetTags(entity, allAccess);
}
private void RevokeAllAccess(EntityUid entity)
{
_accessSystem.TrySetTags(entity, new List<ProtoId<AccessLevelPrototype>>());
}
public enum TricksVerbPriorities
{
Bolt = 0,
Unbolt = -1,
EmergencyAccessOn = -2,
EmergencyAccessOff = -3,
MakeIndestructible = -4,
MakeVulnerable = -5,
BlockUnanchoring = -6,
RefillBattery = -7,
DrainBattery = -8,
RefillOxygen = -9,
RefillNitrogen = -10,
RefillPlasma = -11,
SendToTestArena = -12,
GrantAllAccess = -13,
RevokeAllAccess = -14,
Rejuvenate = -15,
AdjustStack = -16,
FillStack = -17,
Rename = -18,
Redescribe = -19,
RenameAndRedescribe = -20,
BarJobSlots = -21,
LocateCargoShuttle = -22,
InfiniteBattery = -23,
HaltMovement = -24,
Unpause = -25,
Pause = -26,
SnapJoints = -27,
MakeMinigun = -28,
SetBulletAmount = -29,
MakeAnimate = -30, // Imp
MakeInanimate = -31, // Imp
}
}