* nasrano * Add station budget & salary * Initial balance * Vending machine UI * Pricing for vending machines * Finish economy * Eftpos * Finish eftpos * Put eftpos into lockers * Vending machine prices * Small fixes * Fix atm UI * Add atms to maps * fix * reset * Add PDA program * Maps again --------- Co-authored-by: Mona Hmiza <> Co-authored-by: rhailrake <49613070+rhailrake@users.noreply.github.com>
69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using Content.Server.Mind;
|
|
using Content.Server.Roles;
|
|
using Content.Server.Roles.Jobs;
|
|
using Content.Shared.CharacterInfo;
|
|
using Content.Shared.Objectives;
|
|
using Content.Shared.Objectives.Components;
|
|
using Content.Shared.Objectives.Systems;
|
|
|
|
namespace Content.Server.CharacterInfo;
|
|
|
|
public sealed class CharacterInfoSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly JobSystem _jobs = default!;
|
|
[Dependency] private readonly MindSystem _minds = default!;
|
|
[Dependency] private readonly RoleSystem _roles = default!;
|
|
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeNetworkEvent<RequestCharacterInfoEvent>(OnRequestCharacterInfoEvent);
|
|
}
|
|
|
|
private void OnRequestCharacterInfoEvent(RequestCharacterInfoEvent msg, EntitySessionEventArgs args)
|
|
{
|
|
if (!args.SenderSession.AttachedEntity.HasValue
|
|
|| args.SenderSession.AttachedEntity != GetEntity(msg.NetEntity))
|
|
return;
|
|
|
|
var entity = args.SenderSession.AttachedEntity.Value;
|
|
|
|
var objectives = new Dictionary<string, List<ObjectiveInfo>>();
|
|
var jobTitle = "No Profession";
|
|
var memories = new Dictionary<string, string>(); //WD EDIT
|
|
string? briefing = null;
|
|
if (_minds.TryGetMind(entity, out var mindId, out var mind))
|
|
{
|
|
// Get objectives
|
|
foreach (var objective in mind.AllObjectives)
|
|
{
|
|
var info = _objectives.GetInfo(objective, mindId, mind);
|
|
if (info == null)
|
|
continue;
|
|
|
|
// group objectives by their issuer
|
|
var issuer = Comp<ObjectiveComponent>(objective).Issuer;
|
|
if (!objectives.ContainsKey(issuer))
|
|
objectives[issuer] = new List<ObjectiveInfo>();
|
|
objectives[issuer].Add(info.Value);
|
|
}
|
|
|
|
if (_jobs.MindTryGetJobName(mindId, out var jobName))
|
|
jobTitle = jobName;
|
|
|
|
// Get briefing
|
|
briefing = _roles.MindGetBriefing(mindId);
|
|
|
|
// WD EDIT Get memories
|
|
foreach (var memory in mind.AllMemories)
|
|
{
|
|
memories[memory.Name] = memory.Value;
|
|
}
|
|
}
|
|
|
|
RaiseNetworkEvent(new CharacterInfoEvent(GetNetEntity(entity), jobTitle, objectives, briefing, memories), args.SenderSession);
|
|
}
|
|
}
|