forked from SierraBay/SierraBay12
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
929 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# maplint | ||
maplint is a tool that lets you prohibit anti-patterns in maps through simple rules. You can use maplint to do things like ban variable edits for specific types, ban specific variable edits, ban combinations of types, etc. | ||
|
||
## Making lints | ||
|
||
To create a lint, create a new file in the `lints` folder. Lints use [YAML](https://learnxinyminutes.com/docs/yaml/), which is very expressive, though can be a little complex. If you get stuck, read other lints in this folder. | ||
|
||
### Typepaths | ||
The root of the file is your typepaths. This will match not only that type, but also subtypes. For example: | ||
|
||
```yml | ||
/mob/dog: | ||
# We'll get to this... | ||
``` | ||
|
||
...will define rules for `/mob/dog`, `/mob/dog/corgi`, `/mob/dog/beagle`, etc. | ||
|
||
If you only want to match a specific typepath, prefix it with `=`. This: | ||
|
||
```yml | ||
=/mob/dog: | ||
``` | ||
...will only match `/mob/dog` specifically. | ||
|
||
Alternatively, if you want to match ALL types, enter a single `*`, for wildcard. | ||
|
||
### `banned` | ||
The simplest rule is to completely ban a subtype. To do this, fill with `banned: true`. | ||
|
||
For example, this lint will ban `/mob/dog` and all subtypes: | ||
|
||
```yml | ||
/mob/dog: | ||
banned: true # Cats FTW | ||
``` | ||
|
||
### `banned_neighbors` | ||
If you want to ban other objects being on the same tile as another, you can specify `banned_neighbors`. | ||
|
||
This takes a few forms. The simplest is just a list of types to not be next to. This lint will ban either cat_toy *or* cat_food (or their subtypes) from being on the same tile as a dog. | ||
|
||
```yml | ||
/mob/dog: | ||
banned_neighbors: | ||
- /obj/item/cat_toy | ||
- /obj/item/cat_food | ||
``` | ||
|
||
This also supports the `=` format as specified before. This will ban `/mob/dog` being on the same tile as `/obj/item/toy` *only*. | ||
|
||
```yml | ||
/mob/dog: | ||
banned_neighbors: | ||
- =/obj/item/toy # Only the best toys for our dogs | ||
``` | ||
|
||
Anything in this list will *not* include the object itself, meaning you can use it to make sure two of the same object are not on the same tile. For example, this lint will ban two dogs from being on the same tile: | ||
|
||
```yml | ||
/mob/dog: | ||
banned_neighbors: | ||
- /mob/dog # We're a space station, not a dog park! | ||
``` | ||
|
||
However, you can add a bit more specificity with `identical: true`. This will prohibit other instances of the *exact* same type *and* variable edits from being on the same tile. | ||
|
||
```yml | ||
/mob/dog: | ||
banned_neighbors: | ||
# Purebreeds are unnatural! We're okay with dogs as long as they're different. | ||
/mob/dog: { identical: true } | ||
``` | ||
|
||
Finally, if you need maximum precision, you can specify a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) to match for a path. If we wanted to ban a `/mob/dog` from being on the same tile as `/obj/bowl/big/cat`, `/obj/bowl/small/cat`, etc, we can write: | ||
|
||
```yml | ||
/mob/dog: | ||
banned_neighbors: | ||
CAT_BOWLS: { pattern: ^/obj/bowl/.+/cat$ } | ||
``` | ||
|
||
### `banned_variables` | ||
To ban all variable edits, you can specify `banned_variables: true` for a typepath. For instance, if we want to block dogs from getting any var-edits, we can write: | ||
|
||
```yml | ||
/mob/dog: | ||
banned_variables: true # No var edits, no matter what | ||
``` | ||
|
||
If we want to be more specific, we can write out the specific variables we want to ban. | ||
|
||
```yml | ||
/mob/dog | ||
banned_variables: | ||
- species # Don't var-edit species, use the subtypes | ||
``` | ||
|
||
We can also explicitly create allowlists and denylists of values through `allow` and `deny`. For example, if we want to make sure we're not creating invalid bowls for animals, we can write: | ||
|
||
```yml | ||
/obj/bowl/dog: | ||
banned_variables: | ||
species: | ||
# If we specify a species, it's gotta be a dog | ||
allow: ["beagle", "corgi", "pomeranian"] | ||
/obj/bowl/humans: | ||
banned_variables: | ||
species: | ||
# We're civilized, we don't want to eat from the same bowl that's var-edited for animals | ||
deny: ["cats", "dogs"] | ||
``` | ||
|
||
Similar to [banned_neighbors](#banned_neighbors), you can specify a regular expression pattern for allow/deny. | ||
|
||
```yml | ||
/mob/dog: | ||
banned_variables: | ||
# Names must start with a capital letter | ||
name: | ||
allow: { pattern: '^[A-Z].*$' } | ||
``` | ||
|
||
### `help` | ||
If you want a custom message to go with your lint, you can specify "help" in the root. | ||
|
||
```yml | ||
help: Pugs haven't existed on Sol since 2450. | ||
/mob/dog/pug: | ||
banned: true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
help: This typepath exists to make an admin verb work, it should not be placed on maps | ||
/obj/machinery/computer/libraryconsole/admin_only_do_not_map_in_you_fucker: | ||
banned: true # Please don't man I swear to god |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
help: "Use the directional variants when possible." | ||
/obj/machinery/power/apc: | ||
banned_variables: | ||
pixel_x: | ||
allow: [25, -25] | ||
pixel_y: | ||
allow: [25, -25] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
help: "Please replace it with a proper area path." | ||
/area: | ||
banned_variables: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
=/turf: | ||
banned: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/obj/structure/cable: | ||
banned_variables: true | ||
|
||
/obj/structure/pipe_cleaner: | ||
banned_variables: | ||
- d1 | ||
- d2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
help: Colorless turf_decal detected! Please delete it or replace it with the desired colored subtype. | ||
=/obj/effect/turf_decal/tile: | ||
banned: TRUE | ||
|
||
=/obj/effect/turf_decal/trimline: | ||
banned: TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
help: "Please replace it with a normal conveyor belt." | ||
/obj/machinery/conveyor/inverted: | ||
banned_variables: | ||
dir: | ||
deny: [1, 2, 4, 8] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
help: "Please include DMI files as standard assets instead for repository maps." | ||
/obj/effect/mapping_helpers/custom_icon: | ||
banned: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
help: "Custom mobile docking_port sizes detected. This is done automatically and should not be varedits." | ||
/obj/docking_port/mobile: | ||
banned_variables: | ||
- width | ||
- height | ||
- dwidth | ||
- dheight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
help: "Please upper-case your door names." | ||
/obj/machinery/door: | ||
banned_variables: | ||
name: | ||
deny: { pattern: '.*\s(?!of|and|to)[a-z].*' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
help: "Please replace with the proper structure spawner." | ||
=/obj/structure/grille: | ||
banned_neighbors: | ||
/obj/structure/cable: | ||
/obj/structure/window/reinforced/plasma/plastitanium: | ||
FULLTILE_WINDOW: | ||
pattern: ^/obj/structure/window[/\w]*?fulltile$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
help: "Do not override heat_capacity, you must use a custom subtype." | ||
/turf: | ||
banned_variables: | ||
- heat_capacity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/obj/structure/barricade: | ||
banned_neighbors: | ||
/obj/structure/barricade: | ||
identical: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/obj/machinery/atmospherics/pipe: | ||
banned_neighbors: | ||
/obj/machinery/atmospherics/pipe: | ||
identical: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
help: | ||
This means you didn't clean up any potential merge conflicts, | ||
make sure everything in that area is correct. | ||
/obj/merge_conflict_marker: | ||
banned: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/obj/machinery/door/airlock: | ||
banned_neighbors: | ||
- /obj/machinery/door/airlock |
Oops, something went wrong.