mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 16:17:27 +00:00
* feat: added lslaws command * feat: add lswatchlisted command * tweak: nicer formatting for lswatchlisted * tweak: nicer formatting for lslaws * feat: lsobjectives lists everyone's objectives if no user specified * feat: mark ghosted players in players tab * docs: add missing DeltaV patch comment * feat: only alert admins if meatspiking player characters * feat: always alert about station explosions, don't spam off-station alerts * feat: stripping alert tweaks * feat: admin alert on low hour latejoin * refactor: forgot to make onspawncomplete non-async, wasn't necessary after all * feat: EORG alerts * feat: getping command * refactor: remove unused imports, format * refactor: early return in onspawncomplete * feat: add coordinate link to eorg destroy alert * tweak: cache watchlist data to avoid db calls, use in lswatchlisted * fix: null-check in OnNoteAdded * feat: watchlist indicator on admin overlay * feat: optionally mark watchlisted in f7 players * feat: refresh admin playerlist data on wl change * fix: update player list after cache write * feat: add tp links to prayer messages * tweak: don't alert when uncuffing self * tweak: lower uncuff other alert impact if mindshielded * docs: add deltav comments to imports * refactor: address review comments * style: deltav comments on same line as change * performance: get metadata only if objectives > 0 * fix: actually check user if explosion gridPos not on station * style: remove extraneous newlines * refactor: use fancy getOrNew method * feat: refresh player list UI if marking pref changed * feat: latejoin alert hours configurable * fix: also list objectives for non-humanoids and dead people
123 lines
4.5 KiB
C#
123 lines
4.5 KiB
C#
using System.Linq;
|
|
using Content.Server.Administration;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Mind;
|
|
using Content.Shared.Objectives.Systems;
|
|
using Content.Shared.Players;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Objectives.Commands
|
|
{
|
|
[AdminCommand(AdminFlags.Logs)]
|
|
public sealed class ListObjectivesCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private readonly IEntityManager _entities = default!;
|
|
[Dependency] private readonly IPlayerManager _players = default!;
|
|
|
|
public override string Command => "lsobjectives";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
ICommonSession? player;
|
|
if (args.Length > 0)
|
|
_players.TryGetSessionByUsername(args[0], out player);
|
|
else
|
|
{
|
|
// DeltaV - Print everyone's objectives START
|
|
// previously: player = shell.Player
|
|
// implemented like this to make it easier to rip out later
|
|
ListAllObjectives(shell);
|
|
return;
|
|
// DeltaV - Print everyone's objectives END
|
|
}
|
|
|
|
if (player == null)
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString("shell-target-player-does-not-exist"));
|
|
return;
|
|
}
|
|
|
|
var minds = _entities.System<SharedMindSystem>();
|
|
if (!minds.TryGetMind(player, out var mindId, out var mind))
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString("shell-target-entity-does-not-have-message", ("missing", "mind")));
|
|
return;
|
|
}
|
|
|
|
shell.WriteLine($"Objectives for player {player.UserId}:");
|
|
var objectives = mind.Objectives.ToList();
|
|
if (objectives.Count == 0)
|
|
{
|
|
shell.WriteLine("None.");
|
|
}
|
|
|
|
var objectivesSystem = _entities.System<SharedObjectivesSystem>();
|
|
for (var i = 0; i < objectives.Count; i++)
|
|
{
|
|
var info = objectivesSystem.GetInfo(objectives[i], mindId, mind);
|
|
if (info == null)
|
|
{
|
|
shell.WriteLine($"- [{i}] {objectives[i]} - INVALID");
|
|
}
|
|
else
|
|
{
|
|
|
|
var progress = (int) (info.Value.Progress * 100f);
|
|
shell.WriteLine($"- [{i}] {objectives[i]} ({info.Value.Title}) ({progress}%)");
|
|
}
|
|
}
|
|
}
|
|
|
|
// DeltaV - Added function START
|
|
private void ListAllObjectives(IConsoleShell shell)
|
|
{
|
|
var minds = _entities.EntityQueryEnumerator<MindComponent>();
|
|
while (minds.MoveNext(out var mindId, out var mindComp))
|
|
{
|
|
ICommonSession? player = null;
|
|
if (mindComp.OwnedEntity is not null)
|
|
{
|
|
_players.TryGetSessionByEntity(mindComp.OwnedEntity.Value, out player);
|
|
}
|
|
|
|
if (mindComp.Objectives.Count > 0)
|
|
{
|
|
_entities.TryGetComponent<MetaDataComponent>(mindComp.OwnedEntity, out var metaData);
|
|
shell.WriteMarkup($"\n[bold]{metaData?.EntityName}[/bold] ({player?.Name ?? "No player attached?"})");
|
|
|
|
var objectivesSystem = _entities.System<SharedObjectivesSystem>();
|
|
var objectives = mindComp.Objectives;
|
|
|
|
for (var i = 0; i < objectives.Count; i++)
|
|
{
|
|
var info = objectivesSystem.GetInfo(objectives[i], mindId);
|
|
if (info == null)
|
|
{
|
|
shell.WriteLine($"- [{i}] {objectives[i]} - INVALID");
|
|
}
|
|
else
|
|
{
|
|
|
|
var progress = (int) (info.Value.Progress * 100f);
|
|
shell.WriteLine($"- [{i}] {objectives[i]} ({info.Value.Title}) ({progress}%)");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// DeltaV - Added function END
|
|
|
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
|
{
|
|
if (args.Length == 1)
|
|
{
|
|
return CompletionResult.FromHintOptions(CompletionHelper.SessionNames(), LocalizationManager.GetString("shell-argument-username-hint"));
|
|
}
|
|
|
|
return CompletionResult.Empty;
|
|
}
|
|
}
|
|
}
|