hytopia 0.14.49 → 0.14.50
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/docs/server.audio.md +1 -1
- package/docs/server.audio.setattachedtoentity.md +4 -0
- package/docs/server.audio.setposition.md +5 -1
- package/docs/server.audiomanager.unregisteraudio.md +4 -0
- package/docs/server.audiomanager.unregisterentityattachedaudios.md +4 -0
- package/docs/server.baseentitycontroller.attach.md +6 -0
- package/docs/server.baseentitycontroller.despawn.md +7 -1
- package/docs/server.baseentitycontroller.detach.md +7 -1
- package/docs/server.baseentitycontroller.md +1 -1
- package/docs/server.baseentitycontroller.spawn.md +7 -1
- package/docs/server.baseentitycontroller.tick.md +8 -0
- package/docs/server.baseentitycontroller.tickwithplayerinput.md +8 -2
- package/docs/server.blocktyperegistry.registergenericblocktype.md +4 -0
- package/docs/server.chunklattice.clear.md +6 -0
- package/docs/server.chunklattice.getorcreatechunk.md +6 -2
- package/docs/server.chunklattice.initializeblocks.md +7 -1
- package/docs/server.chunklattice.md +1 -1
- package/docs/server.chunklattice.setblock.md +7 -1
- package/docs/server.collider.addtosimulation.md +6 -0
- package/docs/server.collider.removefromsimulation.md +4 -0
- package/docs/server.collider.setoncollision.md +4 -0
- package/docs/server.collider.setscale.md +4 -0
- package/docs/server.defaultplayerentity._constructor_.md +10 -1
- package/docs/server.defaultplayerentity.md +1 -1
- package/docs/server.defaultplayerentitycontroller.attach.md +10 -0
- package/docs/server.defaultplayerentitycontroller.md +4 -0
- package/docs/server.defaultplayerentitycontroller.spawn.md +6 -0
- package/docs/server.defaultplayerentitycontroller.tickwithplayerinput.md +10 -0
- package/docs/server.entity._constructor_.md +6 -1
- package/docs/server.entity.despawn.md +10 -0
- package/docs/server.entity.md +8 -2
- package/docs/server.entity.setmodelhiddennodes.md +4 -0
- package/docs/server.entity.setmodelscale.md +6 -0
- package/docs/server.entity.setmodelshownnodes.md +4 -0
- package/docs/server.entity.spawn.md +14 -0
- package/docs/server.entity.startmodelloopedanimations.md +1 -1
- package/docs/server.entity.startmodeloneshotanimations.md +3 -1
- package/docs/server.entity.stopallmodelanimations.md +5 -1
- package/docs/server.entity.stopmodelanimations.md +1 -1
- package/docs/server.entitymanager.getentitychildren.md +5 -1
- package/docs/server.entitymanager.getplayerentitiesbyplayer.md +2 -2
- package/docs/server.entitymanager.md +1 -1
- package/docs/server.particleemitter.setattachedtoentity.md +4 -0
- package/docs/server.particleemitter.spawn.md +4 -0
- package/docs/server.pathfindingentitycontroller.md +4 -0
- package/docs/server.pathfindingentitycontroller.pathfind.md +14 -2
- package/docs/server.persistencemanager.getglobaldata.md +6 -0
- package/docs/server.player.disconnect.md +4 -0
- package/docs/server.player.joinworld.md +1 -1
- package/docs/server.playercamera.reset.md +4 -0
- package/docs/server.playercamera.setmodelhiddennodes.md +4 -0
- package/docs/server.playercamera.setmodelshownnodes.md +4 -0
- package/docs/server.playerentity._constructor_.md +6 -1
- package/docs/server.playerentity.md +1 -1
- package/docs/server.rigidbody.addtosimulation.md +4 -0
- package/docs/server.rigidbody.removefromsimulation.md +4 -0
- package/docs/server.rigidbody.setrotation.md +4 -0
- package/docs/server.sceneui.load.md +4 -0
- package/docs/server.sceneui.md +1 -1
- package/docs/server.sceneui.setattachedtoentity.md +4 -0
- package/docs/server.sceneui.setposition.md +5 -1
- package/docs/server.sceneuimanager.unloadentityattachedsceneuis.md +4 -0
- package/docs/server.simpleentitycontroller.face.md +6 -2
- package/docs/server.simpleentitycontroller.jump.md +9 -1
- package/docs/server.simpleentitycontroller.md +5 -1
- package/docs/server.simpleentitycontroller.move.md +8 -2
- package/docs/server.simpleentitycontroller.spawn.md +4 -0
- package/docs/server.simpleentitycontroller.stopface.md +4 -0
- package/docs/server.simpleentitycontroller.stopmove.md +5 -1
- package/docs/server.simulation.getcontactmanifolds.md +1 -1
- package/docs/server.startserver.md +2 -0
- package/docs/server.world.loadmap.md +8 -0
- package/docs/server.worldmanager.createworld.md +4 -0
- package/docs/server.worldmanager.getdefaultworld.md +4 -0
- package/package.json +1 -1
- package/server.api.json +67 -67
- package/server.d.ts +403 -40
- package/server.mjs +1 -1
package/docs/server.audio.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Audio.setPosition() method
|
|
6
6
|
|
|
7
|
-
Sets the position of the audio.
|
|
7
|
+
Sets the position of the audio.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -51,3 +51,7 @@ The position in the world.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Detaches from entity:\*\* Setting a position clears any `attachedToEntity`<!-- -->. Audio can be position-based or entity-attached, not both.
|
|
57
|
+
|
|
@@ -42,7 +42,7 @@ entity
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
-
The entity
|
|
45
|
+
The entity being despawned.
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
@@ -51,3 +51,9 @@ The entity to despawn.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Called by:\*\* `Entity.despawn()` after `detach()` is called.
|
|
57
|
+
|
|
58
|
+
\*\*Super call:\*\* Call `super.despawn(entity)` to emit the `DESPAWN` event.
|
|
59
|
+
|
|
@@ -42,7 +42,7 @@ entity
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
-
The entity
|
|
45
|
+
The entity being detached.
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
@@ -51,3 +51,9 @@ The entity to detach.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Called by:\*\* `Entity.despawn()` before `despawn()` is called.
|
|
57
|
+
|
|
58
|
+
\*\*Super call:\*\* Call `super.detach(entity)` to emit the `DETACH` event.
|
|
59
|
+
|
|
@@ -119,7 +119,7 @@ Override this method to handle entity movements based on your entity controller.
|
|
|
119
119
|
|
|
120
120
|
</td><td>
|
|
121
121
|
|
|
122
|
-
Override this method to handle entity movements based on player input for your entity controller.
|
|
122
|
+
Override this method to handle entity movements based on player input for your entity controller.
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
</td></tr>
|
|
@@ -42,7 +42,7 @@ entity
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
-
The entity
|
|
45
|
+
The entity being spawned.
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
@@ -51,3 +51,9 @@ The entity to spawn.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Called by:\*\* `Entity.spawn()` after the entity is added to the physics simulation.
|
|
57
|
+
|
|
58
|
+
\*\*Super call:\*\* Call `super.spawn(entity)` to emit the `SPAWN` event.
|
|
59
|
+
|
|
@@ -42,6 +42,8 @@ entity
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
+
The entity being ticked.
|
|
46
|
+
|
|
45
47
|
|
|
46
48
|
</td></tr>
|
|
47
49
|
<tr><td>
|
|
@@ -65,3 +67,9 @@ The delta time in milliseconds since the last tick.
|
|
|
65
67
|
|
|
66
68
|
void
|
|
67
69
|
|
|
70
|
+
## Remarks
|
|
71
|
+
|
|
72
|
+
\*\*Called by:\*\* `Entity.tick()` every tick for non-environmental entities. For `PlayerEntity`<!-- -->, this is called after `tickWithPlayerInput()`<!-- -->.
|
|
73
|
+
|
|
74
|
+
\*\*Super call:\*\* Call `super.tick(entity, deltaTimeMs)` to emit the `TICK` event.
|
|
75
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## BaseEntityController.tickWithPlayerInput() method
|
|
6
6
|
|
|
7
|
-
Override this method to handle entity movements based on player input for your entity controller.
|
|
7
|
+
Override this method to handle entity movements based on player input for your entity controller.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -42,7 +42,7 @@ entity
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
-
The entity
|
|
45
|
+
The player entity being ticked.
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
@@ -99,3 +99,9 @@ The delta time in milliseconds since the last tick.
|
|
|
99
99
|
|
|
100
100
|
void
|
|
101
101
|
|
|
102
|
+
## Remarks
|
|
103
|
+
|
|
104
|
+
\*\*Called by:\*\* `PlayerEntity.tick()` every tick when `isTickWithPlayerInputEnabled` is true. Called before `tick()`<!-- -->.
|
|
105
|
+
|
|
106
|
+
\*\*Super call:\*\* Call `super.tickWithPlayerInput(...)` to emit the `TICK_WITH_PLAYER_INPUT` event.
|
|
107
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## ChunkLattice.getOrCreateChunk() method
|
|
6
6
|
|
|
7
|
-
Get the chunk for a given global coordinate.
|
|
7
|
+
Get the chunk for a given global coordinate, creating it if it doesn't exist.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -51,5 +51,9 @@ The global coordinate of the chunk to get.
|
|
|
51
51
|
|
|
52
52
|
[Chunk](./server.chunk.md)
|
|
53
53
|
|
|
54
|
-
The chunk at the given global coordinate
|
|
54
|
+
The chunk at the given global coordinate (created if needed).
|
|
55
|
+
|
|
56
|
+
## Remarks
|
|
57
|
+
|
|
58
|
+
\*\*Creates chunk:\*\* If the chunk doesn't exist, creates a new one and emits `ADD_CHUNK`<!-- -->.
|
|
55
59
|
|
|
@@ -44,7 +44,7 @@ blocks
|
|
|
44
44
|
|
|
45
45
|
</td><td>
|
|
46
46
|
|
|
47
|
-
The blocks to initialize.
|
|
47
|
+
The blocks to initialize, keyed by block type id.
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
</td></tr>
|
|
@@ -53,3 +53,9 @@ The blocks to initialize.
|
|
|
53
53
|
|
|
54
54
|
void
|
|
55
55
|
|
|
56
|
+
## Remarks
|
|
57
|
+
|
|
58
|
+
\*\*Clears first:\*\* Calls `clear()` before initializing, removing all existing blocks and colliders.
|
|
59
|
+
|
|
60
|
+
\*\*Collider optimization:\*\* Creates one collider per block type with all placements combined. Voxel colliders have their states combined for efficient neighbor collision detection.
|
|
61
|
+
|
|
@@ -74,7 +74,7 @@ blockRotation
|
|
|
74
74
|
|
|
75
75
|
</td><td>
|
|
76
76
|
|
|
77
|
-
_(Optional)_
|
|
77
|
+
_(Optional)_ The rotation of the block.
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
</td></tr>
|
|
@@ -83,3 +83,9 @@ _(Optional)_
|
|
|
83
83
|
|
|
84
84
|
void
|
|
85
85
|
|
|
86
|
+
## Remarks
|
|
87
|
+
|
|
88
|
+
\*\*Collider updates:\*\* Manages physics colliders automatically. For voxel block types, updates the existing collider. For trimesh block types, recreates the entire collider.
|
|
89
|
+
|
|
90
|
+
\*\*Removes previous:\*\* If replacing an existing block, removes it from its collider first. If the previous block type has no remaining blocks, its collider is removed from simulation.
|
|
91
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## DefaultPlayerEntity.(constructor)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Creates a new DefaultPlayerEntity instance.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -42,6 +42,15 @@ options
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
44
44
|
|
|
45
|
+
The options for the default player entity.
|
|
46
|
+
|
|
45
47
|
|
|
46
48
|
</td></tr>
|
|
47
49
|
</tbody></table>
|
|
50
|
+
|
|
51
|
+
## Remarks
|
|
52
|
+
|
|
53
|
+
\*\*Auto-assigned defaults:\*\* A `DefaultPlayerEntityController` is automatically created and assigned. Default `modelLoopedAnimations` are `['idle_lower', 'idle_upper']`<!-- -->. All defaults can be overridden via options.
|
|
54
|
+
|
|
55
|
+
\*\*Cosmetics on spawn:\*\* When spawned, player cosmetics (hair, skin, equipped items) are fetched asynchronously and applied. Child entities are created for hair and equipped cosmetic items.
|
|
56
|
+
|
|
@@ -51,3 +51,13 @@ The entity to attach the controller to.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Wraps `applyImpulse`<!-- -->:\*\* The entity's `applyImpulse` method is wrapped to track external velocities separately from internal movement. External impulses decay over time when grounded.
|
|
57
|
+
|
|
58
|
+
\*\*Locks rotations:\*\* Calls `entity.lockAllRotations()` to prevent physics from rotating the entity. Rotation is set explicitly by the controller based on camera orientation.
|
|
59
|
+
|
|
60
|
+
\*\*Enables CCD:\*\* Enables continuous collision detection on the entity.
|
|
61
|
+
|
|
62
|
+
\*\*Swimming detection:\*\* Registers a `BLOCK_COLLISION` listener to detect liquid blocks and manage swimming state, gravity scale, and animations.
|
|
63
|
+
|
|
@@ -17,6 +17,10 @@ export default class DefaultPlayerEntityController extends BaseEntityController
|
|
|
17
17
|
|
|
18
18
|
This class extends [BaseEntityController](./server.baseentitycontroller.md) and implements the default movement, platforming, jump, swimming, and other basic logic for the default player entity. We recommend you extend this class if you'd like to implement additional logic on top of the DefaultPlayerEntityController implementation.
|
|
19
19
|
|
|
20
|
+
<h2>Coordinate System & Model Orientation</h2>
|
|
21
|
+
|
|
22
|
+
HYTOPIA uses \*\*-Z as forward\*\*. Models must be authored with their front facing -Z. A yaw of 0 means facing -Z. The controller rotates the entity based on camera yaw and movement direction, always orienting the entity's -Z axis in the intended facing direction.
|
|
23
|
+
|
|
20
24
|
## Example
|
|
21
25
|
|
|
22
26
|
|
|
@@ -51,3 +51,9 @@ The entity that is spawned.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Creates colliders:\*\* Adds two child colliders to the entity: - `groundSensor`<!-- -->: Cylinder sensor below entity for ground/platform detection and landing animations - `wallCollider`<!-- -->: Capsule collider for wall collision with zero friction
|
|
57
|
+
|
|
58
|
+
\*\*Collider sizes scale:\*\* Collider dimensions scale proportionally with `entity.height`<!-- -->.
|
|
59
|
+
|
|
@@ -99,3 +99,13 @@ The delta time in milliseconds since the last tick.
|
|
|
99
99
|
|
|
100
100
|
void
|
|
101
101
|
|
|
102
|
+
## Remarks
|
|
103
|
+
|
|
104
|
+
\*\*Rotation (-Z forward):\*\* Sets entity rotation based on camera yaw. A yaw of 0 faces -Z. Movement direction offsets (WASD/joystick) are added to camera yaw to determine facing. Models must be authored with their front facing -Z.
|
|
105
|
+
|
|
106
|
+
\*\*Child entities:\*\* If `entity.parent` is set, only emits the event and returns early. Movement logic is skipped for child entities.
|
|
107
|
+
|
|
108
|
+
\*\*Input cancellation:\*\* If `autoCancelMouseLeftClick` is true (default), `input.ml` is set to `false` after processing to prevent repeated triggers.
|
|
109
|
+
|
|
110
|
+
\*\*Animations:\*\* Automatically manages idle, walk, run, jump, swim, and interact animations based on movement state and input.
|
|
111
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Entity.(constructor)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Creates a new Entity instance.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -47,3 +47,8 @@ The options for the entity.
|
|
|
47
47
|
|
|
48
48
|
</td></tr>
|
|
49
49
|
</tbody></table>
|
|
50
|
+
|
|
51
|
+
## Remarks
|
|
52
|
+
|
|
53
|
+
\*\*Controller attachment:\*\* If `controller` is provided, `controller.attach(this)` is called during construction (before spawn).
|
|
54
|
+
|
|
@@ -15,3 +15,13 @@ despawn(): void;
|
|
|
15
15
|
|
|
16
16
|
void
|
|
17
17
|
|
|
18
|
+
## Remarks
|
|
19
|
+
|
|
20
|
+
\*\*Cascading:\*\* Recursively despawns all child entities first (depth-first).
|
|
21
|
+
|
|
22
|
+
\*\*Controller:\*\* Calls `controller.detach()` then `controller.despawn()` if attached.
|
|
23
|
+
|
|
24
|
+
\*\*Cleanup:\*\* Automatically unregisters attached audios, despawns attached particle emitters, and unloads attached scene UIs from their respective managers.
|
|
25
|
+
|
|
26
|
+
\*\*Simulation:\*\* Removes from physics simulation.
|
|
27
|
+
|
package/docs/server.entity.md
CHANGED
|
@@ -19,6 +19,12 @@ export default class Entity extends RigidBody implements protocol.Serializable
|
|
|
19
19
|
|
|
20
20
|
Entities are highly configurable and controllable. All entities are created from a .gltf model asset and allow full control of their rigid body and attached collider dynamics.
|
|
21
21
|
|
|
22
|
+
<h2>Coordinate System</h2>
|
|
23
|
+
|
|
24
|
+
HYTOPIA uses a right-handed coordinate system where: - \*\*+X\*\* is right - \*\*+Y\*\* is up - \*\*-Z\*\* is forward (identity orientation)
|
|
25
|
+
|
|
26
|
+
Models should be authored with their front/forward facing the \*\*-Z axis\*\*. When an entity has identity rotation (0,0,0,1 quaternion or yaw=0), it faces -Z.
|
|
27
|
+
|
|
22
28
|
<h2>Events</h2>
|
|
23
29
|
|
|
24
30
|
This class is an EventRouter, and instances of it emit events with payloads listed under [EntityEventPayloads](./server.entityeventpayloads.md)
|
|
@@ -77,7 +83,7 @@ Description
|
|
|
77
83
|
|
|
78
84
|
</td><td>
|
|
79
85
|
|
|
80
|
-
|
|
86
|
+
Creates a new Entity instance.
|
|
81
87
|
|
|
82
88
|
|
|
83
89
|
</td></tr>
|
|
@@ -997,7 +1003,7 @@ Starts a oneshot animation for the entity, blending with other animations curren
|
|
|
997
1003
|
|
|
998
1004
|
</td><td>
|
|
999
1005
|
|
|
1000
|
-
Stops all looped and oneshot animations for the entity, optionally
|
|
1006
|
+
Stops all looped and oneshot animations for the entity, optionally excluding the provided animations from stopping.
|
|
1001
1007
|
|
|
1002
1008
|
|
|
1003
1009
|
</td></tr>
|
|
@@ -51,3 +51,9 @@ The scale of the entity's model. Can be a vector or a number for uniform scaling
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Collider scaling is relative:\*\* Colliders are scaled by the ratio of new/old scale, not set to absolute values. Example: scaling from 1 to 2 doubles collider size; scaling from 2 to 4 also doubles it.
|
|
57
|
+
|
|
58
|
+
\*\*Reference equality check:\*\* Uses `===` to compare with current scale, so passing the same object reference will early return even if values changed. Always pass a new object.
|
|
59
|
+
|
|
@@ -83,3 +83,17 @@ _(Optional)_ The optional rotation to spawn the entity with.
|
|
|
83
83
|
|
|
84
84
|
void
|
|
85
85
|
|
|
86
|
+
## Remarks
|
|
87
|
+
|
|
88
|
+
\*\*Rotation default:\*\* If no rotation is provided, entity spawns with identity rotation facing -Z. For Y-axis rotation (yaw): `{ x: 0, y: sin(yaw/2), z: 0, w: cos(yaw/2) }`<!-- -->. Yaw 0 = facing -Z.
|
|
89
|
+
|
|
90
|
+
\*\*Auto-collider creation:\*\* If no colliders are provided, a default collider is auto-generated from the model bounds (or block half extents). Set `modelPreferredShape` to `ColliderShape.NONE` to disable.
|
|
91
|
+
|
|
92
|
+
\*\*Collision groups:\*\* Colliders with default collision groups are auto-assigned based on `isEnvironmental` and `isSensor` flags. Environmental entities don't collide with blocks or other environmental entities.
|
|
93
|
+
|
|
94
|
+
\*\*Event enabling:\*\* Collision/contact force events are auto-enabled on colliders if listeners are registered for `BLOCK_COLLISION`<!-- -->, `ENTITY_COLLISION`<!-- -->, `BLOCK_CONTACT_FORCE`<!-- -->, or `ENTITY_CONTACT_FORCE` prior to spawning.
|
|
95
|
+
|
|
96
|
+
\*\*Controller:\*\* If a controller is attached, `controller.spawn()` is called after the entity is added to the physics simulation.
|
|
97
|
+
|
|
98
|
+
\*\*Parent handling:\*\* If `parent` was set in options, `setParent()` is called after spawn with the provided position/rotation.
|
|
99
|
+
|
|
@@ -53,5 +53,5 @@ void
|
|
|
53
53
|
|
|
54
54
|
## Remarks
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
\*\*Deduplication:\*\* If an animation is already in the looped set, it won't be re-added or restarted. The event only emits if at least one new animation is added.
|
|
57
57
|
|
|
@@ -53,5 +53,7 @@ void
|
|
|
53
53
|
|
|
54
54
|
## Remarks
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
\*\*No deduplication:\*\* Unlike `startModelLoopedAnimations`<!-- -->, this always emits the event even if the animation is already playing. This allows restarting oneshot animations.
|
|
57
|
+
|
|
58
|
+
\*\*Tracking:\*\* Oneshot animations are tracked internally to prevent packet spam from `stopModelAnimations()` but are not serialized for new player joins (they're transient).
|
|
57
59
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Entity.stopAllModelAnimations() method
|
|
6
6
|
|
|
7
|
-
Stops all looped and oneshot animations for the entity, optionally
|
|
7
|
+
Stops all looped and oneshot animations for the entity, optionally excluding the provided animations from stopping.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -51,3 +51,7 @@ _(Optional)_ The animations to exclude from being stopped.
|
|
|
51
51
|
|
|
52
52
|
void
|
|
53
53
|
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
\*\*Delegates to `stopModelAnimations`<!-- -->:\*\* Collects animations from both looped and oneshot sets (minus exclusions), then calls `stopModelAnimations()` once.
|
|
57
|
+
|
|
@@ -51,5 +51,9 @@ The entity to get the children for.
|
|
|
51
51
|
|
|
52
52
|
[Entity](./server.entity.md)<!-- -->\[\]
|
|
53
53
|
|
|
54
|
-
All child entities of the entity.
|
|
54
|
+
All direct child entities of the entity.
|
|
55
|
+
|
|
56
|
+
## Remarks
|
|
57
|
+
|
|
58
|
+
\*\*Direct children only:\*\* Returns only immediate children, not recursive descendants.
|
|
55
59
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## EntityManager.getPlayerEntitiesByPlayer() method
|
|
6
6
|
|
|
7
|
-
Gets all spawned entities in the world assigned to the provided player.
|
|
7
|
+
Gets all spawned player entities in the world assigned to the provided player.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
@@ -51,5 +51,5 @@ The player to get the entities for.
|
|
|
51
51
|
|
|
52
52
|
[PlayerEntity](./server.playerentity.md)<!-- -->\[\]
|
|
53
53
|
|
|
54
|
-
All spawned entities in the world assigned to the player.
|
|
54
|
+
All spawned player entities in the world assigned to the player.
|
|
55
55
|
|
|
@@ -17,6 +17,10 @@ export default class PathfindingEntityController extends SimpleEntityController
|
|
|
17
17
|
|
|
18
18
|
This class implements pathfinding using the A\* algorithm. Pathfinding when frequently called can cause performance issues, use it sparingly. The .pathfind() method should only need to be called once in nearly all cases when attempting to move an entity to a target coordinate.
|
|
19
19
|
|
|
20
|
+
<h2>Coordinate System & Model Orientation</h2>
|
|
21
|
+
|
|
22
|
+
HYTOPIA uses \*\*-Z as forward\*\*. Models must be authored with their front facing -Z. The pathfinding controller automatically calls `face()` to orient the entity's -Z axis toward each waypoint as it moves.
|
|
23
|
+
|
|
20
24
|
## Constructors
|
|
21
25
|
|
|
22
26
|
<table><thead><tr><th>
|
|
@@ -58,7 +58,7 @@ number
|
|
|
58
58
|
|
|
59
59
|
</td><td>
|
|
60
60
|
|
|
61
|
-
The speed of the entity.
|
|
61
|
+
The speed of the entity (blocks per second).
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
</td></tr>
|
|
@@ -83,5 +83,17 @@ _(Optional)_ The pathfinding options.
|
|
|
83
83
|
|
|
84
84
|
boolean
|
|
85
85
|
|
|
86
|
-
Whether
|
|
86
|
+
Whether a path was found.
|
|
87
|
+
|
|
88
|
+
## Remarks
|
|
89
|
+
|
|
90
|
+
\*\*Synchronous return:\*\* Path calculation happens synchronously. Returns `true` if a path was found, `false` if no path exists or calculation was aborted.
|
|
91
|
+
|
|
92
|
+
\*\*Auto-starts movement:\*\* If a path is found, movement begins immediately using the inherited `move()`<!-- -->, `face()`<!-- -->, and `jump()` methods from `SimpleEntityController`<!-- -->.
|
|
93
|
+
|
|
94
|
+
\*\*Auto-facing (-Z forward):\*\* Automatically calls `face()` for each waypoint, orienting the entity's -Z axis toward the next waypoint. Models must be authored with their front facing -Z.
|
|
95
|
+
|
|
96
|
+
\*\*A\* algorithm:\*\* Uses A\* pathfinding with configurable `maxJump`<!-- -->, `maxFall`<!-- -->, and `verticalPenalty`<!-- -->. Path calculation is capped by `maxOpenSetIterations` (default 200) to prevent blocking.
|
|
97
|
+
|
|
98
|
+
\*\*Waypoint progression:\*\* Entity moves through calculated waypoints sequentially. Each waypoint has a timeout (`waypointTimeoutMs`<!-- -->) after which it's skipped if not reached.
|
|
87
99
|
|