Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow despawning npcs from eocs #24

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ef07da9
Move clang-tidy script to a separate file
BrettDong Mar 29, 2022
7a5f8db
Use GitHub REST API to determine files changed in clang-tidy workflow
BrettDong Mar 29, 2022
b0b5bcf
Mutation infrastructure and a Threshold calculation revamp (#56421)
MylieDaniels Apr 4, 2022
cbd626a
inventory_selector: delete some deprecated code (#56427)
andrei8l Apr 4, 2022
badea40
Expand armor definition for cestus (#56429)
Jarewill Apr 4, 2022
1c66fc2
Clarify smartphone cases (#56434)
Faalagorn Apr 4, 2022
77cec43
Minor t-shirt variants fixes (#56435)
Faalagorn Apr 4, 2022
09b95d5
[Innawoods] Pickling and cheese (#56443)
Sathra225 Apr 4, 2022
038bc15
mercenary attire (#56448)
bombasticSlacks Apr 4, 2022
568b478
[Innawood] Minor caves update (#56449)
Light-Wave Apr 4, 2022
c669f81
Update holster.json (#56452)
Maleclypse Apr 4, 2022
d97942c
Merge pull request #56454 from BrettDong/clang-tidy
kevingranade Apr 4, 2022
af04487
Adds more rocks to mining results (#56455)
Sathra225 Apr 4, 2022
76ba3ef
easy text fix
bombasticSlacks Apr 4, 2022
f430da6
Update effects.json (#56459)
Faalagorn Apr 4, 2022
a1320d9
Update npctalk.cpp (#56464)
Faalagorn Apr 5, 2022
f9fe8e9
Add missing serial commas to WETCODEs definitions (#56466)
Faalagorn Apr 5, 2022
0073387
Fix extension_cable name (#56467)
Faalagorn Apr 5, 2022
ab0f660
Fix Aftershock typos and texts (#56470)
Faalagorn Apr 5, 2022
790d3f4
Added non-zero price_postapoc to fasteners.json (#56475)
Inglonias Apr 5, 2022
4cbd44f
UI fixes for rigid armor (#56476)
bombasticSlacks Apr 5, 2022
aba61a8
Merge pull request #56594 from bombasticSlacks/vest-remove
Rivet-the-Zombie Apr 5, 2022
77d4a83
Isolated artisans writing touchup (#56438)
Ilysen Apr 5, 2022
19b5fdd
set_remove_npc effect
MylieDaniels Apr 5, 2022
43ada68
formatting
MylieDaniels Apr 5, 2022
778fa6e
Merge branch 'random-encounter-1' into despawn-npcs-from-eocs
MylieDaniels Apr 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
paths: '[ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake" ]'
paths: '[ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake", ".github/workflows/clang-tidy.yml" ]'
build:
needs: skip-duplicates
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' }}
Expand Down Expand Up @@ -54,6 +54,24 @@ jobs:
gettext
- name: prepare
run: bash ./build-scripts/requirements.sh
- name: determine changed files
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v5
with:
script: |
var fs = require('fs');
const response = await github.paginate(github.rest.pulls.listFiles,
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
}
);
const files = response.map(x => x.filename);
for (const path of files) {
console.log(path);
}
fs.writeFileSync("files_changed", files.join('\n'));
- uses: ammaraskar/gcc-problem-matcher@master
- name: run clang-tidy
run: bash ./build-scripts/build.sh
run: bash ./build-scripts/clang-tidy.sh
123 changes: 123 additions & 0 deletions build-scripts/clang-tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/bash

# Shell script intended for clang-tidy check

echo "Using bash version $BASH_VERSION"
set -exo pipefail

num_jobs=3

# We might need binaries installed via pip, so ensure that our personal bin dir is on the PATH
export PATH=$HOME/.local/bin:$PATH

if [ "$RELEASE" = "1" ]
then
build_type=MinSizeRel
else
build_type=Debug
fi

cmake_extra_opts=()

if [ "$CATA_CLANG_TIDY" = "plugin" ]
then
cmake_extra_opts+=("-DCATA_CLANG_TIDY_PLUGIN=ON")
# Need to specify the particular LLVM / Clang versions to use, lest it
# use the llvm-7 that comes by default on the Travis Xenial image.
cmake_extra_opts+=("-DLLVM_DIR=/usr/lib/llvm-12/lib/cmake/llvm")
cmake_extra_opts+=("-DClang_DIR=/usr/lib/llvm-12/lib/cmake/clang")
fi

if [ "$COMPILER" = "clang++-12" -a -n "$GITHUB_WORKFLOW" -a -n "$CATA_CLANG_TIDY" ]
then
# This is a hacky workaround for the fact that the custom clang-tidy we are
# using is built for Travis CI, so it's not using the correct include directories
# for GitHub workflows.
cmake_extra_opts+=("-DCMAKE_CXX_FLAGS=-isystem /usr/include/clang/12.0.0/include")
fi

mkdir -p build
cd build
cmake \
-DBACKTRACE=ON \
${COMPILER:+-DCMAKE_CXX_COMPILER=$COMPILER} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE="$build_type" \
-DTILES=${TILES:-0} \
-DSOUND=${SOUND:-0} \
"${cmake_extra_opts[@]}" \
..

if [ "$CATA_CLANG_TIDY" = "plugin" ]
then
make -j$num_jobs CataAnalyzerPlugin
export PATH=$PWD/tools/clang-tidy-plugin/clang-tidy-plugin-support/bin:$PATH
if ! which FileCheck
then
ls -l tools/clang-tidy-plugin/clang-tidy-plugin-support/bin
ls -l /usr/bin
echo "Missing FileCheck"
exit 1
fi
CATA_CLANG_TIDY=clang-tidy
lit -v tools/clang-tidy-plugin/test
fi

"$CATA_CLANG_TIDY" --version

# Show compiler C++ header search path
${COMPILER:-clang++} -v -x c++ /dev/null -c
# And the same for clang-tidy
"$CATA_CLANG_TIDY" ../src/version.cpp -- -v

# Run clang-tidy analysis instead of regular build & test
# We could use CMake to create compile_commands.json, but that's super
# slow, so use compiledb <https://github.com/nickdiego/compiledb>
# instead.
compiledb -n make

cd ..
rm -f compile_commands.json && ln -s build/compile_commands.json

# We want to first analyze all files that changed in this PR, then as
# many others as possible, in a random order.
set +x
all_cpp_files="$( \
grep '"file": "' build/compile_commands.json | \
sed "s+.*$PWD/++;s+\"$++")"
changed_files="$( ( test -f ./files_changed && cat ./files_changed ) || echo unknown )"
changed_cpp_files="$( \
echo "$changed_files" | grep -F "$all_cpp_files" || true )"
if [ -n "$changed_cpp_files" ]
then
remaining_cpp_files="$( \
echo "$all_cpp_files" | grep -v -F "$changed_cpp_files" || true )"
else
remaining_cpp_files="$all_cpp_files"
fi

function analyze_files_in_random_order
{
if [ -n "$1" ]
then
echo "$1" | shuf | \
xargs -P "$num_jobs" -n 1 ./build-scripts/clang-tidy-wrapper.sh -quiet
else
echo "No files to analyze"
fi
}

echo "Analyzing changed files"
analyze_files_in_random_order "$changed_cpp_files"

# Check for changes to any files that would require us to run clang-tidy across everything
changed_global_files="$( \
echo "$changed_files" | \
egrep -i "\.h$|clang-tidy|build-scripts|cmake|unknown" || true )"
if [ -n "$changed_global_files" ]
then
first_changed_file="$(echo "$changed_global_files" | head -n 1)"
echo "Analyzing remaining files because $first_changed_file was changed"
analyze_files_in_random_order "$remaining_cpp_files"
fi
set -x
2 changes: 1 addition & 1 deletion data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@
"id": "mutagen_elfa",
"name": [ "Elf-A Mutation", "Elf-A Transformation", "Elf-A Metamorphosis" ],
"desc": [
"You consumed Elf-a mutagen.",
"You consumed Elf-A mutagen.",
"You must look after this world, if noone else will.",
"You see stars. You see so many stars."
],
Expand Down
9 changes: 5 additions & 4 deletions data/json/furniture_and_terrain/terrain-walls.json
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,8 @@
"ter_set": "t_rock_floor",
"ter_set_bashed_from_above": "t_rock_floor_no_roof",
"items": [
{ "item": "rock", "count": [ 3, 7 ] },
{ "item": "rock", "count": [ 17, 37 ] },
{ "item": "rock_large", "count": [ 1, 3 ] },
{ "item": "coal_lump", "charges": [ 250, 500 ], "prob": 10 },
{ "item": "material_limestone", "charges": [ 10, 25 ], "prob": 80 },
{ "item": "material_rocksalt", "count": [ 0, 1 ], "prob": 20 },
Expand All @@ -1506,7 +1507,7 @@
"sound": "crash!",
"sound_fail": "whump!",
"ter_set": "t_rock_floor",
"items": [ { "item": "rock", "count": [ 3, 7 ] } ]
"items": [ { "item": "rock", "count": [ 17, 37 ] }, { "item": "rock_large", "count": [ 1, 3 ] } ]
}
},
{
Expand All @@ -1526,7 +1527,7 @@
"sound": "crash!",
"sound_fail": "whump!",
"ter_set": "t_rock_floor",
"items": [ { "item": "rock", "count": [ 3, 7 ] } ]
"items": [ { "item": "rock", "count": [ 17, 37 ] }, { "item": "rock_large", "count": [ 1, 3 ] } ]
}
},
{
Expand All @@ -1546,7 +1547,7 @@
"sound": "crash!",
"sound_fail": "whump!",
"ter_set": "t_rock_floor",
"items": [ { "item": "rock", "count": [ 3, 7 ] } ]
"items": [ { "item": "rock", "count": [ 17, 37 ] }, { "item": "rock_large", "count": [ 1, 3 ] } ]
}
},
{
Expand Down
3 changes: 3 additions & 0 deletions data/json/itemgroups/Clothing_Gear/clothing.json
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,7 @@
[ "bootsheath", 8 ],
[ "holster", 15 ],
[ "sholster", 10 ],
[ "shoulder_holster", 1 ],
[ "bandolier_shotgun", 8 ],
[ "torso_bandolier_grenade", 8 ],
[ "solarpack", 5 ],
Expand Down Expand Up @@ -2240,6 +2241,7 @@
[ "motorbike_boots", 5 ],
[ "holster", 8 ],
[ "sholster", 4 ],
[ "shoulder_holster", 1 ],
[ "bootstrap", 3 ],
[ "legpouch", 12 ],
[ "legpouch_large", 6 ],
Expand Down Expand Up @@ -3596,6 +3598,7 @@
{ "item": "back_holster", "prob": 10 },
{ "item": "holster", "prob": 30 },
{ "item": "sholster", "prob": 10 },
{ "item": "shoulder_holster", "prob": 1 },
{ "item": "bholster", "prob": 10 },
{ "item": "bbholster", "prob": 8 }
]
Expand Down
1 change: 1 addition & 0 deletions data/json/itemgroups/SUS/gunstore.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
{ "item": "elbow_pads", "prob": 20 },
{ "item": "holster", "prob": 45 },
{ "item": "sholster", "prob": 20 },
{ "item": "shoulder_holster", "prob": 5 },
{ "item": "boots_combat", "prob": 10 },
{ "item": "helmet_liner", "prob": 30 },
{ "item": "mask_gas", "prob": 10, "charges": [ 0, 100 ] },
Expand Down
Loading