Objectives ecs rework (#19967)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-09-16 07:18:10 +01:00
committed by GitHub
parent e8c58d1574
commit f7711edbe3
106 changed files with 2121 additions and 1779 deletions

View File

@@ -2,6 +2,7 @@ using System.Linq;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Objectives.Systems;
using Robust.Server.Player;
using Robust.Shared.Console;
@@ -25,7 +26,7 @@ namespace Content.Server.Objectives.Commands
}
var minds = _entities.System<SharedMindSystem>();
if (!minds.TryGetMind(player, out _, out var mind))
if (!minds.TryGetMind(player, out var mindId, out var mind))
{
shell.WriteError(LocalizationManager.GetString("shell-target-entity-does-not-have-message", ("missing", "mind")));
return;
@@ -38,9 +39,20 @@ namespace Content.Server.Objectives.Commands
shell.WriteLine("None.");
}
var objectivesSystem = _entities.System<SharedObjectivesSystem>();
for (var i = 0; i < objectives.Count; i++)
{
shell.WriteLine($"- [{i}] {objectives[i].Conditions[0].Title}");
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}%)");
}
}
}