From 3b039c177b387ba9e8023ae262387c7ffcc311e5 Mon Sep 17 00:00:00 2001 From: rowan Date: Thu, 1 May 2025 20:19:39 -0500 Subject: [PATCH] dev console --- .gitignore | 2 + .gitmodules | 3 + addons/dev_console/autocomplete_line.ts | 96 +++-- addons/dev_console/console.tscn | 7 +- addons/dev_console/dev_console.ts | 36 +- addons/dev_console/monospace.tres | 7 + addons/enumerable-ts | 1 + package-lock.json | 2 +- src/camera_trigger.js | 33 -- src/camera_trigger.js.map | 1 - src/collection/enumerable.ts | 55 +++ src/debug_draw.js | 23 - src/debug_draw.js.map | 1 - src/enumerable.ts | 552 ------------------------ src/message_bus.js | 23 - src/message_bus.js.map | 1 - src/player.js | 77 ---- src/player.js.map | 1 - src/player_animation.js | 13 - src/player_animation.js.map | 1 - src/player_input.js | 30 -- src/player_input.js.map | 1 - tsconfig.json | 8 +- typings/godot1.gen.d.ts | 3 + typings/godot2.gen.d.ts | 67 ++- typings/godot3.gen.d.ts | 9 +- typings/godot4.gen.d.ts | 3 - typings/godot5.gen.d.ts | 13 + 28 files changed, 254 insertions(+), 815 deletions(-) create mode 100644 .gitmodules create mode 100644 addons/dev_console/monospace.tres create mode 160000 addons/enumerable-ts delete mode 100644 src/camera_trigger.js delete mode 100644 src/camera_trigger.js.map create mode 100644 src/collection/enumerable.ts delete mode 100644 src/debug_draw.js delete mode 100644 src/debug_draw.js.map delete mode 100644 src/enumerable.ts delete mode 100644 src/message_bus.js delete mode 100644 src/message_bus.js.map delete mode 100644 src/player.js delete mode 100644 src/player.js.map delete mode 100644 src/player_animation.js delete mode 100644 src/player_animation.js.map delete mode 100644 src/player_input.js delete mode 100644 src/player_input.js.map diff --git a/.gitignore b/.gitignore index 17b6b07..64ed067 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ /android/ node_modules/ *.js +*.map.js **/*.js +**/*.map.js diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b42ebc7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "addons/enumerable-ts"] + path = addons/enumerable-ts + url = https://git.kitsu.cafe/rowan/enumerable-ts.git diff --git a/addons/dev_console/autocomplete_line.ts b/addons/dev_console/autocomplete_line.ts index 69573fa..44015f3 100644 --- a/addons/dev_console/autocomplete_line.ts +++ b/addons/dev_console/autocomplete_line.ts @@ -1,43 +1,81 @@ -import { Callable, Callable1, LineEdit, Variant } from 'godot' +import { Callable, Callable1, InputEvent, LineEdit, Variant } from 'godot' import { export_, onready } from 'godot.annotations' +import { Enumerable, IEnumerable } from '../enumerable-ts/src/index' +import { Action } from './dev_console' export default class AutocompleteLine extends LineEdit { - @export_(Variant.Type.TYPE_BOOL) - private auto_suggest: boolean = true + @export_(Variant.Type.TYPE_BOOL) + private auto_suggest: boolean = true - @onready("SuggestionLine") - private suggestion!: LineEdit + @onready("Suggestion") + private suggestion!: LineEdit - autocomplete_list: string[] = [] - last_autocomplete: number = -1 + autocomplete_list: string[] = [] + current_suggestions: string[] = [] + suggestion_index: number = -1 + suppress_focus_change: boolean = true - _on_text_changed!: Callable1 + _on_text_changed!: Callable1 - _ready(): void { - this._on_text_changed = Callable.create(this, this.suggest) + _ready(): void { + this._on_text_changed = Callable.create(this, this.suggest) - if (this.auto_suggest) { - this.text_changed.connect(this._on_text_changed) - } - } + if (this.auto_suggest) { + this.text_changed.connect(this._on_text_changed) + } + } - suggest(value: string): boolean { - const item = this.fuzzy_find(value) + _input(event: InputEvent): void { + if (this.has_focus() && this.suppress_focus_change && event.is_action_pressed(Action.FocusNext)) { + this.accept_event() + this.autocomplete() + } + } - if (item > -1) { - this.suggestion.text = this.autocomplete_list[item] - return true - } + suggest(value: string): boolean { + this.reset() - return false - } + if (value == '') { + return false + } - autocomplete(value?: string) { - this.text = value || this.suggestion.text - this.suggestion.clear() - } + this.current_suggestions = this.fuzzy_find(value) - fuzzy_find(value: string): number { - return this.autocomplete_list.findIndex(text => text.startsWith(value)) - } + if (this.current_suggestions.length > 0) { + const suggestion = this.current_suggestions[0] + if (suggestion != null) { + // create the illusion that the text is autocompleting + // by replacing the already typed characters with spaces + const padded = suggestion.slice(value.length).padStart(suggestion.length, ' ') + this.suggestion.text = padded + return true + } + } + + this.suggestion.text = '' + return false + } + + set_caret_to_end() { + this.caret_column = this.text.length + 1 + } + + autocomplete() { + if (this.current_suggestions.length > 0) { + this.suggestion_index = (this.suggestion_index + 1) % this.current_suggestions.length + this.text = this.current_suggestions.at(this.suggestion_index) || '' + this.suggestion.clear() + this.set_caret_to_end() + } + } + + fuzzy_find(value: string): string[] { + return this.autocomplete_list.filter(text => text != null && text.startsWith(value)) + } + + reset() { + this.current_suggestions = [] + this.suggestion_index = -1 + this.suggestion.text = '' + } } diff --git a/addons/dev_console/console.tscn b/addons/dev_console/console.tscn index 6659d9f..8aecb56 100644 --- a/addons/dev_console/console.tscn +++ b/addons/dev_console/console.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=3 uid="uid://b8xytvsmqsf55"] +[gd_scene load_steps=4 format=3 uid="uid://b8xytvsmqsf55"] [ext_resource type="Script" path="res://addons/dev_console/dev_console.ts" id="1_3ukun"] +[ext_resource type="Theme" uid="uid://cj1yqavvbe331" path="res://addons/dev_console/monospace.tres" id="2_0wrae"] [ext_resource type="Script" path="res://addons/dev_console/autocomplete_line.ts" id="2_fq41p"] [node name="CanvasLayer" type="CanvasLayer"] @@ -45,13 +46,15 @@ selection_enabled = true [node name="Input" type="LineEdit" parent="Container/VBoxContainer"] layout_mode = 2 +theme = ExtResource("2_0wrae") caret_blink = true script = ExtResource("2_fq41p") -[node name="Input2" type="LineEdit" parent="Container/VBoxContainer/Input"] +[node name="Suggestion" type="LineEdit" parent="Container/VBoxContainer/Input"] layout_mode = 2 offset_right = 1152.0 offset_bottom = 31.0 +theme = ExtResource("2_0wrae") editable = false context_menu_enabled = false virtual_keyboard_enabled = false diff --git a/addons/dev_console/dev_console.ts b/addons/dev_console/dev_console.ts index b55db7c..d0b3ad5 100644 --- a/addons/dev_console/dev_console.ts +++ b/addons/dev_console/dev_console.ts @@ -1,13 +1,17 @@ -import { Callable, Callable1, CanvasLayer, Expression, GArray, GDictionary, GError, InputEvent, LineEdit, RichTextLabel } from 'godot' +import { Callable, Callable1, CanvasLayer, Expression, GArray, GDictionary, GError, InputEvent, RichTextLabel } from 'godot' import { onready } from 'godot.annotations' import AutocompleteLine from './autocomplete_line' +import { GArrayEnumerator } from '../../src/collection/enumerable' +import { Enumerable } from '../enumerable-ts/src/index' -const Action = { +export const Action = { Toggle: '_dev_console_toggle', Cancel: 'ui_cancel', Up: 'ui_up', Down: 'ui_down', - TextComplete: 'ui_text_completion_replace' + TextComplete: 'ui_text_completion_replace', + FocusNext: 'ui_focus_next', + FocusPrevious: 'ui_focus_prev', } as const export default class DevConsole extends CanvasLayer { @@ -25,8 +29,11 @@ export default class DevConsole extends CanvasLayer { _ready(): void { this._toggle() - const method_names = this.get_method_list().map(Callable.create((x: GDictionary) => x.get('name'))) - this.input.autocomplete_list = method_names + const method_names = Enumerable.from(new GArrayEnumerator(this.get_method_list())) + .map((x: GDictionary) => x.get('name')) + .filter((x: string) => !x.startsWith('_')) + + this.input.autocomplete_list = method_names.toArray() this.parse_callable = Callable.create( this, this.submit_command @@ -47,9 +54,9 @@ export default class DevConsole extends CanvasLayer { if (event.is_action_pressed(Action.Cancel)) { this._cancel() } else if (event.is_action_pressed(Action.Up)) { - this._previous_command() - } else if (event.is_action_pressed(Action.TextComplete)) { - //this._try_autocomplete() + this._move_history(-1) + } else if (event.is_action_pressed(Action.Down)) { + this._move_history(1) } } @@ -67,13 +74,20 @@ export default class DevConsole extends CanvasLayer { } } - _previous_command() { + async _move_history(direction: (-1 | 1)) { + this.history_index = (this.history_index + direction) % this.history.length + if (this.history_index < 0) { - this.history_index = this.history.length + this.history_index = this.history.length - 1 } - this.history_index -= 1 this.input.text = this.history[this.history_index] + await this.get_tree().process_frame.as_promise() + this.input.set_caret_to_end() + } + + _autocomplete() { + this.input.autocomplete() } async _show() { diff --git a/addons/dev_console/monospace.tres b/addons/dev_console/monospace.tres new file mode 100644 index 0000000..91c1355 --- /dev/null +++ b/addons/dev_console/monospace.tres @@ -0,0 +1,7 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cj1yqavvbe331"] + +[sub_resource type="SystemFont" id="SystemFont_2h66v"] +font_names = PackedStringArray("Monospace") + +[resource] +LineEdit/fonts/font = SubResource("SystemFont_2h66v") diff --git a/addons/enumerable-ts b/addons/enumerable-ts new file mode 160000 index 0000000..79755d6 --- /dev/null +++ b/addons/enumerable-ts @@ -0,0 +1 @@ +Subproject commit 79755d60cc55f9abd7e8f45238da05b750b177e4 diff --git a/package-lock.json b/package-lock.json index 7adbb05..bac1ade 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "signalis", + "name": "xsivgnazlixs", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/src/camera_trigger.js b/src/camera_trigger.js deleted file mode 100644 index 718e269..0000000 --- a/src/camera_trigger.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const godot_1 = require("godot"); -const godot_annotations_1 = require("godot.annotations"); -const player_1 = __importDefault(require("./player")); -const message_bus_1 = __importDefault(require("./message_bus")); -class CameraTrigger extends godot_1.Area3D { - _ready() { - this._camera = this.get_node(this.camera); - } - _on_body_entered(body) { - var _a; - if (body instanceof player_1.default) { - (_a = this._camera) === null || _a === void 0 ? void 0 : _a.make_current(); - console.log(message_bus_1.default.instance.active_camera_changed); - message_bus_1.default.instance.active_camera_changed.emit(this._camera); - } - } -} -exports.default = CameraTrigger; -__decorate([ - (0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_NODE_PATH) -], CameraTrigger.prototype, "camera", void 0); -//# sourceMappingURL=camera_trigger.js.map \ No newline at end of file diff --git a/src/camera_trigger.js.map b/src/camera_trigger.js.map deleted file mode 100644 index 1ec98ff..0000000 --- a/src/camera_trigger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"camera_trigger.js","sourceRoot":"../../../","sources":["src/camera_trigger.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA0E;AAC1E,yDAA2C;AAC3C,sDAA6B;AAC7B,gEAAsC;AAEtC,MAAqB,aAAc,SAAQ,cAAM;IAK/C,MAAM;QACJ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAa,CAAA;IACvD,CAAC;IAED,gBAAgB,CAAC,IAAmB;;QAClC,IAAI,IAAI,YAAY,gBAAM,EAAE,CAAC;YAC3B,MAAA,IAAI,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAA;YAC5B,OAAO,CAAC,GAAG,CAAC,qBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;YACtD,qBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC9D,CAAC;IACH,CAAC;CACF;AAhBD,gCAgBC;AAdC;IADC,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,cAAc,CAAC;6CACpB"} \ No newline at end of file diff --git a/src/collection/enumerable.ts b/src/collection/enumerable.ts new file mode 100644 index 0000000..f71b754 --- /dev/null +++ b/src/collection/enumerable.ts @@ -0,0 +1,55 @@ +import { IArrayEnumerator } from '../../addons/enumerable-ts/src/index' + +import { GArray } from 'godot' + +type Nullable = T | null | undefined + +const DoneIteratorResult = Object.freeze({ value: undefined, done: true }) + +export class GArrayEnumerator implements IArrayEnumerator, Iterator, Iterable { + private _array: GArray + private _index: number = -1 + + get current(): Nullable { + return this._array.get_indexed(this._index) + } + + constructor(array: GArray) { + this._array = array + } + + [Symbol.iterator](): Iterator { + return this._array[Symbol.iterator]() as Iterator + } + + setIndex(index: number): void { + this._index = index + } + + moveNext(): boolean { + this._index += 1 + return this._index < this._array.size() + } + + reset(): void { + this._index = -1 + } + + toIterator(): Iterator { + return this._array[Symbol.iterator]() as Iterator + } + + next(...[_value]: [] | [any]): IteratorResult { + const next = this.moveNext() + return { value: this.current, done: !next } as IteratorResult + } + + return?(_value?: any): IteratorResult { + return DoneIteratorResult + } + + throw?(_e?: any): IteratorResult { + return DoneIteratorResult + } +} + diff --git a/src/debug_draw.js b/src/debug_draw.js deleted file mode 100644 index 9dfb914..0000000 --- a/src/debug_draw.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const godot_1 = require("godot"); -class DebugDraw extends godot_1.Node { - static get instance() { - return DebugDraw._inst; - } - _ready() { - DebugDraw._inst = this; - } - draw_line(begin, end, color = godot_1.Color.CYAN) { - const instance = new godot_1.GeometryInstance3D(); - this.add_child(instance); - const geom = new godot_1.ImmediateMesh(); - geom.surface_begin(godot_1.ImmediateMesh.PrimitiveType.PRIMITIVE_LINES); - geom.surface_add_vertex(begin); - geom.surface_add_vertex(end); - geom.surface_set_color(color); - geom.surface_end(); - } -} -exports.default = DebugDraw; -//# sourceMappingURL=debug_draw.js.map \ No newline at end of file diff --git a/src/debug_draw.js.map b/src/debug_draw.js.map deleted file mode 100644 index 260951f..0000000 --- a/src/debug_draw.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"debug_draw.js","sourceRoot":"../../../","sources":["src/debug_draw.ts"],"names":[],"mappings":";;AAAA,iCAA+E;AAE/E,MAAqB,SAAU,SAAQ,YAAI;IAGzC,MAAM,KAAK,QAAQ;QACjB,OAAO,SAAS,CAAC,KAAK,CAAA;IACxB,CAAC;IAED,MAAM;QACJ,SAAS,CAAC,KAAK,GAAG,IAAI,CAAA;IACxB,CAAC;IAED,SAAS,CAAC,KAAc,EAAE,GAAY,EAAE,QAAe,aAAK,CAAC,IAAI;QAC/D,MAAM,QAAQ,GAAG,IAAI,0BAAkB,EAAE,CAAA;QACzC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAExB,MAAM,IAAI,GAAG,IAAI,qBAAa,EAAE,CAAA;QAChC,IAAI,CAAC,aAAa,CAAC,qBAAa,CAAC,aAAa,CAAC,eAAe,CAAC,CAAA;QAC/D,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;QAC5B,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;CACF;AAtBD,4BAsBC"} \ No newline at end of file diff --git a/src/enumerable.ts b/src/enumerable.ts deleted file mode 100644 index b8deb76..0000000 --- a/src/enumerable.ts +++ /dev/null @@ -1,552 +0,0 @@ -import { GArray } from 'godot' - -const DoneIteratorResult = Object.freeze({ value: undefined, done: true }) - -type Nullable = T | null | undefined - -export interface Predicate { - (value: Nullable, index: number): boolean -} - -export interface Reducer { - (accumulator: U, value: Nullable, index: number): U -} - -export interface Morphism { - (value: Nullable, index: number): U -} - -interface IEnumeratorFactory { - (iterator: Iterator): IEnumerator -} - -export interface IEnumerator { - get current(): Nullable - moveNext(): boolean - reset(): void - toIterator(): Iterator -} - -export interface IEnumerable { - enumerator(): IEnumerator -} - -export function isIterable(value: any): value is Iterable { - return typeof value[Symbol.iterator] === 'function' -} - -export function isIterator(value: any): value is Iterator { - return typeof value.next === 'function' -} - -export function isBuffer(value: any): value is ArrayBufferLike { - return ArrayBuffer.isView(value) -} - -export function isGArray(value: any): value is GArray { - return typeof value.get_indexed === 'function' -} - -export function isArrayLike(value: any): value is ArrayLike { - return typeof value.length === 'number' -} - -class IteratorEnumerator implements IEnumerator, Iterator { - private _iterator: Iterator - private _consumed: boolean = false - private _current: Nullable - - get current(): Nullable { - return this._current - } - - constructor(iterator: Iterator) { - this._iterator = iterator - } - - static from(iterator: Iterator): IteratorEnumerator { - return new IteratorEnumerator(iterator) - } - - moveNext(): boolean { - if (!this._consumed) { - const { value, done } = this._iterator.next() - - this._current = value - if (done) { - this._consumed = true - } - - return !done - } else { - return false - } - } - - reset(): void { } - - toIterator(): Iterator { - return this as Iterator - } - - next(...[_value]: [] | [any]): IteratorResult { - const done = this.moveNext() - return { value: this.current, done } as IteratorResult - } - - return(value?: any): IteratorResult { - return this._iterator.return?.(value) ?? DoneIteratorResult - } - - throw(e?: any): IteratorResult { - return this._iterator.throw?.(e) ?? DoneIteratorResult - } -} - -class CachedIteratorEnumerator implements IEnumerator, Iterator { - private _iterator: IteratorEnumerator - private _cache: Nullable[] = [] - private _index: number = -1 - - get current(): Nullable { - return this._cache[this._index] - } - - constructor(iterator: Iterator) { - this._iterator = new IteratorEnumerator(iterator) - } - - static from(iterator: Iterator): CachedIteratorEnumerator { - return new CachedIteratorEnumerator(iterator) - } - - moveNext(): boolean { - this._index += 1 - - if (this._cache.length > this._index) { - return true - } else if (!this._iterator.moveNext()) { - this._cache.push(this._iterator.current) - - return !true - } else { - return false - } - } - - reset(): void { - this._index = -1 - } - - toIterator(): Iterator { - return this as Iterator - } - - next(...[_value]: [] | [any]): IteratorResult { - const done = this.moveNext() - return { value: this.current, done } as IteratorResult - } - - return?(value?: any): IteratorResult { - return this._iterator.return(value) - } - - throw(e?: any): IteratorResult { - return this._iterator.throw(e) - } -} - -export class IterableEnumerator implements IEnumerator, Iterator { - private _iterable: Iterable - private _factory: IEnumeratorFactory - private _enumerator: Nullable> - - get current(): Nullable { - return this._enumerator?.current - } - - constructor(iterable: Iterable, factory: IEnumeratorFactory = IteratorEnumerator.from) { - this._iterable = iterable - this._factory = factory - } - - static fromIterable(iterable: Iterable, factory?: IEnumeratorFactory): IEnumerator { - return new this(iterable, factory) - } - - moveNext(): boolean { - return this._enumerator?.moveNext() ?? false - } - - _createIterator(): Iterator { - return this._iterable[Symbol.iterator]() - } - - _createEnumerator(): IEnumerator { - return this._factory(this._createIterator()) - } - - reset(): void { - this._enumerator = this._createEnumerator() - } - - toIterator(): Iterator { - return this._createIterator() as Iterator - } - - next(...[_value]: [] | [any]): IteratorResult { - const done = !this.moveNext() - return { value: this.current, done } as IteratorResult - } - - return?(value?: any): IteratorResult { - if (isIterator(this._enumerator)) { - return this._enumerator?.return?.(value) || DoneIteratorResult - } else { - return DoneIteratorResult - } - } - - throw?(e?: any): IteratorResult { - if (isIterator(this._enumerator)) { - return this._enumerator?.throw?.(e) || DoneIteratorResult - } else { - return DoneIteratorResult - } - } -} - -class Enumerator implements IEnumerator, Iterator { - protected _enumerator: IEnumerator - protected _index: number = 0 - - get current(): Nullable { - return this._enumerator.current - } - - constructor(enumerator: IEnumerator) { - this._enumerator = enumerator - } - - static fromIterable(iterable: Iterable): IEnumerator { - return new this(new IterableEnumerator(iterable)) - } - - static fromIterator(iterator: Iterator, cache: boolean = true): IEnumerator { - if (cache) { - return new CachedIteratorEnumerator(iterator) - } else { - return new IteratorEnumerator(iterator) - } - } - - static toIterator(enumerator: IEnumerator): Iterator { - return new this(enumerator) - } - - [Symbol.iterator]() { - return this.toIterator() - } - - toIterator(): Iterator { - return Enumerator.toIterator(this) as Iterator - } - - moveNext(): boolean { - this._index += 1 - return this._enumerator.moveNext() - } - - reset(): void { - this._enumerator.reset() - } - - next(...[_value]: [] | [any]): IteratorResult { - const done = this.moveNext() - - return { value: this.current, done } as IteratorResult - } - - return?(_value?: any): IteratorResult { - return DoneIteratorResult - } - - throw?(_e?: any): IteratorResult { - return DoneIteratorResult - } -} - -class DropEnumerator extends Enumerator { - private _limit: number - - constructor(enumerator: IEnumerator, limit: number) { - super(enumerator) - this._limit = limit - } - - moveNext(): boolean { - for (let i = 0; i < this._limit; i++) { - if (!super.moveNext()) { - return false - } - } - - return true - } -} - -class FilterEnumerator extends Enumerator { - private _filter: Predicate - - constructor(enumerator: IEnumerator, filter: Predicate) { - super(enumerator) - this._filter = filter - } - - moveNext(): boolean { - let done = super.moveNext() - - while (!done && !this._filter(this.current, this._index)) { - done = super.moveNext() - } - - return done - } -} - -class FlatMapEnumerator implements IEnumerator { - private _enumerator: IEnumerator - private _flatMap: Morphism> - private _inner?: IEnumerator - private _index: number = -1 - - constructor(enumerator: IEnumerator, flatMap: Morphism>) { - this._enumerator = enumerator - this._flatMap = flatMap - } - - get current(): Nullable { - return this._inner?.current - } - - moveNext(): boolean { - if (this._inner && this._inner.moveNext()) { - return true - } - - const done = this._enumerator.moveNext() - - if (done) { - return false - } - - this._index += 1 - this._inner = this._flatMap(this._enumerator.current, this._index) - return this._inner.moveNext() - } - - reset(): void { - this._index = -1 - this._inner = undefined - this._enumerator.reset() - } - - toIterator(): Iterator { - return Enumerator.toIterator(this) as Iterator - } -} - -class MapEnumerator implements IEnumerator { - private _enumerator: IEnumerator - private _map: Morphism - private _current!: U - private _index: number = -1 - - get current(): U { - return this._current - } - - constructor(enumerator: IEnumerator, map: Morphism) { - this._enumerator = enumerator - this._map = map - } - - toIterator(): Iterator { - return Enumerator.toIterator(this) as Iterator - } - - moveNext(): boolean { - this._index += 1 - const done = this._enumerator.moveNext() - - if (!done) { - this._current = this._map(this._enumerator.current, this._index) - } - - return done - } - - reset(): void { - this._enumerator.reset() - } -} - -class TakeEnumerator extends Enumerator { - private _limit: number - - constructor(enumerator: IEnumerator, limit: number) { - super(enumerator) - this._limit = limit - } - - moveNext(): boolean { - if (this._limit < 0) { - return false - } else { - this._limit -= 1 - return true - } - } -} - -class FusedEnumerator implements IEnumerator { - private _enumerators: IEnumerator[] - private _index: number = 0 - - private _cur() { - return this._enumerators[this._index] - } - - private _done() { - return this._index < this._enumerators.length - } - - get current(): Nullable { - return this._cur().current - } - - constructor(enumerators: IEnumerator[]) { - this._enumerators = enumerators - } - - toIterator(): Iterator { - return Enumerator.toIterator(this) as Iterator - } - - moveNext(): boolean { - while (!this._done()) { - if (this._cur().moveNext()) { - return true - } - - this._index += 1 - } - return false - } - - reset(): void { - const len = this._enumerators.length - - for (let i = 0; i < len; i++) { - this._enumerators[i].reset() - } - - this._index = 0 - } -} - -export class Enumerable implements IEnumerable, Iterable { - private _enumerator: IEnumerator - - constructor(enumerator: IEnumerator) { - this._enumerator = enumerator - } - - static from(enumerator: IEnumerator) { - return new this(enumerator) - } - - [Symbol.iterator](): Iterator { - return this._enumerator.toIterator() - } - - at(index: number): Nullable { - for (let i = 0; i < index; i++) { - if (!this._enumerator.moveNext()) { - return - } - } - - const value = this._enumerator.current - this._enumerator.reset() - return value - } - - atOrDefault(index: number, defaultValue: T) { - const value = this.at(index) - return value || defaultValue - } - - atOrElse(index: number, defaultValue: () => T) { - const value = this.at(index) - return value || defaultValue() - } - - concat(other: IEnumerator): FusedEnumerator { - return new FusedEnumerator([this._enumerator, other]) - } - - - drop(limit: number) { - return new Enumerable(new DropEnumerator(this._enumerator, limit)) - } - - enumerator(): IEnumerator { - return this._enumerator - } - - every(predicate: Predicate): boolean { - let index = 0 - while (this._enumerator.moveNext()) { - if (!predicate(this._enumerator.current, index)) { - return false - } - - index += 1 - } - - this._enumerator.reset() - return true - } - - filter(predicate: Predicate): IEnumerable { - return new Enumerable(new FilterEnumerator(this._enumerator, predicate)) - } - - flatMap(fn: Morphism>): IEnumerable { - return new Enumerable(new FlatMapEnumerator(this._enumerator, fn)) - } - - map(fn: Morphism): IEnumerable { - return new Enumerable(new MapEnumerator(this._enumerator, fn)) - } - - some(predicate: Predicate): boolean { - let index = 0 - while (this._enumerator.moveNext()) { - if (predicate(this._enumerator.current, index)) { - return true - } - - index += 1 - } - - this._enumerator.reset() - return false - } - - take(limit: number): IEnumerable { - return new Enumerable(new TakeEnumerator(this._enumerator, limit)) - } -} - diff --git a/src/message_bus.js b/src/message_bus.js deleted file mode 100644 index 63088c1..0000000 --- a/src/message_bus.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const godot_1 = require("godot"); -const godot_annotations_1 = require("godot.annotations"); -class MessageBus extends godot_1.Node { - static get instance() { - return MessageBus._inst; - } - _ready() { - MessageBus._inst = this; - } -} -exports.default = MessageBus; -__decorate([ - (0, godot_annotations_1.signal)() -], MessageBus.prototype, "active_camera_changed", void 0); -//# sourceMappingURL=message_bus.js.map \ No newline at end of file diff --git a/src/message_bus.js.map b/src/message_bus.js.map deleted file mode 100644 index 28b2bfd..0000000 --- a/src/message_bus.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"message_bus.js","sourceRoot":"../../../","sources":["src/message_bus.ts"],"names":[],"mappings":";;;;;;;;AAAA,iCAA+C;AAC/C,yDAA0C;AAE1C,MAAqB,UAAW,SAAQ,YAAI;IAG1C,MAAM,KAAK,QAAQ;QACjB,OAAO,UAAU,CAAC,KAAK,CAAA;IACzB,CAAC;IAKD,MAAM;QACJ,UAAU,CAAC,KAAK,GAAG,IAAI,CAAA;IACzB,CAAC;CACF;AAbD,6BAaC;AALC;IADC,IAAA,0BAAM,GAAE;yDACgC"} \ No newline at end of file diff --git a/src/player.js b/src/player.js deleted file mode 100644 index c49e68b..0000000 --- a/src/player.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const godot_1 = require("godot"); -const godot_annotations_1 = require("godot.annotations"); -const message_bus_1 = __importDefault(require("./message_bus")); -class Player extends godot_1.CharacterBody3D { - constructor() { - super(...arguments); - this.gravity = godot_1.ProjectSettings.get_setting('physics/3d/default_gravity'); - this.walk_speed = 3; - this.walk_backward_speed = 2; - this.run_speed = 6; - this.turn_speed = 1; - this._rotation_speed = 2 * Math.PI; - } - _ready() { - this._rotation_speed = this.turn_speed * 2 * Math.PI; - this._player_input = this.get_node(this.player_input); - this._camera = this.get_viewport().get_camera_3d(); - message_bus_1.default.instance.active_camera_changed.connect(godot_1.Callable.create(this, this.on_camera_changed)); - } - get_movement(delta) { - const input = this._player_input.movement_input; - return godot_1.Vector3.MULTIPLY(this.walk_speed, new godot_1.Vector3(input.x, 0, input.y)); - } - //get_translation(_delta: float64): Vector3 { - // const forward = Vector3.MULTIPLY(-1, this.transform.basis.z) - // return Vector3.MULTIPLY(forward, this.get_movement()) - //} - get_gravitational_force(delta) { - return -this.gravity * delta; - } - relative_to(target, vec) { - return vec.rotated(godot_1.Vector3.UP, target.rotation.y); - } - on_camera_changed(camera) { - this._camera = camera; - } - _physics_process(delta) { - const movement = this.relative_to(this._camera, this.get_movement(delta)); - if (!movement.is_zero_approx()) { - this.look_at(godot_1.Vector3.NEGATE(godot_1.Vector3.ADD(this.position, movement)), godot_1.Vector3.UP); - } - this.velocity = new godot_1.Vector3(movement.x, this.velocity.y + this.get_gravitational_force(delta), movement.z); - this.move_and_slide(); - } -} -exports.default = Player; -__decorate([ - (0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_NODE_PATH) -], Player.prototype, "player_input", void 0); -__decorate([ - (0, godot_annotations_1.help)('Forward walk speed in units per second'), - (0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT) -], Player.prototype, "walk_speed", void 0); -__decorate([ - (0, godot_annotations_1.help)('Backward walk speed in units per second'), - (0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT) -], Player.prototype, "walk_backward_speed", void 0); -__decorate([ - (0, godot_annotations_1.help)('Run speed in units per second'), - (0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT) -], Player.prototype, "run_speed", void 0); -__decorate([ - (0, godot_annotations_1.help)('Turn speed in rotations per second'), - (0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT) -], Player.prototype, "turn_speed", void 0); -//# sourceMappingURL=player.js.map \ No newline at end of file diff --git a/src/player.js.map b/src/player.js.map deleted file mode 100644 index 949a611..0000000 --- a/src/player.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"player.js","sourceRoot":"../../../","sources":["src/player.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/src/player_animation.js b/src/player_animation.js deleted file mode 100644 index 8467a87..0000000 --- a/src/player_animation.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const godot_1 = require("godot"); -class PlayerAnimation extends godot_1.AnimationTree { - _ready() { - this.player = this.get_parent(); - this.player_input = this.player.get_node(this.player.player_input); - } -} -PlayerAnimation.Interact = 'parameters/interact'; -PlayerAnimation.WalkSpeed = 'parameters/Walk/blend_position'; -exports.default = PlayerAnimation; -//# sourceMappingURL=player_animation.js.map \ No newline at end of file diff --git a/src/player_animation.js.map b/src/player_animation.js.map deleted file mode 100644 index b4aa644..0000000 --- a/src/player_animation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"player_animation.js","sourceRoot":"../../../","sources":["src/player_animation.ts"],"names":[],"mappings":";;AAAA,iCAAqC;AAIrC,MAAqB,eAAgB,SAAQ,qBAAa;IAOxD,MAAM;QACJ,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAY,CAAA;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,YAAa,CAAgB,CAAA;IACpF,CAAC;;AATc,wBAAQ,GAAG,qBAAqB,CAAA;AAChC,yBAAS,GAAG,gCAAgC,CAAA;kBAFxC,eAAe"} \ No newline at end of file diff --git a/src/player_input.js b/src/player_input.js deleted file mode 100644 index d58b29a..0000000 --- a/src/player_input.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const godot_1 = require("godot"); -var Device; -(function (Device) { - Device[Device["KeyboardMouse"] = 0] = "KeyboardMouse"; - Device[Device["Gamepad"] = 1] = "Gamepad"; -})(Device || (Device = {})); -class PlayerInput extends godot_1.Node3D { - constructor() { - super(...arguments); - this._last_known_device = Device.KeyboardMouse; - this._movement_input = godot_1.Vector2.ZERO; - } - get last_known_device() { return this._last_known_device; } - get movement_input() { return this._movement_input; } - _process(delta) { - this._movement_input = godot_1.Input.get_vector('move_left', 'move_right', 'move_forward', 'move_back'); - } - _input(event) { - if (event instanceof godot_1.InputEventKey || event instanceof godot_1.InputEventMouse) { - this._last_known_device = Device.KeyboardMouse; - } - else if (event instanceof godot_1.InputEventJoypadButton || event instanceof godot_1.InputEventJoypadMotion) { - this._last_known_device = Device.Gamepad; - } - } -} -exports.default = PlayerInput; -//# sourceMappingURL=player_input.js.map \ No newline at end of file diff --git a/src/player_input.js.map b/src/player_input.js.map deleted file mode 100644 index 122e2c7..0000000 --- a/src/player_input.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"player_input.js","sourceRoot":"../../../","sources":["src/player_input.ts"],"names":[],"mappings":";;AAAA,iCAAmJ;AAEnJ,IAAK,MAGJ;AAHD,WAAK,MAAM;IACT,qDAAiB,CAAA;IACjB,yCAAW,CAAA;AACb,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;AAED,MAAqB,WAAY,SAAQ,cAAM;IAA/C;;QACE,uBAAkB,GAAG,MAAM,CAAC,aAAa,CAAA;QAGzC,oBAAe,GAAY,eAAO,CAAC,IAAI,CAAA;IAczC,CAAC;IAhBC,IAAI,iBAAiB,KAAK,OAAO,IAAI,CAAC,kBAAkB,CAAA,CAAC,CAAC;IAG1D,IAAI,cAAc,KAAK,OAAO,IAAI,CAAC,eAAe,CAAA,CAAC,CAAC;IAEpD,QAAQ,CAAC,KAAc;QACrB,IAAI,CAAC,eAAe,GAAG,aAAK,CAAC,UAAU,CAAC,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,CAAC,CAAA;IACjG,CAAC;IAED,MAAM,CAAC,KAAiB;QACtB,IAAI,KAAK,YAAY,qBAAa,IAAI,KAAK,YAAY,uBAAe,EAAE,CAAC;YACvE,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAA;QAChD,CAAC;aAAM,IAAI,KAAK,YAAY,8BAAsB,IAAI,KAAK,YAAY,8BAAsB,EAAE,CAAC;YAC9F,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAA;QAC1C,CAAC;IACH,CAAC;CACF;AAlBD,8BAkBC"} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 24032f0..81c6899 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ @@ -26,7 +26,7 @@ /* Modules */ "module": "CommonJS", /* Specify what module code is generated. */ - "rootDir": "./", /* Specify the root folder within your source files. */ + "rootDir": "./", /* Specify the root folder within your source files. */ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ @@ -55,13 +55,13 @@ /* Emit */ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "emitDeclarationOnly": false, /* Only output d.ts files and not JavaScript files. */ "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": ".godot/GodotJS", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ + "noEmit": false, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ diff --git a/typings/godot1.gen.d.ts b/typings/godot1.gen.d.ts index 9220872..752ce51 100644 --- a/typings/godot1.gen.d.ts +++ b/typings/godot1.gen.d.ts @@ -8312,6 +8312,9 @@ declare module "godot" { class CanvasItemEditorPlugin extends EditorPlugin { constructor(identifier?: any) } + class CanvasItemEditorSelectedItem extends Object { + constructor(identifier?: any) + } class CanvasItemEditorViewport extends Control { constructor(identifier?: any) } diff --git a/typings/godot2.gen.d.ts b/typings/godot2.gen.d.ts index f51cee4..21c58e5 100644 --- a/typings/godot2.gen.d.ts +++ b/typings/godot2.gen.d.ts @@ -84,6 +84,14 @@ declare module "godot" { get color_regions(): GDictionary set color_regions(value: GDictionary) } + class CodeTextEditor extends VBoxContainer { + constructor(identifier?: any) + readonly validate_script: Signal0 + readonly load_theme_settings: Signal0 + readonly show_errors_panel: Signal0 + readonly show_warnings_panel: Signal0 + readonly zoomed: Signal1 + } namespace CollisionObject2D { enum DisableMode { /** When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], remove from the physics simulation to stop all physics interactions with this [CollisionObject2D]. @@ -1001,6 +1009,9 @@ declare module "godot" { class ConnectDialogBinds extends Object { constructor(identifier?: any) } + class ConnectionInfoDialog extends AcceptDialog { + constructor(identifier?: any) + } class ConnectionsDock extends VBoxContainer { constructor(identifier?: any) update_tree(): void @@ -1985,6 +1996,9 @@ declare module "godot" { class ControlEditorToolbar extends HBoxContainer { constructor(identifier?: any) } + class ControlPositioningWarning extends MarginContainer { + constructor(identifier?: any) + } /** A 2D convex polygon shape used for physics collision. * * @link https://docs.godotengine.org/en/4.3/classes/class_convexpolygonshape2d.html @@ -4606,6 +4620,10 @@ declare module "godot" { class EditorPackedScenePreviewPlugin extends EditorResourcePreviewGenerator { constructor(identifier?: any) } + class EditorPaginator extends HBoxContainer { + constructor(identifier?: any) + readonly page_changed: Signal1 + } /** Editor-only singleton that returns paths to various OS-specific data folders and files. * * @link https://docs.godotengine.org/en/4.3/classes/class_editorpaths.html @@ -4662,6 +4680,9 @@ declare module "godot" { class EditorPerformanceProfiler extends HSplitContainer { constructor(identifier?: any) } + class EditorPlainTextSyntaxHighlighter extends EditorSyntaxHighlighter { + constructor(identifier?: any) + } namespace EditorPlugin { enum CustomControlContainer { /** Main editor toolbar, next to play buttons. */ @@ -5180,9 +5201,18 @@ declare module "godot" { /** Emitted when selected. Used internally. */ readonly selected: Signal2 } + class EditorPropertyArray extends EditorProperty { + constructor(identifier?: any) + } + class EditorPropertyArrayObject extends RefCounted { + constructor(identifier?: any) + } class EditorPropertyCheck extends EditorProperty { constructor(identifier?: any) } + class EditorPropertyColor extends EditorProperty { + constructor(identifier?: any) + } class EditorPropertyDictionaryObject extends RefCounted { constructor(identifier?: any) } @@ -5192,6 +5222,12 @@ declare module "godot" { class EditorPropertyFloat extends EditorProperty { constructor(identifier?: any) } + class EditorPropertyFontNamesArray extends EditorPropertyArray { + constructor(identifier?: any) + } + class EditorPropertyFontOTObject extends RefCounted { + constructor(identifier?: any) + } class EditorPropertyInteger extends EditorProperty { constructor(identifier?: any) } @@ -5203,6 +5239,9 @@ declare module "godot" { readonly flag_changed: Signal1 readonly rename_confirmed: Signal2 } + class EditorPropertyLocale extends EditorProperty { + constructor(identifier?: any) + } class EditorPropertyLocalizableString extends EditorProperty { constructor(identifier?: any) } @@ -5212,22 +5251,40 @@ declare module "godot" { class EditorPropertyNameProcessor extends Node { constructor(identifier?: any) } + class EditorPropertyNil extends EditorProperty { + constructor(identifier?: any) + } class EditorPropertyNodePath extends EditorProperty { constructor(identifier?: any) } + class EditorPropertyOTFeatures extends EditorProperty { + constructor(identifier?: any) + } + class EditorPropertyOTVariation extends EditorProperty { + constructor(identifier?: any) + } class EditorPropertyPath extends EditorProperty { constructor(identifier?: any) } class EditorPropertyResource extends EditorProperty { constructor(identifier?: any) } + class EditorPropertySizeFlags extends EditorProperty { + constructor(identifier?: any) + } class EditorPropertyText extends EditorProperty { constructor(identifier?: any) } - class EditorPropertyVector2i extends EditorPropertyVectorN { + class EditorPropertyTextEnum extends EditorProperty { constructor(identifier?: any) } - class EditorPropertyVector3 extends EditorPropertyVectorN { + class EditorPropertyTransform2D extends EditorProperty { + constructor(identifier?: any) + } + class EditorPropertyVector2 extends EditorPropertyVectorN { + constructor(identifier?: any) + } + class EditorPropertyVector2i extends EditorPropertyVectorN { constructor(identifier?: any) } class EditorPropertyVectorN extends EditorProperty { @@ -5685,6 +5742,9 @@ declare module "godot" { /** Emitted when the value form loses focus. */ readonly value_focus_exited: Signal0 } + class EditorStandardSyntaxHighlighter extends EditorSyntaxHighlighter { + constructor(identifier?: any) + } /** Base class for [SyntaxHighlighter] used by the [ScriptEditor]. * * @link https://docs.godotengine.org/en/4.3/classes/class_editorsyntaxhighlighter.html @@ -7934,6 +7994,9 @@ declare module "godot" { get opentype_feature_overrides(): GDictionary set opentype_feature_overrides(value: GDictionary) } + class FontPreview extends Control { + constructor(identifier?: any) + } /** A variation of a font with additional settings. * * @link https://docs.godotengine.org/en/4.3/classes/class_fontvariation.html diff --git a/typings/godot3.gen.d.ts b/typings/godot3.gen.d.ts index e41c84d..45263b5 100644 --- a/typings/godot3.gen.d.ts +++ b/typings/godot3.gen.d.ts @@ -529,6 +529,9 @@ declare module "godot" { class GodotPhysicsServer3D extends PhysicsServer3D { constructor(identifier?: any) } + class GotoLineDialog extends ConfirmationDialog { + constructor(identifier?: any) + } namespace Gradient { enum InterpolationMode { /** Linear interpolation. */ @@ -6598,12 +6601,6 @@ declare module "godot" { get multimesh(): MultiMesh set multimesh(value: MultiMesh) } - class MultiNodeEdit extends RefCounted { - constructor(identifier?: any) - _hide_script_from_inspector(): boolean - _hide_metadata_from_inspector(): boolean - _get_editor_name(): string - } namespace MultiplayerAPI { enum RPCMode { /** Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods. */ diff --git a/typings/godot4.gen.d.ts b/typings/godot4.gen.d.ts index 75abaa0..447fc0f 100644 --- a/typings/godot4.gen.d.ts +++ b/typings/godot4.gen.d.ts @@ -363,9 +363,6 @@ declare module "godot" { class Node3DEditorPlugin extends EditorPlugin { constructor(identifier?: any) } - class Node3DEditorSelectedItem extends Object { - constructor(identifier?: any) - } class Node3DEditorViewport extends Control { constructor(identifier?: any) readonly toggle_maximize_view: Signal1 diff --git a/typings/godot5.gen.d.ts b/typings/godot5.gen.d.ts index 0164876..4d10048 100644 --- a/typings/godot5.gen.d.ts +++ b/typings/godot5.gen.d.ts @@ -2131,6 +2131,10 @@ declare module "godot" { class ScriptEditorPlugin extends EditorPlugin { constructor(identifier?: any) } + class ScriptEditorQuickOpen extends ConfirmationDialog { + constructor(identifier?: any) + readonly goto_line: Signal1 + } /** @link https://docs.godotengine.org/en/4.3/classes/class_scriptextension.html */ class ScriptExtension extends Script { constructor(identifier?: any) @@ -2295,6 +2299,9 @@ declare module "godot" { /* gdvirtual */ _handles_global_class_type(type: string): boolean /* gdvirtual */ _get_global_class_name(path: string): GDictionary } + class ScriptTextEditor extends ScriptEditorBase { + constructor(identifier?: any) + } /** Abstract base class for scrollbars. * * @link https://docs.godotengine.org/en/4.3/classes/class_scrollbar.html @@ -4722,6 +4729,12 @@ declare module "godot" { get constant_angular_velocity(): Vector3 set constant_angular_velocity(value: Vector3) } + class StaticRaycaster extends RefCounted { + constructor(identifier?: any) + } + class StaticRaycasterEmbree extends StaticRaycaster { + constructor(identifier?: any) + } /** Application status indicator (aka notification area icon). * * **Note:** Status indicator is implemented on macOS and Windows.