Skip to content

Commit 13e435a

Browse files
committed
init commit
0 parents  commit 13e435a

File tree

15 files changed

+623
-0
lines changed

15 files changed

+623
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# FS Project
2+
package-lock.json
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# Snowpack dependency directory (https://snowpack.dev/)
49+
web_modules/
50+
51+
# TypeScript cache
52+
*.tsbuildinfo
53+
54+
# Optional npm cache directory
55+
.npm
56+
57+
# Optional eslint cache
58+
.eslintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variables file
76+
.env
77+
.env.test
78+
.env.production
79+
80+
# parcel-bundler cache (https://parceljs.org/)
81+
.cache
82+
.parcel-cache
83+
84+
# Next.js build output
85+
.next
86+
out
87+
88+
# Nuxt.js build / generate output
89+
.nuxt
90+
dist
91+
92+
# Gatsby files
93+
.cache/
94+
# Comment in the public line in if your project uses Gatsby and not Next.js
95+
# https://nextjs.org/blog/next-9-1#public-directory-support
96+
# public
97+
98+
# vuepress build output
99+
.vuepress/dist
100+
101+
# Serverless directories
102+
.serverless/
103+
104+
# FuseBox cache
105+
.fusebox/
106+
107+
# DynamoDB Local files
108+
.dynamodb/
109+
110+
# TernJS port file
111+
.tern-port
112+
113+
# Stores VSCode versions used for testing VSCode extensions
114+
.vscode-test
115+
116+
# yarn v2
117+
.yarn/cache
118+
.yarn/unplugged
119+
.yarn/build-state.yml
120+
.yarn/install-state.gz
121+
.pnp.*

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
3+
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# FS22_Example
2+
3+
TypeScript-to-Lua example project for Farming Simulator 2022.
4+
5+
Based off of [loki79uk/FS22_FreeLabour](https://github.com/loki79uk/FS22_FreeLabour)

assets/modDesc.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
2+
<modDesc descVersion="61">
3+
<author>loki_79 and Zed</author>
4+
<version>1.0.0.0</version>
5+
<title>
6+
<en>FreeLabour</en>
7+
</title>
8+
<description>
9+
<en>FreeLabour written in TypeScript</en>
10+
</description>
11+
<multiplayer supported="true"/>
12+
<iconFilename>modIcon.dds</iconFilename>
13+
<extraSourceFiles>
14+
<sourceFile filename="main.lua" />
15+
</extraSourceFiles>
16+
<dependencies>
17+
<dependency>a050_FS22_TSTL_Library</dependency>
18+
</dependencies>
19+
</modDesc>

assets/modIcon.dds

32.1 KB
Binary file not shown.

config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": ".\\scripts\\configSchema.json",
3+
"buildArchive": true,
4+
"minifyScripts": false,
5+
6+
"fsUserDir": "C:\\Users\\Z-Machine\\Documents\\My Games\\FarmingSimulator2022",
7+
"log": "log.txt",
8+
9+
"fsModDir": "C:\\Users\\Z-Machine\\Documents\\My Games\\FarmingSimulator2022\\mods",
10+
"modName": "FS22_FreeLabour",
11+
12+
"fsGameDir": "Z:\\!games\\Farming Simulator 22",
13+
"fsGameBin": "x64\\FarmingSimulator2022Game.exe",
14+
"launchOptions": [
15+
"-autoStartSavegameId 3",
16+
"-mpDebuggable"
17+
]
18+
}

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "fs22_example",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "./src/main.ts",
6+
"scripts": {
7+
"bundle": "ts-node ./scripts/bundle.ts",
8+
"build": "npm run validate:xml && npm run bundle",
9+
"build:test": "npm run build && npm run game",
10+
"game": "ts-node ./scripts/runGame.ts",
11+
"validate:xml": "ts-node ./scripts/validate.ts"
12+
},
13+
"author": "",
14+
"license": "",
15+
"devDependencies": {
16+
"@types/adm-zip": "^0.4.34",
17+
"@types/fs-extra": "^9.0.13",
18+
"@types/node": "^16.11.10",
19+
"adm-zip": "^0.5.9",
20+
"fast-xml-parser": "^4.0.0-beta.2",
21+
"fs-extra": "^10.0.0",
22+
"lua-types": "^2.10.1",
23+
"luamin": "^1.0.4",
24+
"ts-node": "^10.4.0",
25+
"typescript-to-lua": "^1.2.0"
26+
},
27+
"dependencies": {
28+
"typescript": "^4.5.2"
29+
}
30+
}

scripts/bundle.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { execSync } from "child_process";
2+
import * as utils from "./utils";
3+
4+
(function () {
5+
const args: Set<string> = new Set();
6+
for (let i = 2; i < process.argv.length; i++) {
7+
const arg = process.argv[i];
8+
console.log(`${i}: ${arg}`);
9+
args.add(arg);
10+
}
11+
12+
const projectConfig = utils.fetchProjectConfig();
13+
14+
if (args.has("-minify"))
15+
projectConfig.minifyScripts = true;
16+
17+
if (args.has("-archive"))
18+
projectConfig.buildArchive = true;
19+
20+
console.info('Bundling mod...')
21+
const modBundled = utils.bundleMod(projectConfig);
22+
if (!modBundled) {
23+
console.error(`Failed to bundle mod.`);
24+
return;
25+
}
26+
27+
console.info('Installing mod...')
28+
const modInstalled = utils.installMod(projectConfig);
29+
if (!modInstalled) {
30+
console.error(`Failed to install mod.`)
31+
return;
32+
}
33+
})();

scripts/configSchema.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json-schema.org/schema",
3+
"$title": "Project Config",
4+
"type": "object",
5+
"description": "the project's configuration file",
6+
"properties": {
7+
"buildArchive": {
8+
"type": "boolean",
9+
"description": "Should the mod be bundled into an archive?",
10+
"default": false
11+
},
12+
"minifyScripts": {
13+
"type": "boolean",
14+
"description": "Should the mod's scripts be minified during bundling?",
15+
"default": false
16+
},
17+
"fsUserDir": {
18+
"type": "string"
19+
},
20+
"log": {
21+
"type": "string",
22+
"description": "filename of the log file"
23+
},
24+
"fsModDir": {
25+
"type": "string"
26+
},
27+
"modName": {
28+
"type": "string",
29+
"description": "The name of the mod used when bundling"
30+
},
31+
"fsGameDir": {
32+
"type": "string"
33+
},
34+
"fsGameBin": {
35+
"type": "string"
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)