Hotfix for some DSL bugs (For node not working, Exploration not taking next layers into account)
This commit is contained in:
@@ -41,14 +41,13 @@ public class ExploreNode : ProgramNode
|
||||
private bool TrySelectTarget()
|
||||
{
|
||||
int safetyCounter = 0;
|
||||
int layerRange = Math.Max(GameData.lowestLayer, 1);
|
||||
int maximumAttempts = (int)Math.Pow(GameData.layerSize, 2) * 2;
|
||||
|
||||
while (safetyCounter <= maximumAttempts)
|
||||
{
|
||||
targetPosition = new Vector3I(
|
||||
GameData.rand.Next(GameData.layerSize),
|
||||
GameData.rand.Next(layerRange),
|
||||
GameData.rand.Next(GameData.lowestLayer + 1),
|
||||
GameData.rand.Next(GameData.layerSize)
|
||||
);
|
||||
if (!GameData.map[targetPosition.Y].tiles[targetPosition.X, targetPosition.Z].wasVisited)
|
||||
|
||||
@@ -14,12 +14,12 @@ public class ForNode : ProgramNode
|
||||
public override NodeResult Execute(Robot robot, double delta)
|
||||
{
|
||||
bool isConditionFulfilled = DetermineCondition();
|
||||
amountExecuted++;
|
||||
if (isConditionFulfilled)
|
||||
{
|
||||
amountExecuted = 0;
|
||||
}
|
||||
return isConditionFulfilled ? NodeResult.SUCCESS : NodeResult.CONDITIONFALSE;
|
||||
amountExecuted++;
|
||||
return isConditionFulfilled ? NodeResult.CONDITIONFALSE : NodeResult.SUCCESS;
|
||||
}
|
||||
|
||||
private bool DetermineCondition()
|
||||
|
||||
Reference in New Issue
Block a user