diff --git a/Content.Server/_Honk/Aspects/CaucasianAccentAspect.cs b/Content.Server/_Honk/Aspects/CaucasianAccentAspect.cs new file mode 100644 index 0000000000..c55720262d --- /dev/null +++ b/Content.Server/_Honk/Aspects/CaucasianAccentAspect.cs @@ -0,0 +1,46 @@ +using Content.Server.GameTicking; +using Content.Server.GameTicking.Components; +using Content.Server._Honk.Speech.Components; +using Content.Server._Honk.AspectsSystem.Aspects.Components; +using Content.Server._White.AspectsSystem.Base; +using Content.Shared.Mind.Components; +using Robust.Shared.Random; + +namespace Content.Server._Honk.Aspects; + +public sealed class CaucasianAccentAspect : AspectSystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(HandleLateJoin); + } + + protected override void Started(EntityUid uid, CaucasianAccentAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) + { + base.Started(uid, component, gameRule, args); + var query = EntityQueryEnumerator(); + + while (query.MoveNext(out var ent, out _)) + { + EntityManager.EnsureComponent(ent); + } + } + + private void HandleLateJoin(PlayerSpawnCompleteEvent ev) + { + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ruleEntity, out _, out var gameRule)) + { + if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) + continue; + + if (!ev.LateJoin) + return; + + var mob = ev.Mob; + EntityManager.EnsureComponent(mob); + } + } +} diff --git a/Content.Server/_Honk/Aspects/Component/CaucasianAccentAspectComponent.cs b/Content.Server/_Honk/Aspects/Component/CaucasianAccentAspectComponent.cs new file mode 100644 index 0000000000..c49c10fde7 --- /dev/null +++ b/Content.Server/_Honk/Aspects/Component/CaucasianAccentAspectComponent.cs @@ -0,0 +1,6 @@ +namespace Content.Server._Honk.AspectsSystem.Aspects.Components; + +[RegisterComponent] +public sealed partial class CaucasianAccentAspectComponent : Component +{ +} diff --git a/Resources/Prototypes/_Honk/Aspects/Aspects.yml b/Resources/Prototypes/_Honk/Aspects/Aspects.yml new file mode 100644 index 0000000000..aaa0725c1e --- /dev/null +++ b/Resources/Prototypes/_Honk/Aspects/Aspects.yml @@ -0,0 +1,12 @@ +- type: entity + id: CaucasianAccentAspect + parent: BaseGameRule + noSpawn: true + components: + - type: Aspect + name: "Ежжи брат" + description: "Всэгда интэрэсно, какой ежжи брат вы услишитэ слэдующим." + weight: 3 + startAudio: + path: /Audio/White/Aspects/accent.ogg + - type: CaucasianAccentAspect