Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into Diagonal-Walls&Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhardSteinhauer authored Jan 10, 2024
2 parents 757eca1 + 587e07f commit 2874a34
Show file tree
Hide file tree
Showing 850 changed files with 122,644 additions and 33,828 deletions.
51 changes: 43 additions & 8 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
"Changes: Sprites":
- '**/*.rsi/*.png'
#"Map":
# - "Resources/Maps/**/*.yml" # All .yml files in the Resources/Maps directory, recursive.

"Changes: Map":
- 'Resources/Maps/*.yml'
- 'Resources/Prototypes/Maps/*.yml'
"Map-Admin":
- "Resources/Maps/_NF/Admin/*.yml" # Grid Files

"Changes: UI":
- '**/*.xaml*'
"Map-Bluespace":
- "Resources/Maps/_NF/Bluespace/*.yml" # Grid Files

"Map-Dungeon":
- "Resources/Maps/_NF/Dungeon/*.yml" # Grid Files

"Map-Outpost":
- "Resources/Maps/_NF/Outpost/*.yml" # Map Files
- "Resources/Prototypes/_MF/Maps/Outpost/*.yml" # Prototypes Files

"Map-Shuttle":
- "Resources/Maps/_NF/Shuttles/*.yml" # Grid Files
- "Resources/Prototypes/_NF/Shipyard/*.yml" # Prototypes Files

"Map-POI":
- "Resources/Maps/_NF/POI/*.yml" # Grid Files
- "Resources/Prototypes/_MF/Maps/POI/*.yml" # Prototypes Files

"Sprites":
- "**/*.rsi/*.png"
- "**/*.rsi/*.json"

"UI":
- "**/*.xaml*"

"C#":
- "**/*.cs"

"No C#":
- all: ["!**/*.cs"]
- all: ["!**/*.cs"]

"Docs":
- "**/*.xml"
- "**/*.md"

"FTL":
- "Resources/Locale/**/*.ftl"

"YML":
- any: ["**/*.yml"]
all: ["!Resources/Maps/_NF/**/*.yml", "!Resources/Prototypes/Maps/_NF/**/*.yml"]
1 change: 1 addition & 0 deletions .github/mapchecker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv
73 changes: 73 additions & 0 deletions .github/mapchecker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# MapChecker

This directory contains tooling contributed by TsjipTsjip, initially to automate the process of checking if map
contributions in PR's are valid. That is to say, it collects a list of prototypes in the `Resources/Prototypes`
directory which are marked as `DO NOT MAP`, `DEBUG`, ... and verifies that map changes indeed do not use them.

## Usage

Glad I do not have to write this myself! Get detailed help information by running:
`python3 .github/mapchecker/mapchecker.py --help`

The following help block is printed:
```
usage: mapchecker.py [-h] [-v] [-p PROTOTYPES_PATH [PROTOTYPES_PATH ...]] [-m MAP_PATH [MAP_PATH ...]] [-w WHITELIST]
Map prototype usage checker for Frontier Station 14.
options:
-h, --help show this help message and exit
-v, --verbose Sets log level to DEBUG if present, spitting out a lot more information. False by default,.
-p PROTOTYPES_PATH [PROTOTYPES_PATH ...], --prototypes_path PROTOTYPES_PATH [PROTOTYPES_PATH ...]
Directory holding entity prototypes. Default: All entity prototypes in the Frontier Station 14 codebase.
-m MAP_PATH [MAP_PATH ...], --map_path MAP_PATH [MAP_PATH ...]
Map PROTOTYPES or directory of map prototypes to check. Can mix and match.Default: All maps in the Frontier Station 14 codebase.
-w WHITELIST, --whitelist WHITELIST
YML file that lists map names and prototypes to allow for them.
```

You should generally not need to configure `-p`, `-m` or `-w`, as they are autofilled with sensible defaults. You can do
this:
- Set `-p` to only check against prototypes in a specific directory.
- Set `-m` to just check a specific map. (Make sure to **point it at the prototype**, not the map file itself!)
- Set `-v` with `-m` set as per above to get detailed information about a possible rejection for just that map.

## Configuration

Matchers are set in `config.py`. Currently it has a global list of matchers that are not allowed anywhere, and a set
of conditional matchers.

For each map, a set of applicable matchers is constructed according to this workflow:
1. Add all global illegal matchers.
2. Add all conditional matchers for non-matching shipyard groups
3. Remove all conditional matchers from the matching shipyard group (if it exists), to support duplicates across
shipyard groups

A match will attempt to match the following during prototype collection:
- Prototype ID (contains matcher, case insensitive)
- Prototype name (contains matcher, case insensitive)
- Prototype suffixes (separated per `, `) (exact, case insensitive)

## Whitelisting

If a map has a prototype and you believe it should be whitelisted, add a key for your map name (the `id` field of the
gameMap prototype), and add the prototype ID's to its list.

The whitelist the checker uses by default is `.github/mapchecker/whitelist.yml`.

## Shuttle group override

It is possible that a shuttle is set to group `None` because it is only used in custom shipyard listings. In this case,
you can force the MapChecker script to treat it as a different shipyard group by adding the following to the vessel
prototype:

```yml
...
group: None
# Add this line below.
mapchecker_group_override: ShipyardGroupHere
...
```

Note that for now this will cause a warning to be generated, but it will not cause a failure if the shuttle matches the
criteria for the overridden group.
15 changes: 15 additions & 0 deletions .github/mapchecker/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# List of matchers that are always illegal to use. These always supercede CONDITIONALLY_ILLEGAL_MATCHES.
ILLEGAL_MATCHES = [
"DO NOT MAP",
"DEBUG",
]
# List of matchers that are illegal to use, unless the map is a ship and the ship belongs to the keyed shipyard.
CONDITIONALLY_ILLEGAL_MATCHES = {
"Security": [ # These matchers are illegal unless the ship is part of the security shipyard.
"Security", # Anything with the word security in it should also only be appearing on security ships.
"Plastitanium", # Plastitanium walls should only be appearing on security ships.
],
"BlackMarket": [
"Plastitanium", # And also on blackmarket ships cause syndicate.
]
}
Loading

0 comments on commit 2874a34

Please sign in to comment.