@casual-simulation/aux-runtime 3.5.3-alpha.15935735538 → 3.5.3-alpha.16326443512

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.
@@ -12251,6 +12251,49 @@ export interface RecordPackageVersionSuccess extends CrudRecordItemSuccess {
12251
12251
  auxFileResult: RecordFileResult;
12252
12252
  }
12253
12253
 
12254
+ /**
12255
+ * The kinds of map layers that can be added to the map or miniMapPortal.
12256
+ *
12257
+ * @dochash types/os/maps
12258
+ * @docid MapLayer
12259
+ */
12260
+ export type MapLayer = GeoJSONMapLayer;
12261
+
12262
+ /**
12263
+ * Defines a base interface for map layers.
12264
+ *
12265
+ * @dochash types/os/maps
12266
+ * @docid MapLayerBase
12267
+ */
12268
+ export interface MapLayerBase {
12269
+ /**
12270
+ * Copyright information for the layer.
12271
+ */
12272
+ copyright?: string;
12273
+ }
12274
+
12275
+ /**
12276
+ * A map layer that contains GeoJSON data.
12277
+ *
12278
+ * @dochash types/os/maps
12279
+ * @docid GeoJSONMapLayer
12280
+ */
12281
+ export interface GeoJSONMapLayer extends MapLayerBase {
12282
+ type: 'geojson';
12283
+
12284
+ /**
12285
+ * The URL that contains the GeoJSON data.
12286
+ *
12287
+ * Can be a blob url, a data url, or a regular URL.
12288
+ */
12289
+ url?: string;
12290
+
12291
+ /**
12292
+ * The GeoJSON data for the layer.
12293
+ */
12294
+ data?: object;
12295
+ }
12296
+
12254
12297
  interface Ai {
12255
12298
  /**
12256
12299
  * Sends a chat message to the AI.
@@ -15213,6 +15256,68 @@ interface Os {
15213
15256
  */
15214
15257
  calculateScreenCoordinatesFromViewportCoordinates(portal: 'grid' | 'miniGrid' | 'map' | 'miniMap', coordinates: Vector2): Promise<Vector2>;
15215
15258
 
15259
+ /**
15260
+ * Calculates the screen coordinates that the given 3D position map to on the screen.
15261
+ * Returns a promise that resolves with the calculated screen coordinates.
15262
+ *
15263
+ * Screen coordinates are in pixels and are relative to the top-left corner of the screen.
15264
+ *
15265
+ * @param portal the name of the portal that should be tested.
15266
+ * @param coordinate the 3D position that should be converted to screen coordinates.
15267
+ *
15268
+ * @example Calculate the screen coordinates of the bots in the home dimension in the grid portal
15269
+ * const botPositions = getBots(inDimension('home')).map(bot => new Vector3(bot.tags.homeX, bot.tags.homeY, bot.tags.homeZ));
15270
+ * const coordinates = await os.calculateScreenCoordinatesFromPosition('grid', botPositions);
15271
+ *
15272
+ * @dochash actions/os/portals
15273
+ * @docname os.calculateScreenCoordinatesFromPosition
15274
+ * @docid os.calculateScreenCoordinatesFromPosition
15275
+ * @docgroup 10-raycast
15276
+ */
15277
+ calculateScreenCoordinatesFromPosition(
15278
+ portal: 'grid' | 'miniGrid' | 'map' | 'miniMap',
15279
+ coordinate: Point3D
15280
+ ): Promise<Vector2>;
15281
+ /**
15282
+ * Calculates the screen coordinates that the given 3D position map to on the screen.
15283
+ * Returns a promise that resolves with the calculated screen coordinates.
15284
+ *
15285
+ * Screen coordinates are in pixels and are relative to the top-left corner of the screen.
15286
+ *
15287
+ * @param portal the name of the portal that should be tested.
15288
+ * @param coordinates the 3D positions that should be converted to screen coordinates.
15289
+ *
15290
+ * @example Calculate the screen coordinates of the bots in the home dimension in the grid portal
15291
+ * const botPositions = getBots(inDimension('home')).map(bot => new Vector3(bot.tags.homeX, bot.tags.homeY, bot.tags.homeZ));
15292
+ * const coordinates = await os.calculateScreenCoordinatesFromPosition('grid', botPositions);
15293
+ *
15294
+ * @dochash actions/os/portals
15295
+ * @docname os.calculateScreenCoordinatesFromPosition
15296
+ * @docid os.calculateScreenCoordinatesFromPosition-array
15297
+ * @docgroup 10-raycast
15298
+ */
15299
+ calculateScreenCoordinatesFromPosition(
15300
+ portal: 'grid' | 'miniGrid' | 'map' | 'miniMap',
15301
+ coordinates: Point3D[]
15302
+ ): Promise<Vector2[]>;
15303
+ /**
15304
+ * Calculates the screen coordinates that the given 3D position map to on the screen.
15305
+ * Returns a promise that resolves with the calculated screen coordinates.
15306
+ *
15307
+ * Screen coordinates are in pixels and are relative to the top-left corner of the screen.
15308
+ *
15309
+ * @param portal the name of the portal that should be tested.
15310
+ * @param coordinates the 3D positions that should be converted to screen coordinates.
15311
+ *
15312
+ * @example Calculate the screen coordinates of the bots in the home dimension in the grid portal
15313
+ * const botPositions = getBots(inDimension('home')).map(bot => new Vector3(bot.tags.homeX, bot.tags.homeY, bot.tags.homeZ));
15314
+ * const coordinates = await os.calculateScreenCoordinatesFromPosition('grid', botPositions);
15315
+ */
15316
+ calculateScreenCoordinatesFromPosition(
15317
+ portal: 'grid' | 'miniGrid' | 'map' | 'miniMap',
15318
+ coordinates: Point3D | Point3D[]
15319
+ ): Promise<Vector2[] | Vector2>;
15320
+
15216
15321
  /**
15217
15322
  * Calculates the viewport coordinates that the given screen coordinates map to on the camera.
15218
15323
  * Returns a promise that resolves with the calculated viewport coordinates.
@@ -15451,6 +15556,80 @@ interface Os {
15451
15556
  */
15452
15557
  detachDebugger(debug: Debugger): Promise<void>;
15453
15558
 
15559
+ /**
15560
+ * Adds a map layer to the map or miniMap portal.
15561
+ *
15562
+ * Returns a promise that resolves with the ID of the layer that was added.
15563
+ *
15564
+ * @param portal The portal that the layer should be added to. Either 'map' or 'miniMap'.
15565
+ * @param layer The layer that should be added.
15566
+ *
15567
+ * @example Add a GeoJSON layer to the map portal
15568
+ * const layerId = await os.addMapLayer('map', {
15569
+ * type: 'geojson',
15570
+ * data: {
15571
+ * type: "FeatureCollection",
15572
+ * features: [
15573
+ * {
15574
+ * type: "Feature",
15575
+ * geometry: { type: "Point", coordinates: [102.0, 0.5] },
15576
+ * properties: { prop0: "value0" }
15577
+ * },
15578
+ * {
15579
+ * type: "Feature",
15580
+ * geometry: {
15581
+ * type: "LineString",
15582
+ * coordinates: [
15583
+ * [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
15584
+ * ]
15585
+ * },
15586
+ * properties: {
15587
+ * prop0: "value0",
15588
+ * prop1: 0.0
15589
+ * }
15590
+ * },
15591
+ * {
15592
+ * type: "Feature",
15593
+ * geometry: {
15594
+ * type: "Polygon",
15595
+ * coordinates: [
15596
+ * [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
15597
+ * [100.0, 1.0], [100.0, 0.0]]
15598
+ * ]
15599
+ * },
15600
+ * properties: {
15601
+ * prop0: "value0",
15602
+ * prop1: { "this": "that" }
15603
+ * }
15604
+ * }
15605
+ * ]
15606
+ * }
15607
+ * });
15608
+ *
15609
+ * @dochash action/os/maps
15610
+ * @doctitle Map Actions
15611
+ * @docsidebar Maps
15612
+ * @docdescription Actions for working with maps and map layers.
15613
+ * @docid os.addMapLayer
15614
+ */
15615
+ addMapLayer(portal: 'map' | 'miniMap', layer: MapLayer): Promise<string>;
15616
+
15617
+ /**
15618
+ * Removes a layer from the map or miniMap portal.
15619
+ *
15620
+ * Returns a promise that resolves when the layer has been removed.
15621
+ *
15622
+ * @param layerId The ID of the layer to remove.
15623
+ * @returns A promise that resolves when the layer has been removed.
15624
+ *
15625
+ * @example Remove a layer from the map portal
15626
+ * await os.removeMapLayer('my-layer-id');
15627
+ *
15628
+ * @dochash action/os/maps
15629
+ * @docid os.removeMapLayer
15630
+ */
15631
+ removeMapLayer(layerId: string): Promise<void>;
15632
+
15454
15633
  /**
15455
15634
  * The global variables that are stored in the OS.
15456
15635
  */