@dcl/sdk 7.0.0-3339673898.commit-05b2027 → 7.0.0-3379451953.commit-41b47e2

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.
@@ -1210,13 +1210,67 @@ export declare type Entity = number & {
1210
1210
 
1211
1211
  declare const entitySymbol: unique symbol;
1212
1212
 
1213
+ /**
1214
+ * Error function. Prints a console error. Only works in debug mode, otherwise it does nothing.
1215
+ * @param error - string or Error object.
1216
+ * @param data - any debug information.
1217
+ * @public
1218
+ */
1213
1219
  export declare const error: (message: string | Error, data?: any) => void;
1214
1220
 
1221
+ export declare namespace EventsSystem {
1222
+ export type Callback = (event: PBPointerEventsResult_PointerCommand) => void | Promise<void>;
1223
+ export type Options = {
1224
+ button?: InputAction;
1225
+ hoverText?: string;
1226
+ };
1227
+ /**
1228
+ * Remove the callback for onClick event
1229
+ * @param entity Entity where the callback was attached
1230
+ */
1231
+ export function removeOnClick(entity: Entity): void;
1232
+ /**
1233
+ * Remove the callback for onPointerDown event
1234
+ * @param entity Entity where the callback was attached
1235
+ */
1236
+ export function removeOnPointerDown(entity: Entity): void;
1237
+ /**
1238
+ * Remove the callback for onPointerUp event
1239
+ * @param entity Entity where the callback was attached
1240
+ */
1241
+ export function removeOnPointerUp(entity: Entity): void;
1242
+ /**
1243
+ * Execute callback when the user clicks the entity.
1244
+ * @param entity Entity to attach the callback
1245
+ * @param cb Function to execute when onPointerDown fires
1246
+ * @param opts Opts to trigger Feedback and Button
1247
+ */
1248
+ export function onClick(entity: Entity, cb: Callback, opts?: Options): void;
1249
+ /**
1250
+ * Execute callback when the user a the entity
1251
+ * @param entity Entity to attach the callback
1252
+ * @param cb Function to execute when click fires
1253
+ * @param opts Opts to trigger Feedback and Button
1254
+ */
1255
+ export function onPointerDown(entity: Entity, cb: Callback, opts?: Options): void;
1256
+ /**
1257
+ * Execute callback when the user releases the InputButton pointing at the entity
1258
+ * @param entity Entity to attach the callback
1259
+ * @param cb Function to execute when click fires
1260
+ * @param opts Opts to trigger Feedback and Button
1261
+ */
1262
+ export function onPointerUp(entity: Entity, cb: Callback, opts?: Options): void;
1263
+ }
1264
+
1215
1265
  /** Excludes property keys from T where the property is assignable to U */
1216
1266
  declare type ExcludeUndefined<T> = {
1217
1267
  [P in keyof T]: undefined extends T[P] ? never : P;
1218
1268
  }[keyof T];
1219
1269
 
1270
+ /**
1271
+ * @public
1272
+ * Execute async task
1273
+ */
1220
1274
  export declare const executeTask: (task: Task<unknown>) => void;
1221
1275
 
1222
1276
  /** @public */
@@ -1259,6 +1313,12 @@ export declare type IEngine = {
1259
1313
  * @param firstEntity - the root entity of the tree
1260
1314
  */
1261
1315
  removeEntityWithChildren(firstEntity: Entity): void;
1316
+ /**
1317
+ * Check if an entity exists in the engine
1318
+ * @param entity - the entity to validate
1319
+ * @returns true if the entity exists in the engine
1320
+ */
1321
+ entityExists(entity: Entity): boolean;
1262
1322
  /**
1263
1323
  * Add the system to the engine. It will be called every tick updated.
1264
1324
  * @param system function that receives the delta time between last tick and current one.
@@ -1458,6 +1518,11 @@ export declare type ISchema<T = any> = {
1458
1518
  create(): T;
1459
1519
  };
1460
1520
 
1521
+ /**
1522
+ * Log function. Only works in debug mode, otherwise it does nothing.
1523
+ * @param args - any loggable parameter
1524
+ * @public
1525
+ */
1461
1526
  export declare const log: (...a: any[]) => void;
1462
1527
 
1463
1528
  /**
@@ -3097,7 +3162,7 @@ export declare const PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PB
3097
3162
  export declare type PreEngine = ReturnType<typeof preEngine>;
3098
3163
 
3099
3164
  declare function preEngine(): {
3100
- entitiesComponent: Map<number, Set<number>>;
3165
+ entityExists: (entity: Entity) => boolean;
3101
3166
  componentsDefinition: Map<number, ComponentDefinition<any, any>>;
3102
3167
  addEntity: (dynamic?: boolean) => Entity;
3103
3168
  addDynamicEntity: () => Entity;