Skip to content

Commit

Permalink
✨ First version of catnip
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Apr 7, 2024
1 parent 8d8fb53 commit 18fdacb
Show file tree
Hide file tree
Showing 151 changed files with 21,171 additions and 1,383 deletions.
1 change: 1 addition & 0 deletions app/data/ct.libs/desktop/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "Desktop features",
"tagline": "A module that provides useful desktop-specific features, such as manipulating the window, toggling the debugger/devtools, and more!",
"version": "0.3.0",
"icon": "monitor",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
"mail": "[email protected]"
Expand Down
1 change: 1 addition & 0 deletions app/data/ct.libs/gamepad/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"tagline": "Connect your gamepad to the Actions system.",
"name_Ru": "Геймпад",
"tagline_Ru": "Подключает джойстики к системе Действий.",
"icon": "airplay",
"version": "2.0.0",
"packageName": "gamepad",
"authors": [
Expand Down
1 change: 1 addition & 0 deletions app/data/ct.libs/keyboard/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"main": {
"name": "Keyboard",
"tagline": "Add keyboard events to the Actions system.",
"icon": "airplay",
"name_Ru": "Клавиатура",
"tagline_Ru": "Добавляет события клавиатуры в систему Действий.",
"version": "4.0.0",
Expand Down
6 changes: 0 additions & 6 deletions app/data/ct.libs/keyboard/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ declare namespace keyboard {
*/
var ctrl: boolean;

/**
* Temporarily suspend e.preventDefault() calls. For example, to allow for a HTML text
* box to be used.
*/
var permitDefault: boolean;

/**
* Resets all the `ct.keyboard` parameters.
*/
Expand Down
59 changes: 59 additions & 0 deletions app/data/ct.libs/place/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = [{
name: 'Move this copy along a line stopping at',
name_Ru: 'Переместить эту копию по линии, останавливаясь перед',
type: 'command',
code: 'move template bullet',
icon: 'move',
category: 'Movement',
pieces: [{
type: 'argument',
key: 'cgroup',
typeHint: 'string',
required: true
}, {
type: 'filler'
}, {
type: 'label',
name: 'store in',
i18nKey: 'store in'
}, {
type: 'argument',
key: 'return',
typeHint: 'wildcard'
}],
jsTemplate: (values) => {
if (values.return !== 'undefined') {
return `${values.return} = this.moveBullet(${values.cgroup}, ${values.precision || 1});`;
}
return `this.moveBullet(${values.cgroup}, ${values.precision || 1});`;
}
}, {
name: 'Move this copy stopping at',
name_Ru: 'Переместить эту копию, останавливаясь перед',
type: 'command',
code: 'move template smart',
icon: 'move',
category: 'Movement',
pieces: [{
type: 'argument',
key: 'cgroup',
typeHint: 'string',
required: true
}, {
type: 'filler'
}, {
type: 'label',
name: 'store in',
i18nKey: 'store in'
}, {
type: 'argument',
key: 'return',
typeHint: 'wildcard'
}],
jsTemplate: (values) => {
if (values.return !== 'undefined') {
return `${values.return} = this.moveSmart(${values.cgroup}, ${values.precision || 1});`;
}
return `this.moveSmart(${values.cgroup}, ${values.precision || 1});`;
}
}];
1 change: 1 addition & 0 deletions app/data/ct.libs/place/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"tagline": "Check for collisions, move copies continuously, and add basic collision avoidance to your copies.",
"tagline_Ru": "Проверяет столкновения, последовательно передвигает копии и предоставляет простые методы обхода препятствий вашим копиям.",
"version": "4.0.0",
"icon": "copy",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
"mail": "[email protected]"
Expand Down
57 changes: 49 additions & 8 deletions app/data/ct.libs/place/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ declare namespace place {
* @param {IShapeBearer} c1 The first object to check collision with
* @param {IShapeBearer} c2 The second object to check collision against
*
* @catnipLabel are colliding
* @catnipLabel_Ru сталкиваются
* @catnipIcon copy
*
* @returns {boolean} `true` if there was a collision, `false` otherwise
*/
function collide(c1: IShapeBearer, c2: IShapeBearer): boolean;
Expand All @@ -98,6 +102,7 @@ declare namespace place {
*
* @param {Copy} me The object to check collisions on
* @param {String} [cgroup] The collision group to check against
* @catnipName_Ru свободно
*/
function free(me: Copy, cgroup?: string): boolean;

Expand All @@ -111,6 +116,7 @@ declare namespace place {
* @param {String} [cgroup] The collision group to check against
* @returns {Copy|PIXI.Sprite|false} The collided copy or tile, or `false`
* if there is no collision.
* @catnipName_Ru занято
*/
function occupied(me: Copy, x: number, y: number, cgroup?: string):
Copy | PIXI.Sprite | false;
Expand All @@ -123,8 +129,13 @@ declare namespace place {
* @param {String} [cgroup] The collision group to check against
* @returns {Copy|PIXI.Sprite|false} The collided copy, or `false`
* if there were no collisions.
* @catnipName_Ru занято
*/
function occupied(me: Copy, cgroup?: string): Copy | false;
/**
* @catnipName all occupying
* @catnipName_Ru все занимающие место
*/
function occupiedMultiple(me: Copy, cgroup?: string): Array<Copy|PIXI.Sprite> | false;
function occupiedMultiple(me: Copy, x: number, y: number, cgroup?: string):
Array<Copy|PIXI.Sprite> | false;
Expand All @@ -142,7 +153,10 @@ declare namespace place {
* @param {number} x The x coordinate to check, as if `me` was placed there
* @param {number} y The y coordinate to check, as if `me` was placed there
* @param {String} [template] The name of the template to check against
* @catnipAsset template:template
* @returns {Copy|false} The collided copy or `false`, if there was no collision.
* @catnipName occupied by a template
* @catnipName_Ru занято шаблоном
*/
function meet(me: Copy, x: number, y: number, template: string): Copy | false;
/**
Expand All @@ -151,9 +165,14 @@ declare namespace place {
*
* @param {Copy} me The object to check collisions on
* @param {String} [template] The name of the template to check agains
* @catnipAsset template:template
* @returns {Copy|Array<Copy>} The collided copy or `false`, if there was no collision.
*/
function meet(me: Copy, template: string): Copy | false;
/**
* @catnipName all template's occupying copies
* @catnipName_Ru все занимающие место копии шаблона
*/
function meetMultiple(me: Copy, template: string): Array<Copy>;
function meetMultiple(me: Copy, x: number, y: number, template: string):Array<Copy>;

Expand All @@ -170,9 +189,15 @@ declare namespace place {
* @param {number} [x] The x coordinate to check, as if `me` was placed there.
* @param {number} [y] The y coordinate to check, as if `me` was placed there.
* @param {number} cgroup The collision group of tile layers to test against.
* @catnipName occupied by a tile
* @catnipName_Ru занято плиткой
*/
function tiles(me: Copy, x: number, y: number, cgroup: string): false|PIXI.Sprite;
function tiles(me: Copy, cgroup: string): false|PIXI.Sprite;
/**
* @catnipName all occupying tiles
* @catnipName_Ru все занимающие место плитки
*/
function tilesMultiple(me: Copy, x: number, y: number, cgroup: string): false|PIXI.Sprite[];
function tilesMultiple(me: Copy, cgroup: string): false|PIXI.Sprite[];

Expand All @@ -189,14 +214,22 @@ declare namespace place {
* @param {number} [x] The x coordinate to check, as if `me` was placed there.
* @param {number} [y] The y coordinate to check, as if `me` was placed there.
* @param {number} cgroup The collision group of tile layers to test against.
* @catnipName occupied by a copy
* @catnipName_Ru занято копией
*/
function copies(me: Copy, x: number, y: number, cgroup: string): false|Copy;
function copies(me: Copy, cgroup: string): false|Copy;
/**
* @catnipName all occupying copies
* @catnipName_Ru все занимающие место копии
*/
function copiesMultiple(me: Copy, x: number, y: number, cgroup: string): false|Copy[];
function copiesMultiple(me: Copy, cgroup: string): false|Copy[];

/**
* Returns the latest distance after calling `ct.place.furthest` or `ct.place.nearest`.
* @catnipName last distance
* @catnipName_Ru последнее расстояние
*/
var lastdist: number;

Expand All @@ -206,6 +239,8 @@ declare namespace place {
* @param {number} y The vertical position of the starting point
* @param {string} template The name of the template against which copies
* the distance will be measured
* @catnipAsset template:template
* @catnipName_Ru ближайший
*/
function nearest(x: number, y: number, template: string): Copy | false;

Expand All @@ -215,6 +250,8 @@ declare namespace place {
* @param {number} y The vertical position of the starting point
* @param {string} template The name of the template against which copies
* the distance will be measured
* @catnipAsset template:template
* @catnipName_Ru наиболее удалённый
*/
function furthest(x: number, y: number, template: string): Copy | false;

Expand All @@ -225,10 +262,6 @@ declare namespace place {
* This function is especially useful for side-view games and any fast-moving copies,
* as it allows precise movement without clipping or passing through surfaces.
*
* @remarks
* You will usually need to premultiply `maxLength` with `u.delta`
* so that the speed is consistent under different FPS rates.
*
* @param {Copy} me The copy that needs to be moved
* @param {number} direction The direction in which to perform a movement
* @param {number} maxLength The maximum distance a copy can traverse
Expand All @@ -238,6 +271,10 @@ declare namespace place {
* @returns {Copy|boolean} If there was no collision and a copy reached its target,
* returns `false`. If a copy met an obstacle as another copy, returns this copy.
* If there was a tile, returns `true`.
*
* @catnipSaveReturn
* @catnipName Move a copy along a line
* @catnipName_Ru Передвинуть копию вдоль линии
*/
function moveAlong(
me: Copy, direction: number, maxLength: number, cgroup?: string, stepSize?: number
Expand All @@ -250,10 +287,6 @@ declare namespace place {
* and set precision with `stepSize` (default is `1`, which means pixel-by-pixel movement).
* This movement suits characters in top-down and side-view worlds.
*
* @remarks
* You will usually need to premultiply `dx` and `dy` with `u.delta`
* so that the speed is consistent under different FPS rates.
*
* @param {Copy} me The copy that needs to be moved
* @param {number} dx Amount of pixels to move by X axis
* @param {number} dy Amount of pixels to move by Y axis
Expand All @@ -262,6 +295,10 @@ declare namespace place {
* @param {number} [stepSize=1] Precision of movement
* @returns {false|ISeparateMovementResult} `false` if it reached its target,
* an object with each axis specified otherwise.
*
* @catnipSaveReturn
* @catnipName Move a copy by distance
* @catnipName_Ru Передвинуть копию на расстояние
*/
function moveByAxes(me: Copy, dx: number, dy: number, cgroup?: string, stepSize?: number):
false | ISeparateMovementResult;
Expand All @@ -283,6 +320,8 @@ declare namespace place {
* (usually the speed of a copy)
* @param {string} cgroup The collision group to test against. If not defined,
* will test against all the copies
* @catnipName Move a copy avoiding obstacles
* @catnipName_Ru Передвинуть копию, обходя препятствия
*/
function go(me: Copy, x: number, y: number, length: number, cgroup?: string): void;

Expand Down Expand Up @@ -373,6 +412,8 @@ declare namespace place {
* Enables collision checks on the specified tilemap, with an optional collision group.
* @param {Tilemap} tilemap The tilemap on which to enable collisions.
* @param {string} cgroup Collision group.
* @catnipName Enable tilemap collisions
* @catnipName_Ru Включить столкновения у слоя тайлов
*/
function enableTilemapCollisions(tilemap: Tilemap, cgroup?: string): void;
}
1 change: 1 addition & 0 deletions app/data/ct.libs/pointer/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"tagline": "A uniform API for any type of pointer devices, be it touchscreens, pen tablets, or mouse.",
"tagline_Ru": "Единый API для всех видов указателей — мышек, тач-экранов, графических планшетов и т.д.",
"version": "1.0.1",
"icon": "ui",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
"mail": "[email protected]"
Expand Down
14 changes: 9 additions & 5 deletions app/data/ct.libs/pointer/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,17 @@ interface IPointer {
}

declare namespace pointer {
/**
* @catnipIgnore
*/
var hover: IPointer[];
/**
* @catnipIgnore
*/
var down: IPointer[];
/**
* @catnipIgnore
*/
var released: IPointer[];
/** The horizontal position at which the primary pointer is positioned. */
var x: number;
Expand Down Expand Up @@ -234,11 +243,6 @@ declare namespace pointer {
function isButtonPressed(button: PointerButtonName, pointer: IPointer): boolean;
function lock(): void;
function unlock(): void;
/**
* Temporarily suspend e.preventDefault() calls. For example, to allow for a HTML text
* box to be used.
*/
var permitDefault: boolean;
/**
* Equals to `true` when the pointer is locked.
* Note that the pointer can still be unlocked while the locking mode is on,
Expand Down
1 change: 1 addition & 0 deletions app/data/ct.libs/random/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "random",
"tagline": "Compute random stuff!",
"tagline_Ru": "Вычисляй случайные значения!",
"icon": "sort-numerically",
"version": "2.0.0",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
Expand Down
1 change: 1 addition & 0 deletions app/data/ct.libs/splashscreen/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name_Ru": "Вступительный экран-обложка",
"tagline": "Create splash screens at project settings.",
"tagline_Ru": "Создай вступительное интро с помощью настроек проекта.",
"icon": "monitor",
"version": "0.0.0",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
Expand Down
1 change: 1 addition & 0 deletions app/data/ct.libs/sprite/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"name": "Sprite Composer",
"tagline": "Create new animations from one sprite, freeing yourself from the necessity to split and stitch frames manually.",
"version": "1.0.0",
"icon": "texture",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
"mail": "[email protected]"
Expand Down
1 change: 1 addition & 0 deletions app/data/ct.libs/transition/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"tagline": "Add nice and smooth transitions between levels, or whenever you need them.",
"tagline_Ru": "Добавь красивые плавные переходы между уровнями, или вызови их когда угодно.",
"version": "1.0.0",
"icon": "monitor",
"authors": [{
"name": "Cosmo Myzrail Gorynych",
"mail": "[email protected]"
Expand Down
Loading

0 comments on commit 18fdacb

Please sign in to comment.