Add MindPlaySound to role system (#21460)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -268,21 +268,16 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
|
||||
_roleSystem.MindAddRole(mindId, new TraitorRoleComponent
|
||||
{
|
||||
PrototypeId = traitorRule.TraitorPrototypeId
|
||||
});
|
||||
// Assign briefing
|
||||
}, mind);
|
||||
// Assign briefing and greeting sound
|
||||
_roleSystem.MindAddRole(mindId, new RoleBriefingComponent
|
||||
{
|
||||
Briefing = briefing
|
||||
});
|
||||
}, mind);
|
||||
_roleSystem.MindPlaySound(mindId, traitorRule.GreetSoundNotification, mind);
|
||||
SendTraitorBriefing(mindId, traitorRule.Codewords, code);
|
||||
traitorRule.TraitorMinds.Add(mindId);
|
||||
|
||||
if (_mindSystem.TryGetSession(mindId, out var session))
|
||||
{
|
||||
// Notificate player about new role assignment
|
||||
_audioSystem.PlayGlobal(traitorRule.GreetSoundNotification, session);
|
||||
}
|
||||
|
||||
// Change the faction
|
||||
_npcFaction.RemoveFaction(entity, "NanoTrasen", false);
|
||||
_npcFaction.AddFaction(entity, "Syndicate");
|
||||
|
||||
@@ -167,6 +167,7 @@ public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem
|
||||
PrototypeId = "SpaceNinja"
|
||||
};
|
||||
_role.MindAddRole(mindId, role, mind);
|
||||
_role.MindPlaySound(mindId, config.GreetingSound, mind);
|
||||
|
||||
// choose spider charge detonation point
|
||||
var warps = new List<EntityUid>();
|
||||
@@ -179,9 +180,7 @@ public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem
|
||||
if (warps.Count > 0)
|
||||
role.SpiderChargeTarget = _random.Pick(warps);
|
||||
|
||||
var session = mind.Session;
|
||||
_audio.PlayGlobal(config.GreetingSound, Filter.Empty().AddPlayer(session), false, AudioParams.Default);
|
||||
_chatMan.DispatchServerMessage(session, Loc.GetString("ninja-role-greeting"));
|
||||
_chatMan.DispatchServerMessage(mind.Session, Loc.GetString("ninja-role-greeting"));
|
||||
}
|
||||
|
||||
// TODO: PowerCellDraw, modify when cloak enabled
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Roles;
|
||||
@@ -10,6 +11,7 @@ public abstract class SharedRoleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
|
||||
// TODO please lord make role entities
|
||||
@@ -153,4 +155,14 @@ public abstract class SharedRoleSystem : EntitySystem
|
||||
{
|
||||
return _antagTypes.Contains(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play a sound for the mind, if it has a session attached.
|
||||
/// Use this for role greeting sounds.
|
||||
/// </summary>
|
||||
public void MindPlaySound(EntityUid mindId, SoundSpecifier? sound, MindComponent? mind = null)
|
||||
{
|
||||
if (Resolve(mindId, ref mind) && mind.Session != null)
|
||||
_audio.PlayGlobal(sound, mind.Session);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user