Skip to content
This repository was archived by the owner on Nov 17, 2024. It is now read-only.

Commit 73ea77b

Browse files
author
Cosmo Myzrail Gorynych
committed
Merge commit '9e188b214f2c0ee6c91e05c6bda68f0b709ca7af'
2 parents 1736f4c + 9e188b2 commit 73ea77b

File tree

28 files changed

+409
-131
lines changed

28 files changed

+409
-131
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/data/ct.libs/place/blocks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = [{
22
name: 'Move this copy along a line stopping at',
3-
name_Ru: 'Переместить эту копию по линии, останавливаясь перед',
3+
name_Ru: 'Переместиться по линии, останавливаясь перед группой',
44
type: 'command',
55
code: 'move template bullet',
66
icon: 'move',
@@ -29,7 +29,7 @@ module.exports = [{
2929
}
3030
}, {
3131
name: 'Move this copy stopping at',
32-
name_Ru: 'Переместить эту копию, останавливаясь перед',
32+
name_Ru: 'Переместиться, останавливаясь перед группой',
3333
type: 'command',
3434
code: 'move template smart',
3535
icon: 'move',

app/data/ct.libs/place/types.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ declare namespace place {
104104
*
105105
* @param {Copy} me The object to check collisions on
106106
* @param {String} [cgroup] The collision group to check against
107+
* @catnipName place is free for copy
108+
* @catnipName_Ru место для копии свободно
107109
*/
108110
function free(me: Copy, cgroup?: string): boolean;
109111

@@ -131,6 +133,8 @@ declare namespace place {
131133
* @param {String} [cgroup] The collision group to check against
132134
* @returns {Copy|PIXI.Sprite|false} The collided copy, or `false`
133135
* if there were no collisions.
136+
* @catnipName occupying object for
137+
* @catnipName_Ru занимает место для
134138
*/
135139
function occupied(me: Copy, cgroup?: string): Copy | false;
136140
/**
@@ -168,6 +172,8 @@ declare namespace place {
168172
* @param {String} [template] The name of the template to check agains
169173
* @catnipAsset template:template
170174
* @returns {Copy|Array<Copy>} The collided copy or `false`, if there was no collision.
175+
* @catnipName occupied by a template
176+
* @catnipName_Ru занято шаблоном
171177
*/
172178
function meet(me: Copy, template: string): Copy | false;
173179
/**
@@ -275,9 +281,7 @@ declare namespace place {
275281
* returns `false`. If a copy met an obstacle as another copy, returns this copy.
276282
* If there was a tile, returns `true`.
277283
*
278-
* @catnipSaveReturn
279-
* @catnipName Move a copy along a line
280-
* @catnipName_Ru Передвинуть копию вдоль линии
284+
* @catnipIgnore
281285
*/
282286
function moveAlong(
283287
me: Copy, direction: number, maxLength: number, cgroup?: string, stepSize?: number
@@ -299,9 +303,7 @@ declare namespace place {
299303
* @returns {false|ISeparateMovementResult} `false` if it reached its target,
300304
* an object with each axis specified otherwise.
301305
*
302-
* @catnipSaveReturn
303-
* @catnipName Move a copy by distance
304-
* @catnipName_Ru Передвинуть копию на расстояние
306+
* @catnipIgnore
305307
*/
306308
function moveByAxes(me: Copy, dx: number, dy: number, cgroup?: string, stepSize?: number):
307309
false | ISeparateMovementResult;

app/data/ct.libs/pointer/types.d.ts

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,101 +101,150 @@ declare namespace pointer {
101101
* @catnipIgnore
102102
*/
103103
var released: IPointer[];
104-
/** The horizontal position at which the primary pointer is positioned. */
104+
/**
105+
* The horizontal position at which the primary pointer is positioned.
106+
* @catnipName pointer's x
107+
* @catnipName_Ru x указателя
108+
*/
105109
var x: number;
106-
/** The vertical position at which the primary pointer is positioned. */
110+
/**
111+
* The vertical position at which the primary pointer is positioned.
112+
* @catnipName pointer's y
113+
* @catnipName_Ru y указателя
114+
*/
107115
var y: number;
108-
/** The horizontal position at which the primary pointer is positioned, in UI space.*/
116+
/**
117+
* The horizontal position at which the primary pointer is positioned, in UI space.
118+
* @catnipName pointer's x for ui
119+
* @catnipName_Ru x указателя для ui
120+
*/
109121
var xui: number;
110-
/** The vertical position at which the primary pointer is positioned, in UI space.*/
122+
/**
123+
* The vertical position at which the primary pointer is positioned, in UI space.
124+
* @catnipName pointer's y for ui
125+
* @catnipName_Ru y указателя для ui
126+
*/
111127
var yui: number;
112128
/**
113129
* The horizontal position of the primary pointer in the previous frame,
114130
* in gameplay coordinates.
131+
* @catnipName pointer's previous x
132+
* @catnipName_Ru предыдущий x указателя
115133
*/
116134
var xprev: number;
117135
/**
118136
* The vertical position of the primary pointer in the previous frame,
119137
* in gameplay coordinates.
138+
* @catnipName pointer's previous y
139+
* @catnipName_Ru предыдущий y указателя
120140
*/
121141
var yprev: number;
122142
/**
143+
*
123144
* The horizontal position of the primary pointer in the previous frame, in UI coordinates.
145+
* @catnipName pointer's previous x in ui
146+
* @catnipName_Ru предыдущий x указателя в ui
124147
*/
125148
var xuiprev: number;
126149
/**
127150
* The vertical position of the primary pointer in the previous frame, in UI coordinates.
151+
* @catnipName pointer's previous y in ui
152+
* @catnipName_Ru предыдущий y указателя в ui
128153
*/
129154
var yuiprev: number;
130155
/**
131156
* The current tracked position of a locked pointer in UI space.
132157
* Note that it only changes when ct.pointer works in the locking mode.
133158
* The initial value of the locked pointer is set to the last known position
134159
* of the unlocked primary pointer.
160+
* @catnipName locked pointer's x
161+
* @catnipName_Ru x захвач. указателя
135162
*/
136163
var xlocked: number;
137164
/**
138165
* The current tracked position of a locked pointer in UI space.
139166
* Note that it only changes when ct.pointer works in the locking mode.
140167
* The initial value of the locked pointer is set to the last known position
141168
* of the unlocked primary pointer.
169+
* @catnipName locked pointer's y
170+
* @catnipName_Ru y захвач. указателя
142171
*/
143172
var ylocked: number;
144173
/**
145174
* The current movement speed of a locked pointer relative to UI space.
146175
* Note that it only changes when ct.pointer works in the locking mode.
176+
* @catnipName locked pointer's x movement
177+
* @catnipName_Ru движение по x захвач. указателя
147178
*/
148179
var xmovement: number;
149180
/**
150181
* The current movement speed of a locked pointer relative to UI space.
151182
* Note that it only changes when ct.pointer works in the locking mode.
183+
* @catnipName locked pointer's y movement
184+
* @catnipName_Ru движение по y захвач. указателя
152185
*/
153186
var ymovement: number;
154187
/**
155188
* The current pressure made onto the primary pointer.
156189
* Note that this property is usually defined for special pointer types,
157190
* e.g. for graphic tablet's digital pens.
158191
* You will usually get 0.5 for mouse and touch events of regular devices.
192+
* @catnipName pointer's pressure
193+
* @catnipName_Ru нажим указателя
159194
*/
160195
var pressure: number;
161196
/**
162197
* A number that, with a proper bitmask, tells which buttons are currently pressed.
163198
* Use ct.pointer.isButtonPressed(buttonName, ct.pointer.buttons) to check
164199
* for specific buttons.
200+
* @catnipName pressed buttons
201+
* @catnipName_Ru нажатые кнопки
165202
*/
166203
var buttons: number;
167204
/**
168205
* The plane angle (in degrees, in the range of -90 to 90)
169206
* between the Y–Z plane and the plane containing both the pointer
170207
* (e.g. pen stylus) axis and the Y axis.
208+
* @catnipName pointer's x tilt
209+
* @catnipName_Ru наклон указателя по x
171210
*/
172211
var tiltX: number;
173212
/**
174213
* the plane angle (in degrees, in the range of -90 to 90)
175214
* between the X–Z plane and the plane containing both the pointer
176215
* (e.g. pen stylus) axis and the X axis.
216+
* @catnipName pointer's y tilt
217+
* @catnipName_Ru наклон указателя по y
177218
*/
178219
var tiltY: number;
179220
/**
180221
* The clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees,
181222
* with a value in the range 0 to 359.
223+
* @catnipName pointer's twist
224+
* @catnipName_Ru поворот указателя
182225
*/
183226
var twist: number;
184227
/**
185228
* The size of the primary pointer, in UI coordinates.
186229
* Depending on the type of the pointer, this property may not be available
187230
* and will be equal to 0 or something close to 1.
231+
* @catnipName pointer's width
232+
* @catnipName_Ru ширина указателя
188233
*/
189234
var width: number;
190235
/**
191236
* The size of the primary pointer, in UI coordinates.
192237
* Depending on the type of the pointer, this property may not be available
193238
* and will be equal to 0 or something close to 1.
239+
* @catnipName pointer's height
240+
* @catnipName_Ru высота указателя
194241
*/
195242
var height: number;
196243
/**
197244
* The type of the pointer used most recently (the one that was pressed).
198245
* It usually equals to either 'mouse', 'touch', or 'pen'.
246+
* @catnipName pointer's type
247+
* @catnipName_Ru тип указателя
199248
*/
200249
var type: string;
201250

@@ -204,16 +253,25 @@ declare namespace pointer {
204253
* It can be used to reset the state of ct.pointer, but note that hover events
205254
* are reset as well meaning that pointers (like mouse) will report them only
206255
* when they become active again (for example, with a mouse click).
256+
*
257+
* @catnipName Clear pointers' events
258+
* @catnipName_Ru Очистить события указателей
207259
*/
208260
function clear(): void;
209261
/**
210262
* Clears all the memorized pointer events that were released in the current frame.
263+
*
264+
* @catnipName Clear pointers' "released" event
265+
* @catnipName_Ru Очистить события отпущенных указателей
211266
*/
212267
function clearReleased(): void;
213268
/**
214269
* Either returns the pointer that is currently colliding with the passed copy that exists
215270
* in gameplay coordinates, or returns `false` if there is no collision.
216271
* Collisions happen only if the pointer is currently held down.
272+
*
273+
* @catnipName pointer touches
274+
* @catnipName_Ru указатель касается
217275
*/
218276
function collides(
219277
copy: Copy,
@@ -224,6 +282,9 @@ declare namespace pointer {
224282
* Either returns the pointer that is currently colliding with the passed copy that exists
225283
* in UI coordinates, or returns `false` if there is no collision.
226284
* Collisions happen only if the pointer is currently held down.
285+
*
286+
* @catnipName pointer touches ui
287+
* @catnipName_Ru указатель касается ui
227288
*/
228289
function collidesUi(
229290
copy: Copy,
@@ -233,20 +294,41 @@ declare namespace pointer {
233294
/**
234295
* Either returns the pointer that is currently hovering over the passed copy that exists
235296
* in gameplay coordinates, or returns `false` if there is no such pointers.
297+
*
298+
* @catnipName pointer hovers
299+
* @catnipName_Ru указатель над
236300
*/
237301
function hovers(copy: Copy, pointer?: IPointer): false | IPointer;
238302
/**
239303
* Either returns the pointer that is currently hovering over the passed copy that exists
240304
* in UI coordinates, or returns `false` if there is no such pointers.
305+
*
306+
* @catnipName pointer hovers ui
307+
* @catnipName_Ru указатель над ui
241308
*/
242309
function hoversUi(copy: Copy, pointer?: IPointer): false | IPointer;
310+
/**
311+
* @catnipName is pointer's button pressed
312+
* @catnipName_Ru кнопка указателя нажата
313+
*/
243314
function isButtonPressed(button: PointerButtonName, pointer: IPointer): boolean;
315+
/**
316+
* @catnipName Lock the pointer
317+
* @catnipName_Ru Заблокировать указатель
318+
*/
244319
function lock(): void;
320+
/**
321+
* @catnipName Unlock the pointer
322+
* @catnipName_Ru Разблокировать указатель
323+
*/
245324
function unlock(): void;
246325
/**
247326
* Equals to `true` when the pointer is locked.
248327
* Note that the pointer can still be unlocked while the locking mode is on,
249328
* for example after a player pressed ESC key or switched to a different window.
329+
*
330+
* @catnipName is pointer locked
331+
* @catnipName_Ru указатель заблокирован
250332
*/
251333
var locked: boolean;
252334
}

app/data/ct.libs/random/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Returns a random float value between 0 and x, exclusive.
88

99
### `random.dice(dice1,dice2,...diceN)`
1010
Returns a random given argument.
11+
When given just one string value, the string will be split by `,` separator and a random item will be returned.
1112

1213
### `random.range(x1, x2)`
1314
Returns a random float value between `x1` and `x2`, exclusive.

app/data/ct.libs/random/index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
const random = function random(x) {
44
return Math.random() * x;
55
};
6-
function processRandomInput(input) {
7-
if (input.length === 1 && typeof input[0] === "string") {
8-
return input[0].split(",");
6+
const processRandomInput = function (input) {
7+
if (input.length === 1 && typeof input[0] === 'string') {
8+
return input[0].split(',');
99
}
1010
return input;
11-
}
11+
};
1212
Object.assign(random, {
1313
dice(...variants) {
1414
const dices = processRandomInput(variants);
1515
if (Array.isArray(dices) && dices.length > 0) {
16-
const result = dices[Math.floor(Math.random() * dices.length)];
17-
const parsedResult = parseFloat(result);
18-
return isNaN(parsedResult) ? result : parsedResult;
16+
return dices[Math.floor(Math.random() * dices.length)];
1917
}
18+
return null;
2019
},
2120
histogram(...histogram) {
2221
const coeffs = [...processRandomInput(histogram)];
@@ -50,7 +49,10 @@ Object.assign(random, {
5049
return Math.random() * 360;
5150
},
5251
coord() {
53-
return [Math.floor(Math.random() * camera.width), Math.floor(Math.random() * camera.height)];
52+
return [
53+
Math.floor(Math.random() * camera.width),
54+
Math.floor(Math.random() * camera.height)
55+
];
5456
},
5557
chance(x, y) {
5658
if (y) {

0 commit comments

Comments
 (0)