space doafters, like doafters but in space (#16670)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-06-03 19:33:41 +00:00
committed by GitHub
parent a2318532e0
commit 10932cc384
4 changed files with 30 additions and 12 deletions

View File

@@ -193,12 +193,15 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
id = new DoAfterId(args.User, comp.NextId++);
var doAfter = new DoAfter(id.Value.Index, args, GameTiming.CurTime);
if (args.BreakOnUserMove)
if (args.BreakOnUserMove || args.BreakOnTargetMove)
doAfter.UserPosition = Transform(args.User).Coordinates;
if (args.Target != null && args.BreakOnTargetMove)
{
// Target should never be null if the bool is set.
doAfter.TargetPosition = Transform(args.Target.Value).Coordinates;
var targetPosition = Transform(args.Target.Value).Coordinates;
doAfter.UserPosition.TryDistance(EntityManager, targetPosition, out doAfter.TargetDistance);
}
// For this we need to stay on the same hand slot and need the same item in that hand slot
// (or if there is no item there we need to keep it free).