LabAPI icon indicating copy to clipboard operation
LabAPI copied to clipboard

[BUG] OnPlayerUpdatedEffect doesn't accurately give duration

Open CasualVideoGameEnjoyer opened this issue 1 year ago • 1 comments

This is very similar to another bug report I made, but this is a separate bug

When an effect is changed, it calls StatusEffectBase::ServerSetState which in turn does

  1. this.Intensity = intensity;
  2. this.ServerChangeDuration(duration, addDuration);

The actual event for updating an effect is called in StatusEffectBase::ForceIntensity which is invoked by the Intensity setter The UpdatedEffect event called in ForceIntensity grabs this.Duration for ev.Duration which gives a stale duration as StatusEffectBase::ServerChangeDuration has not been called yet.

The fix is quite simple, just change the order of the code in StatusEffectBase::ServerSetState and it'll work as intended.

CasualVideoGameEnjoyer avatar Aug 07 '25 00:08 CasualVideoGameEnjoyer

This is very similar to another bug report I made, but this is a separate bug

When an effect is changed, it calls StatusEffectBase::ServerSetState which in turn does

1. `this.Intensity = intensity;`

2. `this.ServerChangeDuration(duration, addDuration);`

The actual event for updating an effect is called in StatusEffectBase::ForceIntensity which is invoked by the Intensity setter The UpdatedEffect event called in ForceIntensity grabs this.Duration for ev.Duration which gives a stale duration as StatusEffectBase::ServerChangeDuration has not been called yet.

The fix is quite simple, just change the order of the code in StatusEffectBase::ServerSetState and it'll work as intended.

That not the only things they should use TimeLeft instead of Duration

louis1706 avatar Dec 27 '25 15:12 louis1706