-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 24c475f
Showing
11 changed files
with
626 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
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,8 @@ | ||
# Ignore built packages | ||
*.zip | ||
|
||
# Ignore build dir | ||
/build/ | ||
|
||
# Ignore local setup script | ||
/setup.sh |
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 @@ | ||
5.2.1 |
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,6 @@ | ||
{ | ||
"recommendations": [ | ||
"justarandomgeek.factoriomod-debug", | ||
"sumneko.lua" | ||
] | ||
} |
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,26 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "factoriomod", | ||
"request": "launch", | ||
"name": "Factorio Mod Debug" | ||
}, | ||
{ | ||
"type": "factoriomod", | ||
"request": "launch", | ||
"name": "Factorio Mod Debug (Settings & Data)", | ||
"hookSettings": true, | ||
"hookData": true | ||
}, | ||
{ | ||
"type": "factoriomod", | ||
"request": "launch", | ||
"name": "Factorio Mod Debug (Profile)", | ||
"hookMode": "profile" | ||
} | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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,18 @@ | ||
# Cybersyn Combinator | ||
|
||
A mod for Factorio that adds a special combinator for use with the [Project Cybersyn][cybersyn] mod. | ||
|
||
## Usage | ||
|
||
*TODO* | ||
|
||
## License | ||
|
||
Copyright ©️ 2023 by [Adam Hellberg][sharparam]. | ||
|
||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
[sharparam]: https://sharparam.com | ||
[cybersyn]: https://mods.factorio.com/mod/cybersyn |
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,156 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
VERBOSE=false | ||
|
||
println() { | ||
cat <<< "$@" | ||
} | ||
|
||
eprintln() { | ||
cat <<< "$@" 1>&2 | ||
} | ||
|
||
vprintln() { | ||
if [[ "$VERBOSE" == true ]]; then | ||
eprintln "$@" | ||
fi | ||
} | ||
|
||
usage() { | ||
cat <<EOF | ||
Usage: $0 [-hvc] [-s SRCDIR] [-o OUTDIR] | ||
-h | ||
Displays this help message. | ||
-v | ||
Enables verbose mode. | ||
-c | ||
Cleans intermediate build files after building. | ||
-s SRCDIR | ||
Specify source directory for mod files (default is 'src'). | ||
-o OUTDIR | ||
Specify output directory for release files (default is 'build'). | ||
EOF | ||
} | ||
|
||
CLEAN=false | ||
SRCDIR="src" | ||
OUTDIR="build" | ||
|
||
OPTIND=1 | ||
|
||
while getopts "hvcs:o:" opt; do | ||
case "$opt" in | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
v) | ||
VERBOSE=true | ||
;; | ||
c) | ||
CLEAN=true | ||
;; | ||
s) | ||
SRCDIR=${OPTARG} | ||
;; | ||
o) | ||
OUTDIR=${OPTARG} | ||
;; | ||
:) | ||
eprintln "Option -$OPTARG requires an argument" | ||
exit 1 | ||
;; | ||
\?) | ||
usage 1>&2 | ||
exit 1 | ||
;; | ||
*) | ||
usage 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
VERSION="unknown" | ||
VERSION_FULL="unknown" | ||
|
||
version() { | ||
local -r fallback='0.1.0' | ||
local gitver | ||
gitver=$(git describe --always) | ||
local -r withcommit='^v([0-9]+\.[0-9]+\.[0-9]+)(-[0-9]+-[[:alnum:]]+)?$' | ||
local -r commit='^[[:alnum:]]+$' | ||
if [[ "$gitver" =~ $withcommit ]]; then | ||
# We have an exact version | ||
VERSION=${BASH_REMATCH[1]} | ||
VERSION_FULL="${BASH_REMATCH[1]}${BASH_REMATCH[2]}" | ||
elif [[ "$gitver" =~ $commit ]]; then | ||
VERSION="$fallback" | ||
VERSION_FULL="$fallback-${BASH_REMATCH[0]}" | ||
fi | ||
} | ||
|
||
version | ||
|
||
if [[ "$VERSION" == "unknown" ]]; then | ||
eprintln "Failed to resolve valid version" | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -d "$SRCDIR" ]]; then | ||
eprintln "Specified src dir $SRCDIR does not exist" | ||
exit 1 | ||
fi | ||
|
||
SRCINFO="$SRCDIR/info.json" | ||
|
||
if [[ ! -f "$SRCINFO" ]]; then | ||
eprintln "Could not locate info.json in src dir $SRCDIR" | ||
exit 1 | ||
fi | ||
|
||
MODNAME=$(jq -r .name "$SRCINFO") | ||
|
||
vprintln "Detected mod name $MODNAME" | ||
vprintln "Detected version: $VERSION ($VERSION_FULL)" | ||
|
||
vprintln "Current working dir: $PWD" | ||
|
||
vprintln "Cleaning and creating build dir" | ||
RELNAME="${MODNAME}_${VERSION}" | ||
RELDIR="$OUTDIR/${MODNAME}_$VERSION" | ||
ZIPNAME="${RELNAME}.zip" | ||
rm -rf "$OUTDIR" | ||
mkdir -p "$RELDIR" | ||
|
||
vprintln "Copying mod files to $RELDIR" | ||
cp -a "$SRCDIR/." "$RELDIR" | ||
[[ -f README.md ]] && cp -a README.md "$RELDIR" | ||
[[ -f LICENSE ]] && cp -a LICENSE "$RELDIR" | ||
|
||
RELINFO="$RELDIR/info.json" | ||
tmpinfo=$(mktemp) | ||
jq --arg version "$VERSION" '.version = $version' "$RELINFO" > "$tmpinfo" && mv "$tmpinfo" "$RELINFO" | ||
|
||
vprintln "Zip name: $ZIPNAME" | ||
( | ||
pushd "$OUTDIR" > /dev/null \ | ||
&& zip \ | ||
-r \ | ||
"$ZIPNAME" \ | ||
"$RELNAME" \ | ||
--exclude \ | ||
'*~' | ||
) | ||
|
||
if [[ "$CLEAN" == true ]]; then | ||
vprintln "Cleaning $RELDIR" | ||
rm -rf "$RELDIR" | ||
fi |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
fmtk() { | ||
exec npx factoriomod-debug@latest "$@" | ||
} | ||
|
||
if [[ -d src ]]; then | ||
(pushd src > /dev/null && fmtk "$@") | ||
else | ||
fmtk | ||
fi |
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,17 @@ | ||
{ | ||
"name": "cybersyn-combinator", | ||
"version": "0.0.0", | ||
"title": "Cybersyn Combinator", | ||
"author": "Sharparam", | ||
"contact": "[email protected]", | ||
"homepage": "https://github.com/Sharparm/cybersyn-combinator", | ||
"description": "A specialized combinator for the Project Cybersyn mod", | ||
"factorio_version": "1.1", | ||
"dependencies": [ | ||
"cybersyn" | ||
], | ||
"package": { | ||
"readme": "information.md", | ||
"faq": "faq.md" | ||
} | ||
} |
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,2 @@ | ||
[mod-description] | ||
cybersyn-combinator=A specialized combinator for the Project Cybersyn mod. |