Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
trest100 committed Dec 21, 2024
1 parent d7cc749 commit 97187a6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Content.Server/TapeRecorder/TapeRecorderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using System.Text;
using Content.Shared.Backmen.Chat;

namespace Content.Server.TapeRecorder;

Expand All @@ -34,7 +35,10 @@ public override void Initialize()
/// Given a time range, play all messages on a tape within said range, [start, end).
/// Split into this system as shared does not have ChatSystem access
/// </summary>
protected override void ReplayMessagesInSegment(Entity<TapeRecorderComponent> ent, TapeCassetteComponent tape, float segmentStart, float segmentEnd)
protected override void ReplayMessagesInSegment(Entity<TapeRecorderComponent> ent,
TapeCassetteComponent tape,
float segmentStart,
float segmentEnd)
{
var voice = EnsureComp<VoiceOverrideComponent>(ent);
var speech = EnsureComp<SpeechComponent>(ent);
Expand Down Expand Up @@ -79,7 +83,10 @@ private void OnListen(Entity<TapeRecorderComponent> ent, ref ListenEvent args)
//Add a new entry to the tape
var verb = _chat.GetSpeechVerb(args.Source, args.Message);
var name = nameEv.VoiceName;
cassette.Comp.Buffer.Add(new TapeCassetteRecordedMessage(cassette.Comp.CurrentPosition, name, verb, args.Message));
cassette.Comp.Buffer.Add(new TapeCassetteRecordedMessage(cassette.Comp.CurrentPosition,
name,
verb,
args.Message));
}

private void OnPrintMessage(Entity<TapeRecorderComponent> ent, ref PrintTapeRecorderMessage args)
Expand All @@ -98,7 +105,7 @@ private void OnPrintMessage(Entity<TapeRecorderComponent> ent, ref PrintTapeReco
// Sorting list by time for overwrite order
// TODO: why is this needed? why wouldn't it be stored in order
var data = cassette.Comp.RecordedData;
data.Sort((x,y) => x.Timestamp.CompareTo(y.Timestamp));
data.Sort((x, y) => x.Timestamp.CompareTo(y.Timestamp));

// Looking if player's entity exists to give paper in its hand
var player = args.Actor;
Expand All @@ -115,13 +122,14 @@ private void OnPrintMessage(Entity<TapeRecorderComponent> ent, ref PrintTapeReco
foreach (var message in cassette.Comp.RecordedData)
{
var name = message.Name ?? ent.Comp.DefaultName;
var time = TimeSpan.FromSeconds((double) message.Timestamp);
var time = TimeSpan.FromSeconds((double)message.Timestamp);

text.AppendLine(Loc.GetString("tape-recorder-print-message-text",
("time", time.ToString(@"hh\:mm\:ss")),
("source", name),
("message", message.Message)));
}

text.AppendLine();
text.Append(Loc.GetString("tape-recorder-print-end-text"));

Expand Down

0 comments on commit 97187a6

Please sign in to comment.