override protected MethodResult Get(PathfinderInfo info) { Element leniency = 2; Element player = (Element)Parameters[0]; Element scalar = (Element)Parameters[1]; Element defaultSpeed = 5.5; Element nodeDistance = info.DistanceToNext.GetVariable(player); Element timeSinceLastNode = new V_TotalTimeElapsed() - info.LastUpdate.GetVariable(player); Element isStuck = new V_Compare( nodeDistance - ((defaultSpeed * scalar * timeSinceLastNode) / leniency), Operators.LessThanOrEqual, 0 ); isStuck = Element.Part <V_And>(IsPathfinding.Get(info, player), isStuck); return(new MethodResult(null, isStuck)); }
public override IWorkshopTree Get(ActionSet actionSet, IWorkshopTree[] parameterValues) { PathfinderInfo info = actionSet.Translate.DeltinScript.SetupPathfinder(); Element leniency = 2; Element player = (Element)parameterValues[0]; Element scalar = (Element)parameterValues[1]; Element defaultSpeed = 5.5; Element nodeDistance = (Element)info.DistanceToNext.GetVariable(player); Element timeSinceLastNode = new V_TotalTimeElapsed() - (Element)info.LastUpdate.GetVariable(player); Element isStuck = new V_Compare( nodeDistance - ((defaultSpeed * scalar * timeSinceLastNode) / leniency), Operators.LessThanOrEqual, new V_Number(0) ); return(Element.Part <V_And>(IsPathfinding.Get(info, player), isStuck)); }
override protected MethodResult Get(PathfinderInfo info) { Element player = (Element)Parameters[0]; Element isPathfinding = IsPathfinding.Get(info, player); Element isSafe = Element.Part <V_Or>( Element.Part <V_Not>(isPathfinding), Element.Part <V_IsTrueForAny>( info.Path.GetVariable(player), new V_Compare( Element.Part <V_DistanceBetween>(Element.Part <V_PositionOf>(player), new V_ArrayElement()), Operators.LessThanOrEqual, PathfinderInfo.MoveToNext ) ) ); return(new MethodResult(null, isSafe)); }