Skip to content
Snippets Groups Projects
Commit 3929df31 authored by lowercasedonkey's avatar lowercasedonkey
Browse files

why won't return work

parent 5ba9d5a0
No related branches found
No related tags found
1 merge request!6135Use setup for wardrobe
...@@ -205,15 +205,19 @@ window.isClothingAccessible = function(string) { ...@@ -205,15 +205,19 @@ window.isClothingAccessible = function(string) {
return true; return true;
} }
let test = setup.clothes.forEach(item => { let success = 0;
setup.clothes.forEach(item => {
if (item.value === string) { if (item.value === string) {
if (!(item.hasOwnProperty("unlock")) && !(item.hasOwnProperty("fs"))) { if (!(item.hasOwnProperty("unlock")) && !(item.hasOwnProperty("fs"))) {
console.log(`${string} is free for everyone!`); console.log(`${string} is free for everyone!`);
success = 1;
return true; return true;
} }
if (item.hasOwnProperty("fs")) { if (item.hasOwnProperty("fs")) {
if (V.arcologies[0][item.fs] > 0) { if (V.arcologies[0][item.fs] > 0) {
console.log(`${string} is in FS!`); console.log(`${string} is in FS!`);
success = 1;
return true; return true;
} }
} }
...@@ -222,9 +226,11 @@ window.isClothingAccessible = function(string) { ...@@ -222,9 +226,11 @@ window.isClothingAccessible = function(string) {
for (let key in keys) { for (let key in keys) {
if (key === "continent" && V.continent === item.unlock[key]) { if (key === "continent" && V.continent === item.unlock[key]) {
console.log(`${string} is in continent!`); console.log(`${string} is in continent!`);
success = 1;
return true; return true;
} else if (V[key] > 0 ) { } else if (V[key] > 0 ) {
console.log(`${string} ${key} is true for us!`); console.log(`${string} ${key} is true for us!`);
success = 1;
return true; return true;
} }
} }
...@@ -234,8 +240,7 @@ window.isClothingAccessible = function(string) { ...@@ -234,8 +240,7 @@ window.isClothingAccessible = function(string) {
} }
return false; return false;
}); });
console.log(test); if (success === 1) {
if (test === true) {
return true; return true;
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment