Astroport.ONE/adventure/adventure.sh

67 lines
2.5 KiB
Bash
Raw Normal View History

2022-10-30 02:22:28 +01:00
#!/bin/bash
2023-11-07 20:13:59 +01:00
###################################################################
# This Launch script is based on BashVenture.
2022-10-30 02:22:28 +01:00
#
# Remember, kids - sharing is caring! Keep it open. Spread the love.
# - @BenNunney
# Thanks and gratitude to all living creatures and the whole creation.
# - @Fred
# $AGE×365,25×24×60×60×9,807÷299792458 = RELATIVE LIGHT GRAVITY SPEED
2023-11-07 11:36:15 +01:00
###################################################################
# Guide avancé d'écriture des scripts Bash : https://abs.traduc.org/abs-fr/
2024-01-31 12:32:08 +01:00
# GAMESHELL : https://github.com/phyver/GameShell/
2023-11-07 11:36:15 +01:00
###################################################################
2022-11-12 15:19:42 +01:00
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
2024-01-31 12:32:08 +01:00
###################################################################
### CREER VOTRE PROPRE VERSION DU JEU
### CHOISIR SCENARIO
2023-11-07 20:13:59 +01:00
###################################################################
2022-10-30 02:22:28 +01:00
if hash uuidgen 2>/dev/null; then
2023-11-07 11:36:15 +01:00
homefolder=$(pwd)
newplayer=$(uuidgen)
## Copy Player Game Files
2024-02-05 16:15:13 +01:00
mkdir -p "$HOME/.zen/adventure/$newplayer"
if [ -d "$MY_PATH/rooms" ]; then
cp -r "$MY_PATH/rooms" "$HOME/.zen/adventure/$newplayer/"
else
echo "Source directory $MY_PATH/rooms does not exist or is not a directory."
fi
if [ -d "$MY_PATH/art" ]; then
cp -r "$MY_PATH/art" "$HOME/.zen/adventure/$newplayer/"
else
echo "Source directory $MY_PATH/art does not exist or is not a directory."
fi
if [ -d "$MY_PATH/script" ]; then
cp -r "$MY_PATH/script" "$HOME/.zen/adventure/$newplayer/"
else
echo "Source directory $MY_PATH/script does not exist or is not a directory."
fi
if [ -d "$MY_PATH/logic" ]; then
cp -r "$MY_PATH/logic" "$HOME/.zen/adventure/$newplayer/"
else
echo "Source directory $MY_PATH/logic does not exist or is not a directory."
fi
2022-10-30 02:22:28 +01:00
fi
2024-02-05 16:15:13 +01:00
2023-11-07 20:13:59 +01:00
###################################################################
2022-10-30 02:22:28 +01:00
echo "Loading..."
echo
2023-11-07 20:13:59 +01:00
###################################################################
2022-10-30 02:22:28 +01:00
if hash uuidgen 2>/dev/null; then
2023-11-07 11:36:15 +01:00
cd $HOME/.zen/adventure/$newplayer/rooms
2022-10-30 02:22:28 +01:00
else
2023-11-07 11:36:15 +01:00
cd rooms
2022-10-30 02:22:28 +01:00
fi
./start.sh
2023-11-07 20:13:59 +01:00
###################################################################
2022-10-30 02:22:28 +01:00
if hash uuidgen 2>/dev/null; then
2023-11-07 20:13:59 +01:00
cd "$homefolder"
rm -r $HOME/.zen/adventure/$newplayer
2022-10-30 02:22:28 +01:00
fi
2023-11-07 20:13:59 +01:00
echo "To continue..."
2024-02-05 16:15:13 +01:00
exit