#!/bin/sh
# SPDX-License-Identifier: ACSL
# SPDX-FileCopyrightText: © 2022 Antoine Le Gonidec <vv221@dotslashplay.it>
set -o errexit

###
# Children of Morta expansions:
# - Ancient Spirits
# - Paws and Claws
# send your bug reports to bugs@dotslashplay.it
###

script_version=20260711.1

PLAYIT_COMPATIBILITY_LEVEL=2.35

GAME_ID=children-of-morta
GAME_NAME='Children of Morta'

EXPANSION_ID_ANCIENT=ancient-spirits
EXPANSION_NAME_ANCIENT='Ancient Spirits'

EXPANSION_ID_PAWS=paws-and-claws
EXPANSION_NAME_PAWS='Paws and Claws'

ARCHIVE_BASE_ANCIENT_0_NAME='backers_dlc_1_2_63_48061.sh'
ARCHIVE_BASE_ANCIENT_0_MD5=931cfdfd304b909efbe61ac4d6c10b34
ARCHIVE_BASE_ANCIENT_0_SIZE=1026
ARCHIVE_BASE_ANCIENT_0_VERSION=1.2.63-1

ARCHIVE_BASE_PAWS_0_NAME='children_of_morta_paws_and_claws_1_2_63_48061.sh'
ARCHIVE_BASE_PAWS_0_MD5=09efef01a9bd0c1a5172e1fe7fd19530
ARCHIVE_BASE_PAWS_0_SIZE=1026
ARCHIVE_BASE_PAWS_0_VERSION=1.2.63-1

CONTENT_PATH_DEFAULT='data/noarch/game'
CONTENT_GAME_MAIN_FILES='
goggame-*.info'

PKG_PARENT_ID=$GAME_ID
PKG_MAIN_DEPENDENCIES_SIBLINGS=PKG_PARENT

# Load common functions.

if [ -z "$PLAYIT_LIB2" ]; then
	for playit_lib_dir in \
		"$PWD" \
		"${HOME}/.local/lib/play.it" \
		'/usr/local/lib/play.it' \
		'/usr/lib/play.it'
	do
		playit_lib_path=${playit_lib_dir}/libplayit.sh.2
		if [ -e "$playit_lib_path" ]; then
			PLAYIT_LIB2=$playit_lib_path
			break
		fi
	done
fi
if [ -z "$PLAYIT_LIB2" ]; then
	printf '\n\033[1;31mError:\033[0m\n'
	printf 'libplayit.sh.2 not found.\n'
	exit 1
fi
. "$PLAYIT_LIB2"

# Run default initialisation actions.

initialization_default "$@"

# Extract archive contents.

archive_extraction_default

# Include game data.

content_inclusion_default

# Build packages.

packages_generation
print_instructions

# Clean up.

working_directory_cleanup

exit 0
