Skip to content

Commit

Permalink
Removed cruft from dataScripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoAbove committed Mar 27, 2024
1 parent d4b9013 commit 6c00329
Show file tree
Hide file tree
Showing 32 changed files with 7,099 additions and 8,186 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ Also, run `docker compose up -d` to easily spin up a local db instance.

### Noita data

You need to clean the Noita data a bit before running dataScripts. After extracting noita wak, in the noita data directory, run
You will need to unpack Noita wak data (see [here](https://noita.wiki.gg/wiki/Modding#Extracting_data_files)) and copy/link several things into the `dataScripts/noita-data` folder. Note that `translations` and `fonts` are in the main Noita folder, not in the `Nolla_Games_Noita` folder.
Here is the list: `data`, `translations`, `fonts`.

To create a symlink, run `ln -s <path to noita data> dataScripts/noita-data/data`.
For debian, that would be

```sh
find . -type f -not -path '*/\.*' -exec sed -i 's/----------------------//g' {} +;
find . -type f -not -path '*/\.*' -exec sed -i 's/<!------------ MATERIALS -------------------->/<!-- MATERIALS -->/g' {} +;
find . -type f -not -path '*/\.*' -exec sed -i 's/<!------------ MATERIALS ------------------ -->/<!-- MATERIALS -->/g' {} +;
find . -type f -not -path '*/\.*' -exec sed -i 's/<!-- attack_ranged_min_distance="60" -->//g' {} +;
find . -type f -not -path '*/\.*' -exec sed -i 's/<!---------------- shield ---------------- -->//g' {} +;
find . -type f -not -path '*/\.*' -exec sed -i 's/<!-- fuse_tnt durability is 11 so this is capable of destroying it -->//g' {} +;
tac $NOLLA_PATH/entities/misc/eradicate.xml | sed '0,/<Entity>$/s//<\/Entity>/' | tac >$NOLLA_PATH/entities/misc/eradicate.xml;
ln -s ~/.steam/debian-installation/steamapps/compatdata/881100/pfx/drive_c/users/steamuser/AppData/LocalLow/Nolla_Games_Noita/data dataScripts/noita-data/data
ln -s ~/.steam/debian-installation/steamapps/common/Noita/data/translations dataScripts/noita-data/translations
ln -s ~/.steam/debian-installation/steamapps/common/Noita/data/fonts dataScripts/noita-data/fonts
```

to fix comments for the xml parser
Use the ./dataScripts/full_parse.sh script to clean and parse the data files.

For emscripten, some edits need to be done to enable the closure compiler:

Expand Down
30 changes: 14 additions & 16 deletions dataScripts/full_parse.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
#! /bin/bash
set -x

rm -r src/out
mkdir src/out
mkdir src/out/obj
mkdir src/out/gen

NOLLA_PATH=~/.steam/debian-installation/steamapps/compatdata/881100/pfx/drive_c/users/steamuser/AppData/LocalLow/Nolla_Games_Noita/data

echo "Cleaning files"

find $NOLLA_PATH -type f -exec sed -i 's/----------------------//g' {} +
find $NOLLA_PATH -type f -exec sed -i 's/<!------------ MATERIALS -------------------->/<!-- MATERIALS -->/g' {} +
find $NOLLA_PATH -type f -exec sed -i 's/<!------------ MATERIALS ------------------ -->/<!-- MATERIALS -->/g' {} +
find $NOLLA_PATH -type f -exec sed -i 's/<!-- attack_ranged_min_distance="60" -->//g' {} +
find $NOLLA_PATH -type f -exec sed -i 's/<!---------------- shield ---------------- -->//g' {} +
find $NOLLA_PATH -type f -exec sed -i 's/<!-- fuse_tnt durability is 11 so this is capable of destroying it -->//g' {} +

rm -r ./src/out/*

echo "Done! Generating files"
echo "Generating files"

tsx ./src/translations.ts
tsx ./src/generateMaterials.ts
Expand All @@ -28,12 +18,20 @@ tsx ./src/mapsToObj
echo "Done!"

# Ask if you want to copy the files to the game directory
read -p "Do you want to copy the files to the data directory? (y/n) " -n 1 -r
read -p "Do you want to copy the files to the data directory? (y/N) " -n 1 -r

if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -r ./src/out/gen # Not needed
rm -r ./src/out/gen # Not needed - need manual updates since these are templates
mv -f ./src/out/spells.h ../src/services/SeedInfo/noita_random/src/spells.h

# Rename locales
mv ./src/locales/es-es ./src/locales/es
mv ./src/locales/fr-fr ./src/locales/fr
mv ./src/locales/pt-br ./src/locales/pt
mv ./src/locales/zh-cn ./src/locales/zh
rm -r ./src/locales/es-es ./src/locales/fr-fr ./src/locales/pt-br ./src/locales/zh-cn
mv ./src/locales ../public/locales

cp -rf ./src/out/* ../src/services/SeedInfo/data/
fi

Expand Down
2 changes: 2 additions & 0 deletions dataScripts/noita-data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data
translations
Empty file added dataScripts/noita-data/.gitkeep
Empty file.
51 changes: 0 additions & 51 deletions dataScripts/src/ArrayToObj.ts

This file was deleted.

58 changes: 0 additions & 58 deletions dataScripts/src/betterWang.ts

This file was deleted.

Loading

0 comments on commit 6c00329

Please sign in to comment.