xplane-12: Add X-World Asia Scenery

master
Michael Raitza 2022-12-21 21:19:43 +01:00
parent 64a92fe1b6
commit 9d875224a7
2 changed files with 95 additions and 1 deletions

View File

@ -9,7 +9,7 @@ let
xPlaneEnv = callPackage ./x-plane { xplanePathStr = "/home/games/xplane"; xPlaneEnv = callPackage ./x-plane { xplanePathStr = "/home/games/xplane";
addons = [ headshake beautifulRoads samBasic samGlobalTrees flyWithLua vividSky airportEnvHD betterLights extendedNightLights toLissA321 ]; }; addons = [ headshake beautifulRoads samBasic samGlobalTrees flyWithLua vividSky airportEnvHD betterLights extendedNightLights toLissA321 ]; };
xPlane12Env = callPackage ./x-plane { xplanePathStr = "/home/games/xplane12"; name = "x-plane12-env"; xPlane12Env = callPackage ./x-plane { xplanePathStr = "/home/games/xplane12"; name = "x-plane12-env";
addons = [ x-world-vegetation x-world-europe ]; }; addons = [ x-world-vegetation x-world-europe x-world-asia ]; };
xPlaneSDK = callPackage ./x-plane/sdk.nix {}; xPlaneSDK = callPackage ./x-plane/sdk.nix {};
ortho4xp = callPackage ./x-plane/ortho4XPWrapper.nix { orthoPathStr = "/home/games/ortho4xp"; }; ortho4xp = callPackage ./x-plane/ortho4XPWrapper.nix { orthoPathStr = "/home/games/ortho4xp"; };
@ -30,6 +30,7 @@ let
# X-Plane 12 # X-Plane 12
x-world-vegetation = callPackage ./x-plane/simHeaven/x-world-vegetation.nix {}; x-world-vegetation = callPackage ./x-plane/simHeaven/x-world-vegetation.nix {};
x-world-europe = callPackage ./x-plane/simHeaven/x-world-europe.nix {}; x-world-europe = callPackage ./x-plane/simHeaven/x-world-europe.nix {};
x-world-asia = callPackage ./x-plane/simHeaven/x-world-asia.nix {};
pdfchain = callPackage ./pdfchain { }; pdfchain = callPackage ./pdfchain { };
prism = callPackage ./prism.nix {}; prism = callPackage ./prism.nix {};

View File

@ -0,0 +1,93 @@
{ stdenv
, lib
, mkXPlaneAddon
, impureSrcPath ? "/home/games/xplane-scenery/simHeaven_X-World_Asia"
# Disable to improve frame rate
, enableDetails ? true
# dito
, enableExtras ? true
# Replace scenery objects with null-objects that are covered by ortho scenery
, useOrtho ? true
# Replace default tiles for regions with poor OSM data quality (e.g. remote forests not showing)
# example: [ "+38+001" "+71-009" ]
, replaceTiles ? [ ]
}:
let
inherit (lib) concatStringsSep optional;
dirName = "simHeaven_X-World_Asia";
linkDirs = concatStringsSep " " ([
"${dirName}-0-exclusions"
"${dirName}-1-vfr"
"${dirName}-5-footprints"
"${dirName}-6-scenery"
"${dirName}-7-forests"
"${dirName}-8-network" ]
++ optional enableDetails "${dirName}-3-details"
++ optional enableExtras "${dirName}-4-extras");
tiles = concatStringsSep " " replaceTiles;
in mkXPlaneAddon {
pname = "x-world-asia";
version = "1.1";
src = "";
buildCommand = ''
mkdir -p "$out"
touch "$out/installed"
'';
passthru = {
build = "";
prepare = ''
test -d "${impureSrcPath}"
for f in ${linkDirs} ; do
mkdir "$XPLANEPATH/Custom Scenery/$f"
for j in "${impureSrcPath}/$f"/* ; do
ln -s "$j" "$XPLANEPATH/Custom Scenery/$f/$(basename "$j")"
done
done
if [ "${toString useOrtho}" = 1 ]; then
f="$XPLANEPATH/Custom Scenery/${dirName}-6-scenery/library.txt"
rm "$f"
ln -s "${impureSrcPath}/${dirName}-6-scenery/library - orthos.txt" "$f"
fi
# In case we want to replace some tiles, link every tile indivdually
if [ -n "${tiles}" ]; then
rm "$XPLANEPATH/Custom Scenery/${dirName}-7-forests/Earth nav data"
for f in "${impureSrcPath}/${dirName}-7-forests/Earth nav data"/* ; do
mkdir -p "$XPLANEPATH/Custom Scenery/${dirName}-7-forests/Earth nav data/$(basename "$f")"
for k in "$f"/* ; do
ln -s "$k" "$XPLANEPATH/Custom Scenery/${dirName}-7-forests/Earth nav data/$(basename "$f")"
done
done
for f in ${tiles} ; do
# bash-ism, transform +HH+LLL -> +H0+LL0
d=''${f:0:2}0''${f:3:3}0
s="${impureSrcPath}/${dirName}-7-forests/Earth nav data - osm+autogen/$d/$f.dsf"
t="$XPLANEPATH/Custom Scenery/${dirName}-7-forests/Earth nav data/$d/$f.dsf"
if [ -e "$s" ]; then
rm "$t"
ln -s "$s" "$t"
else
printf "Warning: Replacement tile not found %s\n" "$f" >&2
fi
done
fi
# Update scenery_packs.ini
(
cd "$XPLANEPATH"
k=
sed -i -e '/^SCENERY_PACK Custom Scenery\/${dirName}-.*$/d' 'Custom Scenery/scenery_packs.ini'
sed -i -e "/^SCENERY_PACK Custom Scenery\/simHeaven_X-World_Vegetation_Library/i\
$(for f in ${linkDirs} ; do
printf "''${k}SCENERY_PACK Custom Scenery/%s/" "$f"
k='\\n'
done)" 'Custom Scenery/scenery_packs.ini'
)
'';
revert = ''
for f in ${linkDirs} ; do
rm -r "$XPLANEPATH/Custom Scenery/$f"
done
'';
};
}