Skip to content

Commit

Permalink
fix compile errors and a few reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
dffdff2423 committed Jan 7, 2025
1 parent 98b6a41 commit 1cc84e1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Content.Server/_CD/TapeRecorder/TapeRecorderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override void ReplayMessagesInSegment(Entity<TapeRecorderComponent> en
voice.NameOverride = message.Name ?? ent.Comp.DefaultName;
// TODO: mimic the exact string chosen when the message was recorded
var verb = message.Verb ?? SharedChatSystem.DefaultSpeechVerb;
speech.SpeechVerb = _proto.Index<SpeechVerbPrototype>;
speech.SpeechVerb = _proto.Index(verb);
// Play the message
_chat.TrySendInGameICMessage(ent, message.Message, InGameICChatType.Speak, false);
}
Expand Down
32 changes: 11 additions & 21 deletions Content.Shared/_CD/TapeRecorder/Events/TapeRecorderEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,17 @@ public sealed class ChangeModeTapeRecorderMessage(TapeRecorderMode mode) : Bound
public sealed class PrintTapeRecorderMessage : BoundUserInterfaceMessage;

[Serializable, NetSerializable]
public sealed class TapeRecorderState : BoundUserInterfaceState
public sealed class TapeRecorderState(
bool hasCassette,
float currentTime,
float maxTime,
string cassetteName,
TimeSpan printCooldown): BoundUserInterfaceState
{
// TODO: check the itemslot on client instead of putting easy cassette stuff in the state
public bool HasCassette;
public float CurrentTime;
public float MaxTime;
public string CassetteName;
public TimeSpan PrintCooldown;

public TapeRecorderState(
bool hasCassette,
bool hasData,
float currentTime,
float maxTime,
string cassetteName,
TimeSpan printCooldown)
{
HasCassette = hasCassette;
CurrentTime = currentTime;
MaxTime = maxTime;
CassetteName = cassetteName;
PrintCooldown = printCooldown;
}
public bool HasCassette = hasCassette;
public float CurrentTime = currentTime;
public float MaxTime = maxTime;
public string CassetteName = cassetteName;
public TimeSpan PrintCooldown = printCooldown;
}
25 changes: 12 additions & 13 deletions Content.Shared/_CD/TapeRecorder/SharedTapeRecorderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class SharedTapeRecorderSystem : EntitySystem
[Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] protected readonly SharedAudioSystem Audio = default!;

private protected const string SlotName = "cassette_tape";
private const string SlotName = "cassette_tape";

public override void Initialize()
{
Expand Down Expand Up @@ -177,7 +177,7 @@ protected virtual void ReplayMessagesInSegment(Entity<TapeRecorderComponent> ent
/// <summary>
/// Start repairing a damaged tape when using a screwdriver or pen on it
/// </summary>
private protected void OnInteractingWithCassette(Entity<TapeCassetteComponent> ent, ref InteractUsingEvent args)
private void OnInteractingWithCassette(Entity<TapeCassetteComponent> ent, ref InteractUsingEvent args)
{
// Is the tape damaged?
if (HasComp<FitsInTapeRecorderComponent>(ent))
Expand All @@ -197,7 +197,7 @@ private protected void OnInteractingWithCassette(Entity<TapeCassetteComponent> e
/// <summary>
/// Repair a damaged tape
/// </summary>
private protected void OnTapeCassetteRepair(Entity<TapeCassetteComponent> ent, ref TapeCassetteRepairDoAfterEvent args)
private void OnTapeCassetteRepair(Entity<TapeCassetteComponent> ent, ref TapeCassetteRepairDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null)
return;
Expand All @@ -214,7 +214,7 @@ private protected void OnTapeCassetteRepair(Entity<TapeCassetteComponent> ent, r
/// <summary>
/// When the cassette has been damaged, corrupt and entry and unspool it
/// </summary>
private protected void OnDamagedChanged(Entity<TapeCassetteComponent> ent, ref DamageChangedEvent args)
private void OnDamagedChanged(Entity<TapeCassetteComponent> ent, ref DamageChangedEvent args)
{
if (args.DamageDelta == null || args.DamageDelta.GetTotal() < 5)
return;
Expand All @@ -225,7 +225,7 @@ private protected void OnDamagedChanged(Entity<TapeCassetteComponent> ent, ref D
CorruptRandomEntry(ent);
}

private protected void OnTapeExamined(Entity<TapeCassetteComponent> ent, ref ExaminedEvent args)
private void OnTapeExamined(Entity<TapeCassetteComponent> ent, ref ExaminedEvent args)
{
if (!args.IsInDetailsRange)
return;
Expand All @@ -241,7 +241,7 @@ private protected void OnTapeExamined(Entity<TapeCassetteComponent> ent, ref Exa
args.PushMarkup(tapePosMsg);
}

private protected void OnRecorderExamined(Entity<TapeRecorderComponent> ent, ref ExaminedEvent args)
private void OnRecorderExamined(Entity<TapeRecorderComponent> ent, ref ExaminedEvent args)
{
if (!args.IsInDetailsRange)
return;
Expand All @@ -268,22 +268,22 @@ private protected void OnRecorderExamined(Entity<TapeRecorderComponent> ent, ref
/// <summary>
/// Prevent removing the tape cassette while the recorder is active
/// </summary>
private protected void OnCassetteRemoveAttempt(Entity<TapeRecorderComponent> ent, ref ItemSlotEjectAttemptEvent args)
private void OnCassetteRemoveAttempt(Entity<TapeRecorderComponent> ent, ref ItemSlotEjectAttemptEvent args)
{
if (!HasComp<ActiveTapeRecorderComponent>(ent))
return;

args.Cancelled = true;
}

private protected void OnCassetteRemoved(Entity<TapeRecorderComponent> ent, ref EntRemovedFromContainerMessage args)
private void OnCassetteRemoved(Entity<TapeRecorderComponent> ent, ref EntRemovedFromContainerMessage args)
{
SetMode(ent, TapeRecorderMode.Stopped);
UpdateAppearance(ent);
UpdateUI(ent);
}

private protected void OnCassetteInserted(Entity<TapeRecorderComponent> ent, ref EntInsertedIntoContainerMessage args)
private void OnCassetteInserted(Entity<TapeRecorderComponent> ent, ref EntInsertedIntoContainerMessage args)
{
UpdateAppearance(ent);
UpdateUI(ent);
Expand All @@ -293,7 +293,7 @@ private protected void OnCassetteInserted(Entity<TapeRecorderComponent> ent, ref
/// Update the appearance of the tape recorder.
/// </summary>
/// <param name="ent">The tape recorder to update</param>
private protected void UpdateAppearance(Entity<TapeRecorderComponent> ent)
private void UpdateAppearance(Entity<TapeRecorderComponent> ent)
{
var hasCassette = TryGetTapeCassette(ent, out _);
_appearance.SetData(ent, TapeRecorderVisuals.Mode, ent.Comp.Mode);
Expand All @@ -303,7 +303,7 @@ private protected void UpdateAppearance(Entity<TapeRecorderComponent> ent)
/// <summary>
/// Choose a random recorded entry on the cassette and replace some of the text with hashes
/// </summary>
private protected void CorruptRandomEntry(TapeCassetteComponent tape)
private void CorruptRandomEntry(TapeCassetteComponent tape)
{
if (tape.RecordedData.Count == 0)
return;
Expand Down Expand Up @@ -362,7 +362,7 @@ private void SetMode(Entity<TapeRecorderComponent> ent, TapeRecorderMode mode)
UpdateUI(ent);
}

private protected bool TryGetTapeCassette(EntityUid ent, out Entity<TapeCassetteComponent> tape)
protected bool TryGetTapeCassette(EntityUid ent, out Entity<TapeCassetteComponent> tape)
{
if (_slots.GetItemOrNull(ent, SlotName) is not {} cassette)
{
Expand Down Expand Up @@ -408,7 +408,6 @@ private void UpdateUI(Entity<TapeRecorderComponent> ent)

var state = new TapeRecorderState(
hasCassette,
hasData,
currentTime,
maxTime,
cassetteName,
Expand Down

0 comments on commit 1cc84e1

Please sign in to comment.