Увы
This commit is contained in:
46
Content.Server/_Honk/Aspects/AlasAccentAspect.cs
Normal file
46
Content.Server/_Honk/Aspects/AlasAccentAspect.cs
Normal file
@@ -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 AlasAccentAspect : AspectSystem<AlasAccentAspectComponent>
|
||||||
|
{
|
||||||
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(HandleLateJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Started(EntityUid uid, AlasAccentAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
||||||
|
{
|
||||||
|
base.Started(uid, component, gameRule, args);
|
||||||
|
var query = EntityQueryEnumerator<MindContainerComponent>();
|
||||||
|
|
||||||
|
while (query.MoveNext(out var ent, out _))
|
||||||
|
{
|
||||||
|
EntityManager.EnsureComponent<AlasAccentComponent>(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleLateJoin(PlayerSpawnCompleteEvent ev)
|
||||||
|
{
|
||||||
|
var query = EntityQueryEnumerator<AlasAccentAspectComponent, GameRuleComponent>();
|
||||||
|
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<AlasAccentComponent>(mob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Content.Server._Honk.AspectsSystem.Aspects.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class AlasAccentAspectComponent : Component
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Content.Server._Honk.Speech.EntitySystems;
|
||||||
|
|
||||||
|
namespace Content.Server._Honk.Speech.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
[Access(typeof(AlasAccentSystem))]
|
||||||
|
public sealed partial class AlasAccentComponent : Component
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Content.Server._Honk.Speech.Components;
|
||||||
|
using Content.Server.Speech;
|
||||||
|
using Content.Server.Speech.EntitySystems;
|
||||||
|
|
||||||
|
namespace Content.Server._Honk.Speech.EntitySystems;
|
||||||
|
|
||||||
|
public sealed class AlasAccentSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly ReplacementAccentSystem _replacement = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<AlasAccentComponent, AccentGetEvent>(OnAccent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAccent(EntityUid uid, AlasAccentComponent component, AccentGetEvent args)
|
||||||
|
{
|
||||||
|
var message = args.Message;
|
||||||
|
|
||||||
|
message = _replacement.ApplyReplacements(message, "alas");
|
||||||
|
|
||||||
|
var words = message.Split();
|
||||||
|
if (words.Length > 3)
|
||||||
|
{
|
||||||
|
var lastWord = words.Last();
|
||||||
|
var modificator = "";
|
||||||
|
switch (lastWord.Last())
|
||||||
|
{
|
||||||
|
case '.':
|
||||||
|
modificator = @" Увы.";
|
||||||
|
break;
|
||||||
|
case ',':
|
||||||
|
modificator = @" увы.";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
modificator = @", увы.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
message = message + modificator;
|
||||||
|
}
|
||||||
|
|
||||||
|
args.Message = message;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -10,3 +10,16 @@
|
|||||||
startAudio:
|
startAudio:
|
||||||
path: /Audio/White/Aspects/accent.ogg
|
path: /Audio/White/Aspects/accent.ogg
|
||||||
- type: CaucasianAccentAspect
|
- type: CaucasianAccentAspect
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: AlasAccentAspect
|
||||||
|
parent: BaseGameRule
|
||||||
|
noSpawn: true
|
||||||
|
components:
|
||||||
|
- type: Aspect
|
||||||
|
name: "Увы"
|
||||||
|
description: "Экипаж станции преисполнился осознанием бытия. Все проблемы в жизни, вся повседневная суета - это слишком тяжёло, увы."
|
||||||
|
weight: 3
|
||||||
|
startAudio:
|
||||||
|
path: /Audio/White/Aspects/accent.ogg
|
||||||
|
- type: AlasAccentAspect
|
||||||
|
|||||||
Reference in New Issue
Block a user