Skip to content

Commit

Permalink
Avoid using EntityUid as a networked dictionary's key until hotfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyyapril committed Dec 22, 2024
1 parent 032c4eb commit ace7412
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Content.Shared/Damage/Components/StaminaComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public sealed partial class StaminaComponent : Component
/// DrainRate how much it changes per tick, and ModifiesSpeed if it should slow down the user.
/// </summary>
[DataField, AutoNetworkedField]
public Dictionary<EntityUid, (float DrainRate, bool ModifiesSpeed)> ActiveDrains = new();
public Dictionary<NetEntity, (float DrainRate, bool ModifiesSpeed)> ActiveDrains = new();

/// <summary>
/// How long will this mob be stunned for?
Expand Down
14 changes: 7 additions & 7 deletions Content.Shared/Damage/Systems/StaminaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public void ToggleStaminaDrain(EntityUid target, float drainRate, bool enabled,
return;

// If theres no source, we assume its the target that caused the drain.
var actualSource = source ?? target;
var actualSource = GetNetEntity(source) ?? GetNetEntity(target);

if (enabled)
{
Expand Down Expand Up @@ -368,11 +368,11 @@ public override void Update(float frameTime)
if (comp.ActiveDrains.Count > 0)
foreach (var (source, (drainRate, modifiesSpeed)) in comp.ActiveDrains)
TakeStaminaDamage(uid,
drainRate * frameTime,
comp,
source: source,
visual: false,
allowsSlowdown: modifiesSpeed);
drainRate * frameTime,
comp,
source: GetEntity(source),
visual: false,
allowsSlowdown: modifiesSpeed);
// Shouldn't need to consider paused time as we're only iterating non-paused stamina components.
var nextUpdate = comp.NextUpdate;

Expand Down Expand Up @@ -433,4 +433,4 @@ private void ExitStamCrit(EntityUid uid, StaminaComponent? component = null)
/// Raised before stamina damage is dealt to allow other systems to cancel it.
/// </summary>
[ByRefEvent]
public record struct BeforeStaminaDamageEvent(float Value, bool Cancelled = false);
public record struct BeforeStaminaDamageEvent(float Value, bool Cancelled = false);

0 comments on commit ace7412

Please sign in to comment.