Skip to content

Commit

Permalink
narcolepsy updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyndomen committed Jan 7, 2025
1 parent 32ea336 commit 22a75ae
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Content.Server/Traits/Assorted/NarcolepsySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed class NarcolepsySystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popups = default!; // DeltaV Narcolepsy port from EE
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; // DeltaV

/// <inheritdoc/>
public override void Initialize()
Expand All @@ -32,7 +32,7 @@ private void SetupNarcolepsy(EntityUid uid, NarcolepsyComponent component, Compo
PrepareNextIncident((uid, component));
}

private void OnSleepChanged(Entity<NarcolepsyComponent> ent, ref SleepStateChangedEvent args)
private void OnSleepChanged(Entity<NarcolepsyComponent> ent, ref SleepStateChangedEvent args) // DeltaV
{
// When falling asleep while an incident is nigh, force it to happen immediately.
if (args.FellAsleep)
Expand All @@ -47,15 +47,15 @@ private void OnSleepChanged(Entity<NarcolepsyComponent> ent, ref SleepStateChang
}
}

public void AdjustNarcolepsyTimer(EntityUid uid, float setTime, NarcolepsyComponent? narcolepsy = null)
public void AdjustNarcolepsyTimer(EntityUid uid, float setTime, NarcolepsyComponent? narcolepsy = null) // DeltaV changed int to float
{
if (!Resolve(uid, ref narcolepsy, false) || narcolepsy.NextIncidentTime > setTime)
return;

narcolepsy.NextIncidentTime = setTime;
}

public override void Update(float frameTime)
public override void Update(float frameTime) // Begin DeltaV
{
base.Update(frameTime);

Expand Down Expand Up @@ -120,6 +120,6 @@ private void DoWakeupPopup(EntityUid ent)
private void DoWarningPopup(EntityUid ent)
{
_popups.PopupEntity(GetRandomWarning(),ent,ent);
}
} // End DeltaV

}
8 changes: 5 additions & 3 deletions Content.Shared/Bed/Sleep/SleepingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ public sealed partial class SleepingComponent : Component
/// <summary> // DeltaV begin port Narcolepsy from EE
/// The moment this entity went to sleep. Initialized on MapInit.
/// </summary>
[DataField("SleepingSince", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] // # DeltaV begin Narcolepsy port from EE
[AutoPausedField]
public TimeSpan SleepingSince; // DeltaV end port Narcolepsy from EE
///
/// DeltaV: The moment this entity went to sleep. Initialized on MapInit.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan SleepingSince;

/// <summary>
/// Sound to play when another player attempts to wake this entity.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- type: localizedDataset
id: NarcolepsyWakeupDataset
id: NarcolepsyWakeup
values:
prefix: narcolepsy-wakeup-
count: 3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- type: localizedDataset
id: NarcolepsyWarningDataset
id: NarcolepsyWarning
values:
prefix: narcolepsy-warning-
count: 5

0 comments on commit 22a75ae

Please sign in to comment.