Skip to content

Commit

Permalink
разделил
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 committed Sep 1, 2024
1 parent 66231d8 commit d56c374
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
42 changes: 42 additions & 0 deletions Content.Server/ADT/AutoPostingChat/AutoEmotePostingChatSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Content.Shared.Mobs;
using Content.Server.Chat.Systems;
using Content.Shared.ADT.AutoPostingChat;
using Robust.Shared.Timing;
public sealed class AutoEmotePostingChatSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly IGameTiming _time = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AutoEmotePostingChatComponent, MobStateChangedEvent>(OnMobState);
}
/// <summary>
/// On death removes active comps and gives genetic damage to prevent cloning, reduce this to allow cloning.
/// </summary>
private void OnMobState(EntityUid uid, AutoEmotePostingChatComponent component, MobStateChangedEvent args)
{
if (args.NewMobState == MobState.Dead || component == null)
{
RemComp<AutoEmotePostingChatComponent>(uid);
}
}
public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<AutoEmotePostingChatComponent>();
while (query.MoveNext(out var uid, out var comp))
{
if (_time.CurTime >= comp.NextSecond)
{
if (comp.PostingMessageEmote != null)
{
_chat.TrySendInGameICMessage(uid, comp.PostingMessageEmote, InGameICChatType.Speak, ChatTransmitRange.Normal);
}

comp.NextSecond = _time.CurTime + TimeSpan.FromSeconds(comp.EmoteTimerRead);
}
}
}
}
14 changes: 1 addition & 13 deletions Content.Server/ADT/AutoPostingChat/AutoSpeakPostingChatSystem.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
using Content.Shared.Mobs;
using Content.Server.Chat.Systems;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Damage;
using Robust.Shared.Prototypes;
using Content.Server.Emoting.Systems;
using Content.Server.Speech.EntitySystems;
using Content.Shared.ADT.AutoPostingChat;
using Content.Shared.Interaction.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using System.Timers;
using System.ComponentModel;
using System.Linq;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
public sealed class AutoPostingChatSystem : EntitySystem
public sealed class AutoSpeakPostingChatSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly IGameTiming _time = default!;
Expand Down

0 comments on commit d56c374

Please sign in to comment.