Files
Bubberstation/tools/maplint/source/lint.py
PowerfulBacon aacb26313e Adds 'required_neighbors' to maplint and conditional lints (#86640)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Allows us to test for atoms that are required to be placed alongside
another atom, such as APCs to cables.
There are many situations where a structure spawner is not good enough:
- APC cables need to be in any colour or any direction
- Airlock mapping helpers may be any access to any airlock and would
create too many subtypes.

## Why It's Good For The Game

This allows us to have more comprehensive linting added to future
mapping changes.

This is needed to support the following lints:
- Airlocks should not have an access helper if they have access
requirement variables set.
- Access requirement helpers MUST have an airlock placed on their tile.

Needed to satisfy the following review:
https://github.com/BeeStation/BeeStation-Hornet/pull/11469#discussion_r1757608360

## Testing Photographs and Procedure

### Test required neighbors


![image](https://github.com/user-attachments/assets/ea79aa85-048f-40ca-b27b-2a1da0e1ba2e)

### Conditional Rulesets

(I know this rule is useless since it mimics banned_variables, but we
can make more complex rules with the other ones and with
banned_neighbors)


![image](https://github.com/user-attachments/assets/a607a4cd-0e97-4557-8129-7cf5875a2ebd)


![image](https://github.com/user-attachments/assets/81e43bb6-acc8-441f-97a3-936f5bc88203)

Test a more complex query with set operations:


![image](https://github.com/user-attachments/assets/2d309060-8360-4b55-a4d2-2a5d11d7bad5)


![image](https://github.com/user-attachments/assets/33b30d70-3971-40d8-97d5-2f610d73cf86)


![image](https://github.com/user-attachments/assets/50e564eb-9b82-413f-99c3-4655e6c23c75)

Super complex query:


![image](https://github.com/user-attachments/assets/0d12c56f-6ff5-4663-bd5b-738c12c3f085)


![image](https://github.com/user-attachments/assets/a46afaa8-4385-4017-a452-a3a624d968c4)


![image](https://github.com/user-attachments/assets/7a6f5fe5-9a0c-4f55-afc9-2fb1777c8a7d)

Test like:


![image](https://github.com/user-attachments/assets/2f0187e2-c7f1-4631-8f40-c8d8ae68942b)


![image](https://github.com/user-attachments/assets/1d63faf1-934f-4d6d-8091-f484fcd44c7a)


![image](https://github.com/user-attachments/assets/86dd3593-a3de-47bf-8061-ff206366d387)

Not set:

![image](https://github.com/user-attachments/assets/2ae61dfe-4214-42a5-96a9-37ae5e91e6b0)

Test is:


![image](https://github.com/user-attachments/assets/ace87258-f9cd-4898-86ba-1cf86bf52a3a)


![image](https://github.com/user-attachments/assets/067acb26-1bf7-4038-9d2f-3e304810fadd)


## Changelog
🆑
add: Implements the ability to lint for required neighbors in maplint.
add: Adds conditional linting rules in maplint, allowing a lint to apply
only if certain conditions are met (Variable is/isn't set, Variable
is/isn't a value, Variable matches a regex).
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
2024-09-16 11:16:25 -07:00

18 KiB