@defold-typescript/library-types 0.20.8 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-doc/decore.json +1883 -0
- package/api-doc/druid.json +11818 -0
- package/generated/decore.d.ts +228 -0
- package/generated/druid.d.ts +2067 -0
- package/luals-targets.json +28 -0
- package/package.json +6 -3
- package/scripts/__snapshots__/emit-library-dts.test.ts.snap +22 -0
- package/scripts/__snapshots__/parse-luals.test.ts.snap +127 -1006
- package/scripts/emit-library-dts.ts +252 -0
- package/scripts/lower-api-doc.ts +115 -0
- package/scripts/luals-fidelity.ts +31 -10
- package/scripts/map-luals-types.ts +65 -0
- package/scripts/parse-luals.ts +60 -11
- package/scripts/sync-luals-types.ts +70 -7
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/** @noResolution */
|
|
2
|
+
declare module 'decore.decore' {
|
|
3
|
+
interface world {
|
|
4
|
+
event_bus: decore_event_bus;
|
|
5
|
+
entities: entity[];
|
|
6
|
+
systems: system[];
|
|
7
|
+
speed: number | undefined;
|
|
8
|
+
add?(...args: any[]): unknown;
|
|
9
|
+
addEntity?(...args: any[]): entity;
|
|
10
|
+
addSystem?(...args: any[]): system;
|
|
11
|
+
remove?(...args: any[]): void;
|
|
12
|
+
removeEntity?(...args: any[]): entity;
|
|
13
|
+
removeSystem?(...args: any[]): system;
|
|
14
|
+
refresh?(...args: any[]): void;
|
|
15
|
+
update?(...args: any[]): void;
|
|
16
|
+
fixed_update?(...args: any[]): void;
|
|
17
|
+
late_update?(...args: any[]): void;
|
|
18
|
+
clearEntities?(...args: any[]): void;
|
|
19
|
+
clearSystems?(...args: any[]): void;
|
|
20
|
+
getEntityCount?(...args: any[]): void;
|
|
21
|
+
getSystemCount?(...args: any[]): void;
|
|
22
|
+
setSystemIndex?(...args: any[]): void;
|
|
23
|
+
entitiesToChange: entity[];
|
|
24
|
+
entitiesToRemove: entity[];
|
|
25
|
+
systemsToChange: system[];
|
|
26
|
+
systemsToAdd: system[];
|
|
27
|
+
systemsToRemove: system[];
|
|
28
|
+
findEntities: (world: world, component_id: string, component_value: unknown | undefined) => entity[];
|
|
29
|
+
findEntity: (world: world, component_id: string, component_value: unknown | undefined) => entity | undefined;
|
|
30
|
+
}
|
|
31
|
+
interface decore {
|
|
32
|
+
}
|
|
33
|
+
interface decore_logger {
|
|
34
|
+
trace: (_: unknown, msg: string, data: unknown) => void;
|
|
35
|
+
debug: (_: unknown, msg: string, data: unknown) => void;
|
|
36
|
+
info: (_: unknown, msg: string, data: unknown) => void;
|
|
37
|
+
warn: (_: unknown, msg: string, data: unknown) => void;
|
|
38
|
+
error: (_: unknown, msg: string, data: unknown) => void;
|
|
39
|
+
}
|
|
40
|
+
interface decore_components_data {
|
|
41
|
+
pack_id: string;
|
|
42
|
+
components: LuaTable<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
interface entity {
|
|
45
|
+
id: number | undefined;
|
|
46
|
+
prefab_id: string | undefined;
|
|
47
|
+
pack_id: string | undefined;
|
|
48
|
+
parent_prefab_id: string | undefined;
|
|
49
|
+
child_instancies: entity | undefined;
|
|
50
|
+
parent_id: number | undefined;
|
|
51
|
+
children_ids: number[] | undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* System Decore class to manage child-parent relationships and default components
|
|
55
|
+
*/
|
|
56
|
+
interface system_decore extends system {
|
|
57
|
+
decore: decore;
|
|
58
|
+
id_to_entity: LuaTable<number, entity>;
|
|
59
|
+
onAddToWorld(world: world): void;
|
|
60
|
+
onRemoveFromWorld(world: world): void;
|
|
61
|
+
onAdd(entity: entity): void;
|
|
62
|
+
onRemove(entity: entity): void;
|
|
63
|
+
spawn_children(entity: entity): void;
|
|
64
|
+
remove_children(entity: entity): void;
|
|
65
|
+
remove_from_parent(entity: entity): void;
|
|
66
|
+
}
|
|
67
|
+
interface system {
|
|
68
|
+
indices: LuaTable<entity, number>;
|
|
69
|
+
id: string;
|
|
70
|
+
filter?(...args: any[]): void;
|
|
71
|
+
active: boolean;
|
|
72
|
+
world: world;
|
|
73
|
+
entities: entity[];
|
|
74
|
+
nocache: boolean;
|
|
75
|
+
index: number;
|
|
76
|
+
modified: boolean;
|
|
77
|
+
interval: number | undefined;
|
|
78
|
+
bufferedTime: number | undefined;
|
|
79
|
+
onAdd?(...args: any[]): void;
|
|
80
|
+
onRemove?(...args: any[]): void;
|
|
81
|
+
onModify?(...args: any[]): void;
|
|
82
|
+
onAddToWorld?(...args: any[]): void;
|
|
83
|
+
onRemoveFromWorld?(...args: any[]): void;
|
|
84
|
+
preWrap: ((system: system, dt: number) => void) | undefined;
|
|
85
|
+
postWrap: ((system: system, dt: number) => void) | undefined;
|
|
86
|
+
update: ((system: system, dt: number) => void) | undefined;
|
|
87
|
+
fixed_update: ((system: system, dt: number) => void) | undefined;
|
|
88
|
+
late_update: ((system: system, dt: number) => void) | undefined;
|
|
89
|
+
preProcess: ((system: system, dt: number) => void) | undefined;
|
|
90
|
+
process: ((system: system, entity: entity, dt: number) => void) | undefined;
|
|
91
|
+
postProcess: ((system: system, dt: number) => void) | undefined;
|
|
92
|
+
compare: ((e1: entity, e2: entity) => void) | undefined;
|
|
93
|
+
}
|
|
94
|
+
interface tiny_ecs_Tiny_ECS_module {
|
|
95
|
+
requireAll: (...args: unknown[]) => unknown;
|
|
96
|
+
requireAny: (...args: unknown[]) => unknown;
|
|
97
|
+
rejectAll: (...args: unknown[]) => unknown;
|
|
98
|
+
rejectAny: (...args: unknown[]) => unknown;
|
|
99
|
+
filter: (pattern: string) => LuaMultiReturn<[unknown, unknown]>;
|
|
100
|
+
system: (table: system | undefined) => system;
|
|
101
|
+
processingSystem: (table: system | undefined) => system;
|
|
102
|
+
sortedSystem: (table: system | undefined) => system;
|
|
103
|
+
sortedProcessingSystem: (table: system | undefined) => system;
|
|
104
|
+
world: (...args: unknown[]) => LuaMultiReturn<[world, unknown]>;
|
|
105
|
+
addEntity: (world: world, entity: entity) => entity;
|
|
106
|
+
addSystem: (world: world, system: system) => system;
|
|
107
|
+
add: (world: world, ...args: unknown[]) => unknown;
|
|
108
|
+
removeEntity: (world: world, entity: entity) => entity;
|
|
109
|
+
removeSystem: (world: world, system: system) => system;
|
|
110
|
+
remove: (world: world, ...args: unknown[]) => unknown;
|
|
111
|
+
refresh: (world: world) => void;
|
|
112
|
+
update: (world: world, dt: number, filter: ((...args: unknown[]) => void) | undefined) => unknown;
|
|
113
|
+
clearEntities: (world: world) => void;
|
|
114
|
+
clearSystems: (world: world) => void;
|
|
115
|
+
getEntityCount: (world: world) => number;
|
|
116
|
+
getSystemCount: (world: world) => number;
|
|
117
|
+
setSystemIndex: (world: world, system: system, index: number) => number;
|
|
118
|
+
}
|
|
119
|
+
interface decore_event_bus {
|
|
120
|
+
events: LuaTable<string, unknown[]>;
|
|
121
|
+
events_by_entity: LuaTable<string, LuaTable<entity, unknown[]>>;
|
|
122
|
+
stash: LuaTable<string, unknown[]>;
|
|
123
|
+
stash_by_entity: LuaTable<string, LuaTable<entity, unknown[]>>;
|
|
124
|
+
merge_callbacks: LuaTable<string, (new_event: unknown, events: unknown[], entity_map: LuaTable<entity, unknown[]>) => boolean>;
|
|
125
|
+
/**
|
|
126
|
+
* Pushes an event onto the queue, triggering it and processing the queue of callbacks.
|
|
127
|
+
*/
|
|
128
|
+
trigger(event_name: string | Hash, data: unknown): void;
|
|
129
|
+
/**
|
|
130
|
+
* Processes a specified event, returning the list of events and optionally calling callback with the full list.
|
|
131
|
+
*/
|
|
132
|
+
process(event_name: Hash | string, callback: ((events: unknown[]) => void) | ((context: unknown, events: unknown[]) => void) | undefined, context: unknown | undefined): unknown[] | undefined;
|
|
133
|
+
process_all(): void;
|
|
134
|
+
/**
|
|
135
|
+
* You can set the merge policy for an event. This is useful when you want to merge events of the same type.
|
|
136
|
+
*/
|
|
137
|
+
set_merge_policy(event_name: string, merge_callback: ((new_event: unknown, events: unknown[], entity_map: LuaTable<entity, unknown[]>) => boolean) | undefined): void;
|
|
138
|
+
clear_events(): void;
|
|
139
|
+
stash_to_events(): void;
|
|
140
|
+
get_events(): void;
|
|
141
|
+
get_stash(event_name: Hash | string): LuaTable[] | undefined;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* System to manage event bus inside the world
|
|
145
|
+
*/
|
|
146
|
+
interface system_bus_event extends system {
|
|
147
|
+
onAddToWorld(): void;
|
|
148
|
+
postWrap(): void;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Create a new world instance
|
|
152
|
+
*/
|
|
153
|
+
export function new_world(this: void, ...args: (system[] | undefined)[]): world;
|
|
154
|
+
/**
|
|
155
|
+
* Add window event to the world event bus
|
|
156
|
+
*/
|
|
157
|
+
export function on_message(this: void, world: world, message_id: Hash, message: LuaTable | undefined, sender: Url | undefined): void;
|
|
158
|
+
export function system<T>(this: void, system_module: T, system_id: string, require_all_filters: string | string[] | undefined): T;
|
|
159
|
+
export function processing_system<T>(this: void, system_module: T, system_id: string, require_all_filters: string | string[] | undefined): T;
|
|
160
|
+
export function sorted_system<T>(this: void, system_module: T, system_id: string, require_all_filters: string | string[] | undefined): T;
|
|
161
|
+
export function sorted_processing_system<T>(this: void, system_module: T, system_id: string, require_all_filters: string | string[] | undefined): T;
|
|
162
|
+
/**
|
|
163
|
+
* Register entity to create it with `create_prefab` function
|
|
164
|
+
*/
|
|
165
|
+
export function register_entity(this: void, entity_id: string, entity_data: LuaTable, pack_id: string | undefined): void;
|
|
166
|
+
/**
|
|
167
|
+
* Add entities pack to decore entities
|
|
168
|
+
* If entities pack with same id already loaded, do nothing.
|
|
169
|
+
* If the same id is used in different packs, the last one will be used in `create_prefab` function
|
|
170
|
+
*/
|
|
171
|
+
export function register_entities(this: void, pack_id: string, entities: LuaTable<string, LuaTable>): void;
|
|
172
|
+
/**
|
|
173
|
+
* Unload entities pack from decore entities
|
|
174
|
+
*/
|
|
175
|
+
export function unregister_entities(this: void, pack_id: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* Create new entity instance
|
|
178
|
+
*/
|
|
179
|
+
export function create(this: void, components: LuaTable<string, unknown>): entity;
|
|
180
|
+
/**
|
|
181
|
+
* Create new entity instance from prefab
|
|
182
|
+
*/
|
|
183
|
+
export function create_prefab(this: void, prefab_id: string | Hash | undefined, pack_id: string | undefined, components: LuaTable<string, unknown> | undefined): entity;
|
|
184
|
+
/**
|
|
185
|
+
* Register component to decore components
|
|
186
|
+
*/
|
|
187
|
+
export function register_component(this: void, component_id: string, component_data: LuaTable | string | number | boolean, pack_id: string | undefined): void;
|
|
188
|
+
/**
|
|
189
|
+
* Register components pack to decore components
|
|
190
|
+
*/
|
|
191
|
+
export function register_components(this: void, components_data: decore_components_data): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Unload components pack from decore components
|
|
194
|
+
*/
|
|
195
|
+
export function unregister_components(this: void, pack_id: string): void;
|
|
196
|
+
/**
|
|
197
|
+
* Return new component instance from prefab
|
|
198
|
+
*/
|
|
199
|
+
export function create_component(this: void, component_id: string, component_pack_id: string | undefined): unknown | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Add component to entity.
|
|
202
|
+
* If component not exists, it will be created with default values
|
|
203
|
+
* If component already exists, it will be merged with the new data
|
|
204
|
+
* To refresh system filters, call world:addEntity(entity) after this function
|
|
205
|
+
*/
|
|
206
|
+
export function apply_component(this: void, entity: entity, component_id: string, component_data: unknown | undefined): entity;
|
|
207
|
+
/**
|
|
208
|
+
* Add components to entity
|
|
209
|
+
* To refresh system filters, call world:addEntity(entity) after this function
|
|
210
|
+
*/
|
|
211
|
+
export function apply_components(this: void, entity: entity, components: LuaTable<string, unknown> | undefined): entity;
|
|
212
|
+
export function get_entity_by_id(this: void, world: world, id: number): entity | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Return all entities with component_id equal to component_value or all entities with component_id if component_value is nil.
|
|
215
|
+
* It looks for component_id in entity and entityToChange tables
|
|
216
|
+
*/
|
|
217
|
+
export function find_entities(this: void, world: world, component_id: string, component_value: unknown | undefined): entity[];
|
|
218
|
+
/**
|
|
219
|
+
* Log all loaded packs for entities, components and worlds
|
|
220
|
+
*/
|
|
221
|
+
export function print_loaded_packs_debug_info(this: void): void;
|
|
222
|
+
/**
|
|
223
|
+
* Log all loaded systems
|
|
224
|
+
*/
|
|
225
|
+
export function print_loaded_systems_debug_info(this: void, world: world): void;
|
|
226
|
+
export function set_logger(this: void, logger_instance: decore_logger | LuaTable | undefined): void;
|
|
227
|
+
export function get_logger(this: void, name: string | undefined, level: string | undefined): decore_logger;
|
|
228
|
+
}
|