No spead merge (#475)

* Revert "[GoobPort] WIZ REAL (#465)"

This reverts commit 091a8ff433.

* fix local
This commit is contained in:
Spatison
2025-04-26 10:50:32 +03:00
committed by GitHub
parent 41606db2c5
commit 2a10c02eb5
949 changed files with 1467 additions and 42235 deletions

View File

@@ -4,10 +4,6 @@ using Content.Shared.Objectives.Components;
using Content.Shared.Roles.Jobs;
using Robust.Shared.GameObjects;
using System.Diagnostics.CodeAnalysis;
using Content.Server._Shitcode.Wizard.Components;
using Content.Server.Mind;
using Content.Shared.Mind.Components;
namespace Content.Server.Objectives.Systems;
@@ -18,16 +14,12 @@ public sealed class TargetObjectiveSystem : EntitySystem
{
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly SharedJobSystem _job = default!;
[Dependency] private readonly MindSystem _mind = default!; // Goobstation
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<TargetObjectiveComponent, ObjectiveAfterAssignEvent>(OnAfterAssign);
SubscribeLocalEvent<DynamicObjectiveTargetMindComponent, MindGotAddedEvent>(OnMindAdded); // Goobstation
SubscribeLocalEvent<EntityRenamedEvent>(OnRenamed); // Goobstation
}
private void OnAfterAssign(EntityUid uid, TargetObjectiveComponent comp, ref ObjectiveAfterAssignEvent args)
@@ -38,43 +30,6 @@ public sealed class TargetObjectiveSystem : EntitySystem
_metaData.SetEntityName(uid, GetTitle(target.Value, comp.Title), args.Meta);
}
// Goobstation start
private void OnMindAdded(Entity<DynamicObjectiveTargetMindComponent> ent, ref MindGotAddedEvent args)
{
UpdateAllDynamicObjectiveNamesWithTarget(ent.Owner);
}
private void OnRenamed(ref EntityRenamedEvent ev)
{
if (_mind.TryGetMind(ev.Uid, out var mind, out _) && HasComp<DynamicObjectiveTargetMindComponent>(mind))
UpdateAllDynamicObjectiveNamesWithTarget(mind);
}
private void UpdateAllDynamicObjectiveNamesWithTarget(EntityUid target)
{
var query = AllEntityQuery<TargetObjectiveComponent, MetaDataComponent>();
while (query.MoveNext(out var uid, out var comp, out var meta))
{
if (!comp.DynamicName || comp.Target != target)
continue;
_metaData.SetEntityName(uid, GetTitle(target, comp.Title, true, comp.ShowJobTitle), meta);
}
}
public void SetName(EntityUid uid, TargetObjectiveComponent? comp = null)
{
if (!Resolve(uid, ref comp))
return;
if (!GetTarget(uid, out var target, comp))
return;
_metaData.SetEntityName(uid, GetTitle(target.Value, comp.Title, comp.DynamicName, comp.ShowJobTitle));
}
// Goobstation end
/// <summary>
/// Sets the Target field for the title and other components to use.
/// </summary>
@@ -98,22 +53,14 @@ public sealed class TargetObjectiveSystem : EntitySystem
return target != null;
}
private string GetTitle(EntityUid target, string title, bool dynamicName = false, bool showJobTitle = true) // Goob edit
private string GetTitle(EntityUid target, string title)
{
var targetName = "Unknown";
// Goob edit start
if (TryComp<MindComponent>(target, out var mind))
if (TryComp<MindComponent>(target, out var mind) && mind.CharacterName != null)
{
if (dynamicName && TryComp(mind.OwnedEntity, out MetaDataComponent? meta))
targetName = meta.EntityName;
else if (mind.CharacterName != null)
targetName = mind.CharacterName;
targetName = mind.CharacterName;
}
if (!showJobTitle)
return Loc.GetString(title, ("targetName", targetName));
// Goob edit end
var jobName = _job.MindTryGetJobName(target);
return Loc.GetString(title, ("targetName", targetName), ("job", jobName));
}