v2.1.3: getTransition now gives entrances if it cannot find specifics

This commit is contained in:
Evan Debenham
2023-06-22 17:18:39 -04:00
parent fcc136e2eb
commit de6878cef0
@@ -511,6 +511,9 @@ public abstract class Level implements Bundlable {
} }
public LevelTransition getTransition(LevelTransition.Type type){ public LevelTransition getTransition(LevelTransition.Type type){
if (transitions.isEmpty()){
return null;
}
for (LevelTransition transition : transitions){ for (LevelTransition transition : transitions){
//if we don't specify a type, prefer to return any entrance //if we don't specify a type, prefer to return any entrance
if (type == null && if (type == null &&
@@ -520,7 +523,7 @@ public abstract class Level implements Bundlable {
return transition; return transition;
} }
} }
return (type == null && !transitions.isEmpty() ? transitions.get(0) : null); return type != null ? getTransition(null) : transitions.get(0);
} }
public LevelTransition getTransition(int cell){ public LevelTransition getTransition(int cell){