mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* Scope creep my ass * why was this shit not pushed???? * gone... * fix that * review plus buildd * asfsafsafsafsafas * grug * burber * I'll fix this later * shrimply die * also this * it's snerf or snuthin * assaads * round snend * aaaa * fix this shit for real * actually, don't start GameRules until MapInit now that I think aboot it. * forgot u * don't actually need this part nullable * Deffer comp removal * one liner * do that too * chungus * Honestly makes more sense here, plus WHY are we doing all that shit on "GameRuleAdded" rather than GameRuleStarted(?) * deferred removal :V * aaaaaaaaaaaaaaa * whhop * Whoop * better * landmine that I placed for myself then forgot about lmao * cleanup * FUCKING `!` * gotovo * amogus * please don't check by metadata I beg * waawsasfdfsasfa * sfafsasfafsas * fdsaasffsasfa * code * fix * fasasffasfasfsad * chungaas * I may be stupid * gra * graaaaaaaaaaaaaaaaa * comment * gra * clearing is not predicted and would require major refactors, so don't cache on client. * lame shit :P * last holes * nukeopsfsafsasafsfafsa * why was that shit public bruh * bubrbgwahrghfaka * dynamic * revert change that did nothing lmao
87 lines
2.9 KiB
C#
87 lines
2.9 KiB
C#
using Content.Server.Chat.Managers;
|
|
using Content.Shared.Administration.Logs;
|
|
using Content.Shared.Chat;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Mind;
|
|
using Content.Shared.Roles;
|
|
using Robust.Shared.Network;
|
|
|
|
namespace Content.Server.Roles;
|
|
|
|
public sealed partial class RoleSystem : SharedRoleSystem
|
|
{
|
|
[Dependency] private ISharedAdminLogManager _adminLogger = default!;
|
|
[Dependency] private IChatManager _chat = default!;
|
|
|
|
public string? MindGetBriefing(EntityUid? mindId)
|
|
{
|
|
if (mindId == null)
|
|
{
|
|
Log.Error($"MindGetBriefing failed for mind {mindId}");
|
|
return null;
|
|
}
|
|
|
|
TryComp<MindComponent>(mindId.Value, out var mindComp);
|
|
|
|
if (mindComp is null)
|
|
{
|
|
Log.Error($"MindGetBriefing failed for mind {mindId}");
|
|
return null;
|
|
}
|
|
|
|
var ev = new GetBriefingEvent();
|
|
|
|
// This is on the event because while this Entity<T> is also present on every Mind Role Entity's MindRoleComp
|
|
// getting to there from a GetBriefing event subscription can be somewhat boilerplate
|
|
// and this needs to be looked up for the event anyway so why calculate it again later
|
|
ev.Mind = (mindId.Value, mindComp);
|
|
|
|
// Briefing is no longer raised on the mind entity itself
|
|
// because all the components that briefings subscribe to should be on Mind Role Entities
|
|
foreach (var role in mindComp.MindRoleContainer.ContainedEntities)
|
|
{
|
|
RaiseLocalEvent(role, ref ev);
|
|
}
|
|
|
|
return ev.Briefing;
|
|
}
|
|
|
|
public void RoleUpdateMessage(MindComponent mind)
|
|
{
|
|
if (!Player.TryGetSessionById(mind.UserId, out var session))
|
|
return;
|
|
|
|
if (!ProtoMan.Resolve(mind.RoleType, out var proto))
|
|
return;
|
|
|
|
var roleText = Loc.GetString(proto.Name);
|
|
var color = proto.Color;
|
|
|
|
//TODO add audio? Would need to be optional so it does not play on role changes that already come with their own audio
|
|
// _audio.PlayGlobal(Sound, session);
|
|
|
|
var message = Loc.GetString("role-type-update-message", ("color", color), ("role", roleText));
|
|
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message));
|
|
_chat.ChatMessageToOne(ChatChannel.Server,
|
|
message,
|
|
wrappedMessage,
|
|
default,
|
|
false,
|
|
session.Channel);
|
|
}
|
|
|
|
protected override void UpdateCharacterWindow(NetUserId? user, MindStringRepresentation mindString)
|
|
{
|
|
if (Player.TryGetSessionById(user, out var session))
|
|
{
|
|
RaiseNetworkEvent(new MindRoleTypeChangedEvent(), session.Channel);
|
|
}
|
|
else
|
|
{
|
|
_adminLogger.Add(
|
|
LogType.Mind,
|
|
LogImpact.Medium,
|
|
$"The Character Window of {mindString} potentially did not update immediately : session error");
|
|
}
|
|
}
|
|
}
|