Climbing refactor (#20516)

This commit is contained in:
metalgearsloth
2023-10-11 10:41:11 +11:00
committed by GitHub
parent ab75941bc0
commit edbfef22d6
30 changed files with 637 additions and 661 deletions

View File

@@ -43,7 +43,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
doAfter.CancelledTime = doAfter.CancelledTime.Value + args.PausedTime;
}
Dirty(component);
Dirty(uid, component);
}
private void OnStateChanged(EntityUid uid, DoAfterComponent component, MobStateChangedEvent args)
@@ -55,7 +55,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
{
InternalCancel(doAfter, component);
}
Dirty(component);
Dirty(uid, component);
}
/// <summary>
@@ -63,10 +63,12 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
/// </summary>
private void OnDamage(EntityUid uid, DoAfterComponent component, DamageChangedEvent args)
{
if (!args.InterruptsDoAfters || !args.DamageIncreased || args.DamageDelta == null)
// If we're applying state then let the server state handle the do_after prediction.
// This is to avoid scenarios where a do_after is erroneously cancelled on the final tick.
if (!args.InterruptsDoAfters || !args.DamageIncreased || args.DamageDelta == null || GameTiming.ApplyingState)
return;
var delta = args.DamageDelta?.Total;
var delta = args.DamageDelta.GetTotal();
var dirty = false;
foreach (var doAfter in component.DoAfters.Values)
@@ -79,7 +81,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
}
if (dirty)
Dirty(component);
Dirty(uid, component);
}
private void RaiseDoAfterEvents(DoAfter doAfter, DoAfterComponent component)
@@ -254,7 +256,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
comp.DoAfters.Add(doAfter.Index, doAfter);
EnsureComp<ActiveDoAfterComponent>(args.User);
Dirty(comp);
Dirty(args.User, comp);
args.Event.DoAfter = doAfter;
return true;
}