| 1405 | } |
| 1406 | |
| 1407 | function removeStandaloneExpressions (code) { |
| 1408 | code = code.replace(/^ *'[^']*';? *$/gm, '') // Strip out string literals on their own line, we don't need to preserve those |
| 1409 | code = code.replace(/^ *[0-9]+;? *$/gm, '') // ... int literals |
| 1410 | code = code.replace(/^ *(True|true|False|false|null|None|nil|undefined);? *$/gm, '') // truthy/falsy litearls |
| 1411 | code = code.replace(/^ *(look|dist)\('.+?'\);? *$/gm, '') // ... standalone look and dist blocks |
| 1412 | code = code.replace(/^ *((look|dist)\('.+?'\)|health) *(===|==|!==|!=|~=|<|<=|>|>=) *['"]?[a-zA-Z0-9]*['"]?;? *$/gm, '') // ... standalone comparator expressions |
| 1413 | code = code.replace(/^ *health;? *$/gm, '') // ... standalone health blocks |
| 1414 | return code |
| 1415 | } |
| 1416 | |
| 1417 | function findLastBlockWithNextConnection (block) { |
| 1418 | let lastBlockWithNextConnection |