| Conditions | 1 |
| Paths | 1 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 20 | function reactionTable(util, format, visibility, data, state) { |
||
| 21 | let ct = this; |
||
| 22 | ct.util = util; |
||
| 23 | ct.format = format; |
||
| 24 | ct.data = data; |
||
| 25 | ct.state = state; |
||
| 26 | |||
| 27 | ct.visibleSyntheses = function(currentElement) { |
||
| 28 | return visibility.visible(data.reactions, isSynthesisVisible, currentElement); |
||
| 29 | }; |
||
| 30 | |||
| 31 | function isSynthesisVisible(key, currentElement) { |
||
| 32 | let entry = data.reactions[key]; |
||
| 33 | for (let reactant in entry.reactant) { |
||
| 34 | if (!state.player.resources[reactant].unlocked) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | // for misc reactions |
||
| 40 | if(entry.elements.length === 0 && |
||
| 41 | currentElement === ''){ |
||
| 42 | return true; |
||
| 43 | } |
||
| 44 | |||
| 45 | for (let element in entry.elements) { |
||
| 46 | if (currentElement === entry.elements[element]) { |
||
| 47 | return true; |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | return false; |
||
| 52 | } |
||
| 53 | } |
||
| 54 |