This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add (example) script to generate a patched nhdat.
This creates a copy of the oracle level on dungeon level 1.
- Loading branch information
Heinrich Kuttler
committed
Sep 23, 2020
1 parent
68d3997
commit 280bc03
Showing
2 changed files
with
62 additions
and
4 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 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,55 @@ | ||
set -euo pipefail | ||
|
||
ORIGDIR=$(pwd) | ||
|
||
HACKDIR=$(python -c 'import pkg_resources; print(pkg_resources.resource_filename("nle", "nethackdir"), end="")') | ||
|
||
TMPDIR=$(mktemp -d) | ||
|
||
echo $TMPDIR | ||
|
||
mkdir $TMPDIR/dat | ||
cd $TMPDIR/dat | ||
cp $HACKDIR/dat/dungeon.def . | ||
patch --ignore-whitespace <<'EOF' | ||
--- dungeon.def 2019-03-01 15:21:08.000000000 +0100 | ||
+++ dungeon.def 2020-09-23 19:17:51.000000000 +0200 | ||
@@ -15,6 +15,7 @@ | ||
# | ||
DUNGEON: "The Dungeons of Doom" "D" (25, 5) | ||
+LEVEL: "mylevel" "none" @ (1,1) | ||
ALIGNMENT: unaligned | ||
BRANCH: "The Gnomish Mines" @ (2, 3) | ||
LEVEL: "rogue" "R" @ (15, 4) | ||
EOF | ||
$HACKDIR/makedefs -e # Looks for ../dat/dungeon.def. | ||
$HACKDIR/dgn_comp dungeon.pdf | ||
|
||
cp $HACKDIR/dat/oracle.des mylevel.des | ||
patch --ignore-whitespace <<'EOF' | ||
--- mylevel.des 2019-03-01 15:21:08.000000000 +0100 | ||
+++ mylevel.des 2020-09-23 19:01:56.000000000 +0200 | ||
@@ -5,7 +5,7 @@ | ||
# Oracle level | ||
# | ||
-LEVEL: "oracle" | ||
+LEVEL: "mylevel" | ||
ROOM: "ordinary" , lit, (3,3), (center,center), (11,9) { | ||
OBJECT:('`',"statue"),(0,0),montype:'C',1 | ||
EOF | ||
$HACKDIR/lev_comp mylevel.des | ||
|
||
mkdir $TMPDIR/contents | ||
cd $TMPDIR/contents | ||
$HACKDIR/dlb xf $HACKDIR/nhdat | ||
cp -f ../dat/dungeon ../dat/mylevel.lev . | ||
$HACKDIR/dlb cf nhdat * | ||
cp nhdat $ORIGDIR | ||
|
||
cd $ORIGDIR | ||
|
||
rm -rf $TMPDIR |