8000 Merge commit '9e336a7e66b035f281ac1a2cb181abc3dbc6f999' into develop · ct-js/ct-js@0dba970 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0dba970

Browse files
Merge commit '9e336a7e66b035f281ac1a2cb181abc3dbc6f999' into develop
2 parents 13b41bc + 9e336a7 commit 0dba970

File tree

8 files changed

+105
-37
lines changed

8 files changed

+105
-37
lines changed

app/Changelog.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
## v5.2.1
2+
3+
*Mon Nov 04 2024*
4+
5+
### ⚡️ General Improvements
6+
7+
* Catnip: Add mutators to timer blocks
8+
* Catnip: Add mutators for "action is down/pressed/released" blocks
9+
* Ct.js now checks whether recovery file actually differs from the regular project file
10+
* Room editor: you can now navigate around with Spacebar + Left mouse button (Closes #526)
11+
* :globe_with_meridians: Catnip: Improve Russian translations for ct.place
12+
* :globe_with_meridians: Catnip: Translate Pointer catmod to Russian and add more human-readable English names
13+
* :globe_with_meridians: Catnip: Translate the Random catmod's blocks to Russian
14+
15+
### 🐛 Bug Fixes
16+
17+
* Catnip: Add missing translation keys to Math operators
18+
* Catnip: Fix catnip blocks ignoring translations when there was a translated name without a translated label
19+
* Catnip: Fix inability to compile Script assets with Catnip code
20+
* Catnip: Properly mark the required arguments in the Logic category
21+
* Fields with invalid values should be outlined red
22+
* Fix ct.js saving projects' scripts with CRLF sequence instead of LF, which caused them to be one-lined in the .ict file, making merging changes harder for Git users. You can fix the existing scripts by cutting and pasting their contents back.
23+
* Fix minor styling issues on the homepage
24+
* Fix `random.dice` trying to convert string values to floats (Closes #544)
25+
* Make sure there are no special characters in the project name when creating one (Closes #543)
26+
27+
### 📝 Docs
28+
29+
* :bug: Fix brainless translation with room.append in Russian version of the JettyCat tutorial (Closes #141)
30+
131
## v5.2.0
232

333
*Sun Oct 13 2024*

app/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"main": "index.html",
33
"name": "ctjs",
44
"description": "ct.js — a free 2D game engine",
5-
"version": "5.2.0",
5+
"version": "5.2.1",
66
"homepage": "https://ctjs.rocks/",
77
"author": {
88
"name": "Cosmo Myzrail Gorynych",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ctjsbuildenvironment",
3-
"version": "5.2.0",
3+
"version": "5.2.1",
44
"description": "",
55
"directories": {
66
"doc": "docs"

src/node_requires/catnip/stdLib/logic.ts

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
1414
pieces: [{
1515
type: 'argument',
1616
key: 'condition',
17-
typeHint: 'boolean'
17+
typeHint: 'boolean',
18+
required: true
1819
}, {
1920
placeholder: 'doNothing',
2021
type: 'blocks',
@@ -38,7 +39,8 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
3839
pieces: [{
3940
type: 'argument',
4041
key: 'condition',
41-
typeHint: 'boolean'
42+
typeHint: 'boolean',
43+
required: true
4244
}, {
4345
placeholder: 'doNothing',
4446
type: 'blocks',
@@ -72,7 +74,8 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
7274
pieces: [{
7375
type: 'argument',
7476
key: 'condition',
75-
typeHint: 'boolean'
77+
typeHint: 'boolean',
78+
required: true
7679
}, {
7780
type: 'blocks',
7881
key: 'body'
@@ -95,7 +98,8 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
9598
pieces: [{
9699
type: 'argument',
97100
key: 'N',
98-
typeHint: 'number'
101+
typeHint: 'number',
102+
required: true
99103
}, {
100104
type: 'label',
101105
name: 'times',
@@ -109,7 +113,8 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
109113
}, {
110114
type: 'argument',
111115
key: 'variableName',
112-
typeHint: 'wildcard'
116+
typeHint: 'wildcard',
117+
required: true
113118
}, {
114119
type: 'blocks',
115120
key: 'body'
@@ -127,15 +132,17 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
127132
pieces: [{
128133
type: 'argument',
129134
key: 'variableName',
130-
typeHint: 'wildcard'
135+
typeHint: 'wildcard',
136+
required: true
131137
}, {
132138
type: 'label',
133139
name: 'of array',
134140
i18nKey: 'of array'
135141
}, {
136142
type: 'argument',
137143
key: 'array',
138-
typeHint: 'wildcard'
144+
typeHint: 'wildcard',
145+
required: true
139146
}, {
140147
type: 'blocks',
141148
key: 'body'
@@ -162,15 +169,17 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
162169
pieces: [{
163170
type: 'argument',
164171
key: 'a',
165-
typeHint: 'boolean'
172+
typeHint: 'boolean',
173+
required: true
166174
}, {
167175
type: 'label',
168176
name: 'and',
169177
i18nKey: 'AND'
170178
}, {
171179
type: 'argument',
172180
key: 'b',
173-
typeHint: 'boolean'
181+
typeHint: 'boolean',
182+
required: true
174183
}],
175184
jsTemplate: (args) => `(${args.a} && ${args.b})`
176185
}, {
@@ -186,23 +195,26 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
186195
pieces: [{
187196
type: 'argument',
188197
key: 'a',
189-
typeHint: 'boolean'
198+
typeHint: 'boolean',
199+
required: true
190200
}, {
191201
type: 'label',
192202
name: 'and',
193203
i18nKey: 'AND'
194204
}, {
195205
type: 'argument',
196206
key: 'b',
197-
typeHint: 'boolean'
207+
typeHint: 'boolean',
208+
required: true
198209
}, {
199210
type: 'label',
200211
name: 'and',
201212
i18nKey: 'AND'
202213
}, {
203214
type: 'argument',
204215
key: 'c',
205-
typeHint: 'boolean'
216+
typeHint: 'boolean',
217+
required: true
206218
}],
207219
jsTemplate: (args) => `(${args.a} && ${args.b} && ${args.c})`
208220
}, {
@@ -218,15 +230,17 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
218230
pieces: [{
219231
type: 'argument',
220232
key: 'a',
221-
typeHint: 'boolean'
233+
typeHint: 'boolean',
234+
required: true
222235
}, {
223236
type: 'label',
224237
name: 'or',
225238
i18nKey: 'OR'
226239
}, {
227240
type: 'argument',
228241
key: 'b',
229-
typeHint: 'boolean'
242+
typeHint: 'boolean',
243+
required: true
230244
}],
231245
jsTemplate: (args) => `(${args.a} || ${args.b})`
232246
}, {
@@ -242,23 +256,26 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
242256
pieces: [{
243257
type: 'argument',
244258
key: 'a',
245-
typeHint: 'boolean'
259+
typeHint: 'boolean',
260+
required: true
246261
}, {
247262
type: 'label',
248263
name: 'or',
249264
i18nKey: 'OR'
250265
}, {
251266
type: 'argument',
252267
key: 'b',
253-
typeHint: 'boolean'
268+
typeHint: 'boolean',
269+
required: true
254270
}, {
255271
type: 'label',
256272
name: 'or',
257273
i18nKey: 'OR'
258274
}, {
259275
type: 'argument',
260276
key: 'c',
261-
typeHint: 'boolean'
277+
typeHint: 'boolean',
278+
required: true
262279
}],
263280
jsTemplate: (args) => `(${args.a} || ${args.b} || ${args.c})`
264281
}, {
@@ -275,7 +292,8 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
275292
pieces: [{
276293
type: 'argument',
277294
key: 'a',
278-
typeHint: 'boolean'
295+
typeHint: 'boolean',
296+
required: true
279297
}],
280298
jsTemplate: (args) => `!${args.a}`
281299
}, {

src/node_requires/exporter/scripts.ts

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {ExporterError, highlightProblem} from './ExporterError';
22
import {coffeeScriptOptions} from './scriptableProcessor';
3+
import {compile as compileCatnip} from '../catnip/compiler';
34

45
const compileCoffee = require('coffeescript').CoffeeScript.compile;
56
const typeScript = require('sucrase').transform;
@@ -8,22 +9,41 @@ export const stringifyScripts = (scripts: IScript[]): string =>
89
scripts.reduce((acc, script) => {
910
let code;
1011
try { // Apply converters to the user's code first
11-
code = script.language === 'coffeescript' ?
12-
compileCoffee(script.code, coffeeScriptOptions) :
13-
typeScript(script.code, {
12+
switch (script.language) {
13+
case 'typescript':
14+
({code} = typeScript(script.code, {
1415
transforms: ['typescript']
15-
}).code;
16+
}));
17+
break;
18+
case 'coffeescript':
19+
code = compileCoffee(script.code, coffeeScriptOptions);
20+
break;
21+
case 'catnip':
22+
code = compileCatnip(script.code as BlockScript, {
23+
resourceId: script.uid,
24+
resourceName: script.name,
25+
resourceType: script.type,
26+
eventKey: 'onRun'
27+
});
28+
break;
29+
default: throw new Error(`Unsupported script language: ${script.language}`);
30+
}
1631
return acc + `'${script.name}': function (options) {${code}},`;
1732
} catch (e) {
1833
const errorMessage = `${e.name || 'An error'} occured while compiling script ${script.name}`;
19-
const exporterError = new ExporterError(errorMessage, {
20-
resourceId: script.uid,
21-
resourceName: script.name,
22-
resourceType: script.type,
23-
problematicCode: highlightProblem(e.code || code, e.location || e.loc),
24-
clue: 'syntax'
25-
}, e);
26-
throw exporterError;
34+
if (e instanceof ExporterError) {
35+
// Passthrough already formatted errors, mainly coming from Catnip
36+
throw e;
37+
} else {
38+
const exporterError = new ExporterError(errorMessage, {
39+
resourceId: script.uid,
40+
resourceName: script.name,
41+
resourceType: script.type,
42+
problematicCode: highlightProblem(e.code || code, e.location || e.loc),
43+
clue: 'syntax'
44+
}, e);
45+
throw exporterError;
46+
}
2747
}
2848
}, '');
2949

0 commit comments

Comments
 (0)
0