hytopia 0.1.76 → 0.1.78
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/boilerplate/index.ts +2 -2
- package/docs/server.entitymanager.getallplayerentities.md +3 -39
- package/docs/server.entitymanager.getplayerentitiesbyplayer.md +55 -0
- package/docs/server.entitymanager.md +16 -2
- package/docs/server.gameserver.md +2 -2
- package/docs/{server.gameserver.modelmanager.md → server.gameserver.modelregistry.md} +3 -3
- package/docs/server.md +1 -1
- package/docs/{server.modelmanager.getboundingbox.md → server.modelregistry.getboundingbox.md} +2 -2
- package/docs/server.modelregistry.instance.md +13 -0
- package/docs/{server.modelmanager.md → server.modelregistry.md} +12 -12
- package/docs/server.playermanager.getconnectedplayersbyworld.md +55 -0
- package/docs/server.playermanager.md +14 -0
- package/docs/server.sceneuimanager.getsceneuibyid.md +55 -0
- package/docs/server.sceneuimanager.md +14 -0
- package/examples/ai-agents/README.md +47 -0
- package/examples/ai-agents/assets/map.json +25828 -0
- package/examples/ai-agents/assets/ui/index.html +215 -0
- package/examples/ai-agents/index.ts +350 -0
- package/examples/ai-agents/package.json +16 -0
- package/examples/ai-agents/src/BaseAgent.ts +482 -0
- package/examples/ai-agents/src/behaviors/FishingBehavior.ts +181 -0
- package/examples/ai-agents/src/behaviors/FollowBehavior.ts +171 -0
- package/examples/ai-agents/src/behaviors/MiningBehavior.ts +226 -0
- package/examples/ai-agents/src/behaviors/PathfindingBehavior.ts +435 -0
- package/examples/ai-agents/src/behaviors/SpeakBehavior.ts +50 -0
- package/examples/ai-agents/src/behaviors/TradeBehavior.ts +254 -0
- package/examples/big-world/index.ts +1 -1
- package/examples/block-entity/index.ts +3 -3
- package/examples/custom-ui/index.ts +1 -1
- package/examples/entity-controller/MyEntityController.ts +1 -1
- package/examples/entity-controller/index.ts +1 -1
- package/examples/entity-spawn/index.ts +1 -1
- package/examples/hole-in-wall-game/index.ts +1 -1
- package/examples/lighting/index.ts +1 -1
- package/examples/payload-game/index.ts +1 -1
- package/examples/wall-dodge-game/index.ts +1 -1
- package/package.json +1 -1
- package/server.api.json +181 -38
- package/server.d.ts +31 -21
- package/server.js +19 -19
- package/docs/server.modelmanager.instance.md +0 -13
package/server.api.json
CHANGED
@@ -12080,20 +12080,11 @@
|
|
12080
12080
|
{
|
12081
12081
|
"kind": "Method",
|
12082
12082
|
"canonicalReference": "server!EntityManager#getAllPlayerEntities:member(1)",
|
12083
|
-
"docComment": "/**\n * Gets all spawned entities in the world
|
12083
|
+
"docComment": "/**\n * Gets all spawned player entities in the world.\n *\n * @returns All spawned player entities in the world.\n */\n",
|
12084
12084
|
"excerptTokens": [
|
12085
12085
|
{
|
12086
12086
|
"kind": "Content",
|
12087
|
-
"text": "getAllPlayerEntities(
|
12088
|
-
},
|
12089
|
-
{
|
12090
|
-
"kind": "Reference",
|
12091
|
-
"text": "Player",
|
12092
|
-
"canonicalReference": "server!Player:class"
|
12093
|
-
},
|
12094
|
-
{
|
12095
|
-
"kind": "Content",
|
12096
|
-
"text": "): "
|
12087
|
+
"text": "getAllPlayerEntities(): "
|
12097
12088
|
},
|
12098
12089
|
{
|
12099
12090
|
"kind": "Reference",
|
@@ -12111,22 +12102,13 @@
|
|
12111
12102
|
],
|
12112
12103
|
"isStatic": false,
|
12113
12104
|
"returnTypeTokenRange": {
|
12114
|
-
"startIndex":
|
12115
|
-
"endIndex":
|
12105
|
+
"startIndex": 1,
|
12106
|
+
"endIndex": 3
|
12116
12107
|
},
|
12117
12108
|
"releaseTag": "Public",
|
12118
12109
|
"isProtected": false,
|
12119
12110
|
"overloadIndex": 1,
|
12120
|
-
"parameters": [
|
12121
|
-
{
|
12122
|
-
"parameterName": "player",
|
12123
|
-
"parameterTypeTokenRange": {
|
12124
|
-
"startIndex": 1,
|
12125
|
-
"endIndex": 2
|
12126
|
-
},
|
12127
|
-
"isOptional": false
|
12128
|
-
}
|
12129
|
-
],
|
12111
|
+
"parameters": [],
|
12130
12112
|
"isOptional": false,
|
12131
12113
|
"isAbstract": false,
|
12132
12114
|
"name": "getAllPlayerEntities"
|
@@ -12307,6 +12289,60 @@
|
|
12307
12289
|
"isAbstract": false,
|
12308
12290
|
"name": "getEntity"
|
12309
12291
|
},
|
12292
|
+
{
|
12293
|
+
"kind": "Method",
|
12294
|
+
"canonicalReference": "server!EntityManager#getPlayerEntitiesByPlayer:member(1)",
|
12295
|
+
"docComment": "/**\n * Gets all spawned entities in the world assigned to the provided player.\n *\n * @param player - The player to get the entities for.\n *\n * @returns All spawned entities in the world assigned to the player.\n */\n",
|
12296
|
+
"excerptTokens": [
|
12297
|
+
{
|
12298
|
+
"kind": "Content",
|
12299
|
+
"text": "getPlayerEntitiesByPlayer(player: "
|
12300
|
+
},
|
12301
|
+
{
|
12302
|
+
"kind": "Reference",
|
12303
|
+
"text": "Player",
|
12304
|
+
"canonicalReference": "server!Player:class"
|
12305
|
+
},
|
12306
|
+
{
|
12307
|
+
"kind": "Content",
|
12308
|
+
"text": "): "
|
12309
|
+
},
|
12310
|
+
{
|
12311
|
+
"kind": "Reference",
|
12312
|
+
"text": "PlayerEntity",
|
12313
|
+
"canonicalReference": "server!PlayerEntity:class"
|
12314
|
+
},
|
12315
|
+
{
|
12316
|
+
"kind": "Content",
|
12317
|
+
"text": "[]"
|
12318
|
+
},
|
12319
|
+
{
|
12320
|
+
"kind": "Content",
|
12321
|
+
"text": ";"
|
12322
|
+
}
|
12323
|
+
],
|
12324
|
+
"isStatic": false,
|
12325
|
+
"returnTypeTokenRange": {
|
12326
|
+
"startIndex": 3,
|
12327
|
+
"endIndex": 5
|
12328
|
+
},
|
12329
|
+
"releaseTag": "Public",
|
12330
|
+
"isProtected": false,
|
12331
|
+
"overloadIndex": 1,
|
12332
|
+
"parameters": [
|
12333
|
+
{
|
12334
|
+
"parameterName": "player",
|
12335
|
+
"parameterTypeTokenRange": {
|
12336
|
+
"startIndex": 1,
|
12337
|
+
"endIndex": 2
|
12338
|
+
},
|
12339
|
+
"isOptional": false
|
12340
|
+
}
|
12341
|
+
],
|
12342
|
+
"isOptional": false,
|
12343
|
+
"isAbstract": false,
|
12344
|
+
"name": "getPlayerEntitiesByPlayer"
|
12345
|
+
},
|
12310
12346
|
{
|
12311
12347
|
"kind": "Property",
|
12312
12348
|
"canonicalReference": "server!EntityManager#world:member",
|
@@ -13628,17 +13664,17 @@
|
|
13628
13664
|
},
|
13629
13665
|
{
|
13630
13666
|
"kind": "Property",
|
13631
|
-
"canonicalReference": "server!GameServer#
|
13667
|
+
"canonicalReference": "server!GameServer#modelRegistry:member",
|
13632
13668
|
"docComment": "/**\n * The model manager for the game server.\n */\n",
|
13633
13669
|
"excerptTokens": [
|
13634
13670
|
{
|
13635
13671
|
"kind": "Content",
|
13636
|
-
"text": "get
|
13672
|
+
"text": "get modelRegistry(): "
|
13637
13673
|
},
|
13638
13674
|
{
|
13639
13675
|
"kind": "Reference",
|
13640
|
-
"text": "
|
13641
|
-
"canonicalReference": "server!
|
13676
|
+
"text": "ModelRegistry",
|
13677
|
+
"canonicalReference": "server!ModelRegistry:class"
|
13642
13678
|
},
|
13643
13679
|
{
|
13644
13680
|
"kind": "Content",
|
@@ -13648,7 +13684,7 @@
|
|
13648
13684
|
"isReadonly": true,
|
13649
13685
|
"isOptional": false,
|
13650
13686
|
"releaseTag": "Public",
|
13651
|
-
"name": "
|
13687
|
+
"name": "modelRegistry",
|
13652
13688
|
"propertyTypeTokenRange": {
|
13653
13689
|
"startIndex": 1,
|
13654
13690
|
"endIndex": 2
|
@@ -16655,23 +16691,23 @@
|
|
16655
16691
|
},
|
16656
16692
|
{
|
16657
16693
|
"kind": "Class",
|
16658
|
-
"canonicalReference": "server!
|
16659
|
-
"docComment": "/**\n * Manages model data for all known models of the game.\n *\n * @remarks\n *\n * The
|
16694
|
+
"canonicalReference": "server!ModelRegistry:class",
|
16695
|
+
"docComment": "/**\n * Manages model data for all known models of the game.\n *\n * @remarks\n *\n * The ModelRegistry is created internally as a global singletone accessible with the static property `ModelRegistry.instance`.\n *\n * The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `ModelRegistry` class.\n *\n * @example\n * ```typescript\n * import { ModelRegistry } from 'hytopia';\n *\n * const modelRegistry = ModelRegistry.instance;\n * const boundingBox = modelRegistry.getBoundingBox('models/player.gltf');\n * ```\n *\n * @public\n */\n",
|
16660
16696
|
"excerptTokens": [
|
16661
16697
|
{
|
16662
16698
|
"kind": "Content",
|
16663
|
-
"text": "export default class
|
16699
|
+
"text": "export default class ModelRegistry "
|
16664
16700
|
}
|
16665
16701
|
],
|
16666
|
-
"fileUrlPath": "src/models/
|
16702
|
+
"fileUrlPath": "src/models/ModelRegistry.ts",
|
16667
16703
|
"releaseTag": "Public",
|
16668
16704
|
"isAbstract": false,
|
16669
|
-
"name": "
|
16705
|
+
"name": "ModelRegistry",
|
16670
16706
|
"preserveMemberOrder": false,
|
16671
16707
|
"members": [
|
16672
16708
|
{
|
16673
16709
|
"kind": "Method",
|
16674
|
-
"canonicalReference": "server!
|
16710
|
+
"canonicalReference": "server!ModelRegistry#getBoundingBox:member(1)",
|
16675
16711
|
"docComment": "/**\n * Retrieves the bounding box of a model.\n *\n * @param modelUri - The URI of the model to retrieve the bounding box for.\n *\n * @returns The bounding box of the model.\n */\n",
|
16676
16712
|
"excerptTokens": [
|
16677
16713
|
{
|
@@ -16720,8 +16756,8 @@
|
|
16720
16756
|
},
|
16721
16757
|
{
|
16722
16758
|
"kind": "Property",
|
16723
|
-
"canonicalReference": "server!
|
16724
|
-
"docComment": "/**\n * The global
|
16759
|
+
"canonicalReference": "server!ModelRegistry.instance:member",
|
16760
|
+
"docComment": "/**\n * The global ModelRegistry instance as a singleton.\n */\n",
|
16725
16761
|
"excerptTokens": [
|
16726
16762
|
{
|
16727
16763
|
"kind": "Content",
|
@@ -16729,8 +16765,8 @@
|
|
16729
16765
|
},
|
16730
16766
|
{
|
16731
16767
|
"kind": "Reference",
|
16732
|
-
"text": "
|
16733
|
-
"canonicalReference": "server!
|
16768
|
+
"text": "ModelRegistry",
|
16769
|
+
"canonicalReference": "server!ModelRegistry:class"
|
16734
16770
|
},
|
16735
16771
|
{
|
16736
16772
|
"kind": "Content",
|
@@ -21212,6 +21248,60 @@
|
|
21212
21248
|
"isAbstract": false,
|
21213
21249
|
"name": "getConnectedPlayers"
|
21214
21250
|
},
|
21251
|
+
{
|
21252
|
+
"kind": "Method",
|
21253
|
+
"canonicalReference": "server!PlayerManager#getConnectedPlayersByWorld:member(1)",
|
21254
|
+
"docComment": "/**\n * Get all connected players in a specific world.\n *\n * @param world - The world to get connected players for.\n *\n * @returns An array of all connected players in the world.\n */\n",
|
21255
|
+
"excerptTokens": [
|
21256
|
+
{
|
21257
|
+
"kind": "Content",
|
21258
|
+
"text": "getConnectedPlayersByWorld(world: "
|
21259
|
+
},
|
21260
|
+
{
|
21261
|
+
"kind": "Reference",
|
21262
|
+
"text": "World",
|
21263
|
+
"canonicalReference": "server!World:class"
|
21264
|
+
},
|
21265
|
+
{
|
21266
|
+
"kind": "Content",
|
21267
|
+
"text": "): "
|
21268
|
+
},
|
21269
|
+
{
|
21270
|
+
"kind": "Reference",
|
21271
|
+
"text": "Player",
|
21272
|
+
"canonicalReference": "server!Player:class"
|
21273
|
+
},
|
21274
|
+
{
|
21275
|
+
"kind": "Content",
|
21276
|
+
"text": "[]"
|
21277
|
+
},
|
21278
|
+
{
|
21279
|
+
"kind": "Content",
|
21280
|
+
"text": ";"
|
21281
|
+
}
|
21282
|
+
],
|
21283
|
+
"isStatic": false,
|
21284
|
+
"returnTypeTokenRange": {
|
21285
|
+
"startIndex": 3,
|
21286
|
+
"endIndex": 5
|
21287
|
+
},
|
21288
|
+
"releaseTag": "Public",
|
21289
|
+
"isProtected": false,
|
21290
|
+
"overloadIndex": 1,
|
21291
|
+
"parameters": [
|
21292
|
+
{
|
21293
|
+
"parameterName": "world",
|
21294
|
+
"parameterTypeTokenRange": {
|
21295
|
+
"startIndex": 1,
|
21296
|
+
"endIndex": 2
|
21297
|
+
},
|
21298
|
+
"isOptional": false
|
21299
|
+
}
|
21300
|
+
],
|
21301
|
+
"isOptional": false,
|
21302
|
+
"isAbstract": false,
|
21303
|
+
"name": "getConnectedPlayersByWorld"
|
21304
|
+
},
|
21215
21305
|
{
|
21216
21306
|
"kind": "Property",
|
21217
21307
|
"canonicalReference": "server!PlayerManager.instance:member",
|
@@ -28037,6 +28127,59 @@
|
|
28037
28127
|
"isAbstract": false,
|
28038
28128
|
"name": "getAllSceneUIs"
|
28039
28129
|
},
|
28130
|
+
{
|
28131
|
+
"kind": "Method",
|
28132
|
+
"canonicalReference": "server!SceneUIManager#getSceneUIById:member(1)",
|
28133
|
+
"docComment": "/**\n * Retrieves a SceneUI instance by its unique identifier (id).\n *\n * @param id - The unique identifier (id) of the SceneUI to retrieve.\n *\n * @returns The SceneUI instance if found, otherwise undefined.\n */\n",
|
28134
|
+
"excerptTokens": [
|
28135
|
+
{
|
28136
|
+
"kind": "Content",
|
28137
|
+
"text": "getSceneUIById(id: "
|
28138
|
+
},
|
28139
|
+
{
|
28140
|
+
"kind": "Content",
|
28141
|
+
"text": "number"
|
28142
|
+
},
|
28143
|
+
{
|
28144
|
+
"kind": "Content",
|
28145
|
+
"text": "): "
|
28146
|
+
},
|
28147
|
+
{
|
28148
|
+
"kind": "Reference",
|
28149
|
+
"text": "SceneUI",
|
28150
|
+
"canonicalReference": "server!SceneUI:class"
|
28151
|
+
},
|
28152
|
+
{
|
28153
|
+
"kind": "Content",
|
28154
|
+
"text": " | undefined"
|
28155
|
+
},
|
28156
|
+
{
|
28157
|
+
"kind": "Content",
|
28158
|
+
"text": ";"
|
28159
|
+
}
|
28160
|
+
],
|
28161
|
+
"isStatic": false,
|
28162
|
+
"returnTypeTokenRange": {
|
28163
|
+
"startIndex": 3,
|
28164
|
+
"endIndex": 5
|
28165
|
+
},
|
28166
|
+
"releaseTag": "Public",
|
28167
|
+
"isProtected": false,
|
28168
|
+
"overloadIndex": 1,
|
28169
|
+
"parameters": [
|
28170
|
+
{
|
28171
|
+
"parameterName": "id",
|
28172
|
+
"parameterTypeTokenRange": {
|
28173
|
+
"startIndex": 1,
|
28174
|
+
"endIndex": 2
|
28175
|
+
},
|
28176
|
+
"isOptional": false
|
28177
|
+
}
|
28178
|
+
],
|
28179
|
+
"isOptional": false,
|
28180
|
+
"isAbstract": false,
|
28181
|
+
"name": "getSceneUIById"
|
28182
|
+
},
|
28040
28183
|
{
|
28041
28184
|
"kind": "Method",
|
28042
28185
|
"canonicalReference": "server!SceneUIManager#unloadEntityAttachedSceneUIs:member(1)",
|
package/server.d.ts
CHANGED
@@ -1574,11 +1574,16 @@ export declare class EntityManager {
|
|
1574
1574
|
*/
|
1575
1575
|
getAllEntities(): Entity[];
|
1576
1576
|
/**
|
1577
|
-
* Gets all spawned entities in the world
|
1577
|
+
* Gets all spawned player entities in the world.
|
1578
|
+
* @returns All spawned player entities in the world.
|
1579
|
+
*/
|
1580
|
+
getAllPlayerEntities(): PlayerEntity[];
|
1581
|
+
/**
|
1582
|
+
* Gets all spawned entities in the world assigned to the provided player.
|
1578
1583
|
* @param player - The player to get the entities for.
|
1579
1584
|
* @returns All spawned entities in the world assigned to the player.
|
1580
1585
|
*/
|
1581
|
-
|
1586
|
+
getPlayerEntitiesByPlayer(player: Player): PlayerEntity[];
|
1582
1587
|
/**
|
1583
1588
|
* Gets a spawned entity in the world by its id.
|
1584
1589
|
* @param id - The id of the entity to get.
|
@@ -1763,7 +1768,7 @@ export declare class GameServer {
|
|
1763
1768
|
/** The singleton instance of the game server. */
|
1764
1769
|
static get instance(): GameServer;
|
1765
1770
|
/** The model manager for the game server. */
|
1766
|
-
get
|
1771
|
+
get modelRegistry(): ModelRegistry;
|
1767
1772
|
/** The player manager for the game server. */
|
1768
1773
|
get playerManager(): PlayerManager;
|
1769
1774
|
|
@@ -2072,39 +2077,31 @@ export declare enum LightType {
|
|
2072
2077
|
|
2073
2078
|
/** A bounding box for a model. @public */
|
2074
2079
|
declare type ModelBoundingBox = {
|
2075
|
-
min:
|
2076
|
-
|
2077
|
-
y: number;
|
2078
|
-
z: number;
|
2079
|
-
};
|
2080
|
-
max: {
|
2081
|
-
x: number;
|
2082
|
-
y: number;
|
2083
|
-
z: number;
|
2084
|
-
};
|
2080
|
+
min: Vector3Like;
|
2081
|
+
max: Vector3Like;
|
2085
2082
|
};
|
2086
2083
|
|
2087
2084
|
/**
|
2088
2085
|
* Manages model data for all known models of the game.
|
2089
2086
|
*
|
2090
2087
|
* @remarks
|
2091
|
-
* The
|
2088
|
+
* The ModelRegistry is created internally as a global
|
2092
2089
|
* singletone accessible with the static property
|
2093
|
-
* `
|
2090
|
+
* `ModelRegistry.instance`.
|
2094
2091
|
*
|
2095
2092
|
* @example
|
2096
2093
|
* ```typescript
|
2097
|
-
* import {
|
2094
|
+
* import { ModelRegistry } from 'hytopia';
|
2098
2095
|
*
|
2099
|
-
* const
|
2100
|
-
* const boundingBox =
|
2096
|
+
* const modelRegistry = ModelRegistry.instance;
|
2097
|
+
* const boundingBox = modelRegistry.getBoundingBox('models/player.gltf');
|
2101
2098
|
* ```
|
2102
2099
|
*
|
2103
2100
|
* @public
|
2104
2101
|
*/
|
2105
|
-
export declare class
|
2106
|
-
/** The global
|
2107
|
-
static readonly instance:
|
2102
|
+
export declare class ModelRegistry {
|
2103
|
+
/** The global ModelRegistry instance as a singleton. */
|
2104
|
+
static readonly instance: ModelRegistry;
|
2108
2105
|
|
2109
2106
|
|
2110
2107
|
|
@@ -2650,6 +2647,12 @@ export declare class PlayerManager {
|
|
2650
2647
|
* @returns An array of all connected players.
|
2651
2648
|
*/
|
2652
2649
|
getConnectedPlayers(): Player[];
|
2650
|
+
/**
|
2651
|
+
* Get all connected players in a specific world.
|
2652
|
+
* @param world - The world to get connected players for.
|
2653
|
+
* @returns An array of all connected players in the world.
|
2654
|
+
*/
|
2655
|
+
getConnectedPlayersByWorld(world: World): Player[];
|
2653
2656
|
/**
|
2654
2657
|
* Get a connected player by their username (case insensitive).
|
2655
2658
|
* @param username - The username of the player to get.
|
@@ -3448,6 +3451,13 @@ export declare class SceneUIManager {
|
|
3448
3451
|
* @returns An array of SceneUI instances.
|
3449
3452
|
*/
|
3450
3453
|
getAllEntityAttachedSceneUIs(entity: Entity): SceneUI[];
|
3454
|
+
/**
|
3455
|
+
* Retrieves a SceneUI instance by its unique identifier (id).
|
3456
|
+
*
|
3457
|
+
* @param id - The unique identifier (id) of the SceneUI to retrieve.
|
3458
|
+
* @returns The SceneUI instance if found, otherwise undefined.
|
3459
|
+
*/
|
3460
|
+
getSceneUIById(id: number): SceneUI | undefined;
|
3451
3461
|
|
3452
3462
|
/**
|
3453
3463
|
* Unloads and unregisters all SceneUI instances attached to a specific entity.
|