hytopia 0.1.69 → 0.1.70

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.
Files changed (113) hide show
  1. package/docs/server.light._constructor_.md +49 -0
  2. package/docs/server.light.angle.md +13 -0
  3. package/docs/server.light.attachedtoentity.md +13 -0
  4. package/docs/server.light.color.md +13 -0
  5. package/docs/server.light.despawn.md +17 -0
  6. package/docs/server.light.distance.md +13 -0
  7. package/docs/server.light.id.md +13 -0
  8. package/docs/server.light.intensity.md +13 -0
  9. package/docs/server.light.isspawned.md +13 -0
  10. package/docs/server.light.md +573 -0
  11. package/docs/server.light.offset.md +13 -0
  12. package/docs/server.light.penumbra.md +13 -0
  13. package/docs/server.light.position.md +13 -0
  14. package/docs/server.light.setangle.md +53 -0
  15. package/docs/server.light.setattachedtoentity.md +53 -0
  16. package/docs/server.light.setcolor.md +53 -0
  17. package/docs/server.light.setdistance.md +53 -0
  18. package/docs/server.light.setintensity.md +53 -0
  19. package/docs/server.light.setoffset.md +53 -0
  20. package/docs/server.light.setpenumbra.md +53 -0
  21. package/docs/server.light.setposition.md +53 -0
  22. package/docs/server.light.settrackedentity.md +53 -0
  23. package/docs/server.light.settrackedposition.md +53 -0
  24. package/docs/server.light.spawn.md +53 -0
  25. package/docs/server.light.trackedentity.md +13 -0
  26. package/docs/server.light.trackedposition.md +13 -0
  27. package/docs/server.light.type.md +13 -0
  28. package/docs/server.light.world.md +13 -0
  29. package/docs/server.lighteventpayload.despawn.light.md +11 -0
  30. package/docs/server.lighteventpayload.despawn.md +53 -0
  31. package/docs/server.lighteventpayload.md +136 -0
  32. package/docs/server.lighteventpayload.setangle.angle.md +11 -0
  33. package/docs/server.lighteventpayload.setangle.light.md +11 -0
  34. package/docs/server.lighteventpayload.setangle.md +70 -0
  35. package/docs/server.lighteventpayload.setattachedtoentity.entity.md +11 -0
  36. package/docs/server.lighteventpayload.setattachedtoentity.light.md +11 -0
  37. package/docs/server.lighteventpayload.setattachedtoentity.md +70 -0
  38. package/docs/server.lighteventpayload.setcolor.color.md +11 -0
  39. package/docs/server.lighteventpayload.setcolor.light.md +11 -0
  40. package/docs/server.lighteventpayload.setcolor.md +70 -0
  41. package/docs/server.lighteventpayload.setdistance.distance.md +11 -0
  42. package/docs/server.lighteventpayload.setdistance.light.md +11 -0
  43. package/docs/server.lighteventpayload.setdistance.md +70 -0
  44. package/docs/server.lighteventpayload.setintensity.intensity.md +11 -0
  45. package/docs/server.lighteventpayload.setintensity.light.md +11 -0
  46. package/docs/server.lighteventpayload.setintensity.md +70 -0
  47. package/docs/server.lighteventpayload.setoffset.light.md +11 -0
  48. package/docs/server.lighteventpayload.setoffset.md +70 -0
  49. package/docs/server.lighteventpayload.setoffset.offset.md +11 -0
  50. package/docs/server.lighteventpayload.setpenumbra.light.md +11 -0
  51. package/docs/server.lighteventpayload.setpenumbra.md +70 -0
  52. package/docs/server.lighteventpayload.setpenumbra.penumbra.md +11 -0
  53. package/docs/server.lighteventpayload.setposition.light.md +11 -0
  54. package/docs/server.lighteventpayload.setposition.md +70 -0
  55. package/docs/server.lighteventpayload.setposition.position.md +11 -0
  56. package/docs/server.lighteventpayload.settrackedentity.entity.md +11 -0
  57. package/docs/server.lighteventpayload.settrackedentity.light.md +11 -0
  58. package/docs/server.lighteventpayload.settrackedentity.md +70 -0
  59. package/docs/server.lighteventpayload.settrackedposition.light.md +11 -0
  60. package/docs/server.lighteventpayload.settrackedposition.md +70 -0
  61. package/docs/server.lighteventpayload.settrackedposition.position.md +11 -0
  62. package/docs/server.lighteventpayload.spawn.light.md +11 -0
  63. package/docs/server.lighteventpayload.spawn.md +53 -0
  64. package/docs/server.lighteventtype.md +215 -0
  65. package/docs/server.lightmanager.getallentityattachedlights.md +55 -0
  66. package/docs/server.lightmanager.getalllights.md +19 -0
  67. package/docs/server.lightmanager.md +113 -0
  68. package/docs/server.lightmanager.world.md +13 -0
  69. package/docs/server.lightoptions.angle.md +13 -0
  70. package/docs/server.lightoptions.attachedtoentity.md +13 -0
  71. package/docs/server.lightoptions.color.md +13 -0
  72. package/docs/server.lightoptions.distance.md +13 -0
  73. package/docs/server.lightoptions.intensity.md +13 -0
  74. package/docs/server.lightoptions.md +247 -0
  75. package/docs/server.lightoptions.offset.md +13 -0
  76. package/docs/server.lightoptions.penumbra.md +13 -0
  77. package/docs/server.lightoptions.position.md +13 -0
  78. package/docs/server.lightoptions.trackedentity.md +13 -0
  79. package/docs/server.lightoptions.trackedposition.md +13 -0
  80. package/docs/server.lightoptions.type.md +13 -0
  81. package/docs/server.lighttype.md +61 -0
  82. package/docs/server.md +66 -0
  83. package/docs/server.sceneui.attachedtoentity.md +2 -0
  84. package/docs/server.sceneui.id.md +2 -0
  85. package/docs/server.sceneui.isloaded.md +2 -0
  86. package/docs/server.sceneui.md +18 -0
  87. package/docs/server.sceneui.offset.md +2 -0
  88. package/docs/server.sceneui.position.md +2 -0
  89. package/docs/server.sceneui.state.md +2 -0
  90. package/docs/server.sceneui.templateid.md +2 -0
  91. package/docs/server.sceneui.viewdistance.md +2 -0
  92. package/docs/server.sceneui.world.md +2 -0
  93. package/docs/server.world.lightmanager.md +13 -0
  94. package/docs/server.world.md +26 -5
  95. package/docs/server.world.setambientlightcolor.md +1 -1
  96. package/docs/server.world.setambientlightintensity.md +1 -1
  97. package/docs/server.world.setdirectionallightcolor.md +1 -1
  98. package/docs/server.world.setdirectionallightintensity.md +1 -1
  99. package/docs/server.world.setdirectionallightposition.md +1 -1
  100. package/docs/server.worldoptions.ambientlightcolor.md +1 -1
  101. package/docs/server.worldoptions.ambientlightintensity.md +1 -1
  102. package/docs/server.worldoptions.directionallightcolor.md +1 -1
  103. package/docs/server.worldoptions.directionallightintensity.md +1 -1
  104. package/docs/server.worldoptions.directionallightposition.md +1 -1
  105. package/docs/server.worldoptions.md +5 -5
  106. package/examples/lighting/README.md +3 -0
  107. package/examples/lighting/assets/map.json +13153 -0
  108. package/examples/lighting/index.ts +120 -0
  109. package/examples/lighting/package.json +16 -0
  110. package/package.json +1 -1
  111. package/server.api.json +2778 -19
  112. package/server.d.ts +299 -11
  113. package/server.js +87 -87
package/server.d.ts CHANGED
@@ -1763,6 +1763,283 @@ export declare enum GameServerEventType {
1763
1763
  STOP = "GAMESERVER.STOP"
1764
1764
  }
1765
1765
 
1766
+ /**
1767
+ * Represents a light in a world. Lights can be point lights
1768
+ * or spotlights.
1769
+ *
1770
+ * @remarks
1771
+ * Lights are created directly as instances. They support a
1772
+ * variety of configuration options through the {@link LightOptions}
1773
+ * constructor argument.
1774
+ *
1775
+ * @example
1776
+ * ```typescript
1777
+ * const light = new Light({
1778
+ * attachedToEntity: playerEntity,
1779
+ * color: { r: 255, g: 0, b: 0 },
1780
+ * intensity: 5,
1781
+ * offset: { x: 0, y: 1, z: 0 },
1782
+ * });
1783
+ *
1784
+ * light.spawn(world);
1785
+ * ```
1786
+ *
1787
+ * @public
1788
+ */
1789
+ export declare class Light implements protocol.Serializable {
1790
+
1791
+
1792
+
1793
+
1794
+
1795
+
1796
+
1797
+
1798
+
1799
+
1800
+
1801
+
1802
+
1803
+ /**
1804
+ * @param options - The options for the Light instance.
1805
+ */
1806
+ constructor(options: LightOptions);
1807
+ /** The unique identifier for the Light. */
1808
+ get id(): number | undefined;
1809
+ /** If type is spotlight, the angle of the spotlight. */
1810
+ get angle(): number | undefined;
1811
+ /** The entity to which the Light is attached if explicitly set. */
1812
+ get attachedToEntity(): Entity | undefined;
1813
+ /** The color of the light. */
1814
+ get color(): RgbColor;
1815
+ /** The maximum distance the light will illuminate. 0 does not limit distance. Defaults to 0. */
1816
+ get distance(): number | undefined;
1817
+ /** The intensity of the light in candela (cd). Defaults to 1 */
1818
+ get intensity(): number;
1819
+ /** Whether the Light is spawned into the world. */
1820
+ get isSpawned(): boolean;
1821
+ /** The offset of the light from the attached entity or position. */
1822
+ get offset(): Vector3Like | undefined;
1823
+ /** If type is spotlight, the penumbra of the spotlight. */
1824
+ get penumbra(): number | undefined;
1825
+ /** The position of the light in the world if explicitly set. */
1826
+ get position(): Vector3Like | undefined;
1827
+ /** If type is spotlight, the entity the spotlight will constantly point at. */
1828
+ get trackedEntity(): Entity | undefined;
1829
+ /** If type is spotlight, the position the spotlight will constantly point at. */
1830
+ get trackedPosition(): Vector3Like | undefined;
1831
+ /** The type of light. Defaults to point light. */
1832
+ get type(): LightType;
1833
+ /** The world the Light is spawned into. */
1834
+ get world(): World | undefined;
1835
+ /**
1836
+ * Sets the angle of the spotlight if the light type is spotlight.
1837
+ *
1838
+ * @param angle - The angle of the spotlight.
1839
+ */
1840
+ setAngle(angle: number): void;
1841
+ /**
1842
+ * Sets the entity to which the Light is attached.
1843
+ *
1844
+ * @param entity - The entity to attach the Light to.
1845
+ */
1846
+ setAttachedToEntity(entity: Entity): void;
1847
+ /**
1848
+ * Sets the color of the light.
1849
+ *
1850
+ * @param color - The color of the light.
1851
+ */
1852
+ setColor(color: RgbColor): void;
1853
+ /**
1854
+ * Sets the maximum distance the light will illuminate.
1855
+ *
1856
+ * @param distance - The maximum distance the light will illuminate.
1857
+ */
1858
+ setDistance(distance: number): void;
1859
+ /**
1860
+ * Sets the intensity of the light.
1861
+ *
1862
+ * @param intensity - The intensity of the light.
1863
+ */
1864
+ setIntensity(intensity: number): void;
1865
+ /**
1866
+ * Sets the offset of the light from the attached entity or position.
1867
+ *
1868
+ * @param offset - The offset of the light.
1869
+ */
1870
+ setOffset(offset: Vector3Like): void;
1871
+ /**
1872
+ * Sets the penumbra of the spotlight if the light type is spotlight.
1873
+ *
1874
+ * @param penumbra - The penumbra of the spotlight.
1875
+ */
1876
+ setPenumbra(penumbra: number): void;
1877
+ /**
1878
+ * Sets the position of the light.
1879
+ *
1880
+ * @param position - The position of the light.
1881
+ */
1882
+ setPosition(position: Vector3Like): void;
1883
+ /**
1884
+ * Sets the entity the spotlight will constantly point at if the light type is spotlight.
1885
+ *
1886
+ * @param entity - The entity the spotlight will constantly point at.
1887
+ */
1888
+ setTrackedEntity(entity: Entity): void;
1889
+ /**
1890
+ * Sets the position the spotlight will constantly point at if the light type is spotlight.
1891
+ *
1892
+ * @param position - The position the spotlight will constantly point at.
1893
+ */
1894
+ setTrackedPosition(position: Vector3Like): void;
1895
+ /**
1896
+ * Despawns the Light from the world.
1897
+ */
1898
+ despawn(): void;
1899
+ /**
1900
+ * Spawns the Light into the world.
1901
+ *
1902
+ * @param world - The world to spawn the Light into.
1903
+ */
1904
+ spawn(world: World): void;
1905
+
1906
+ }
1907
+
1908
+ /** Payloads for events a Light instance can emit. @public */
1909
+ export declare namespace LightEventPayload {
1910
+ export interface Despawn {
1911
+ light: Light;
1912
+ }
1913
+ export interface SetAngle {
1914
+ light: Light;
1915
+ angle: number;
1916
+ }
1917
+ export interface SetAttachedToEntity {
1918
+ light: Light;
1919
+ entity: Entity;
1920
+ }
1921
+ export interface SetColor {
1922
+ light: Light;
1923
+ color: RgbColor;
1924
+ }
1925
+ export interface SetDistance {
1926
+ light: Light;
1927
+ distance: number;
1928
+ }
1929
+ export interface SetIntensity {
1930
+ light: Light;
1931
+ intensity: number;
1932
+ }
1933
+ export interface SetOffset {
1934
+ light: Light;
1935
+ offset: Vector3Like;
1936
+ }
1937
+ export interface SetPenumbra {
1938
+ light: Light;
1939
+ penumbra: number;
1940
+ }
1941
+ export interface SetPosition {
1942
+ light: Light;
1943
+ position: Vector3Like;
1944
+ }
1945
+ export interface SetTrackedEntity {
1946
+ light: Light;
1947
+ entity: Entity;
1948
+ }
1949
+ export interface SetTrackedPosition {
1950
+ light: Light;
1951
+ position: Vector3Like;
1952
+ }
1953
+ export interface Spawn {
1954
+ light: Light;
1955
+ }
1956
+ }
1957
+
1958
+ /** Event types a Light instance can emit. @public */
1959
+ export declare enum LightEventType {
1960
+ DESPAWN = "LIGHT.DESPAWN",
1961
+ SET_ANGLE = "LIGHT.SET_ANGLE",
1962
+ SET_ATTACHED_TO_ENTITY = "LIGHT.SET_ATTACHED_TO_ENTITY",
1963
+ SET_COLOR = "LIGHT.SET_COLOR",
1964
+ SET_DISTANCE = "LIGHT.SET_DISTANCE",
1965
+ SET_INTENSITY = "LIGHT.SET_INTENSITY",
1966
+ SET_OFFSET = "LIGHT.SET_OFFSET",
1967
+ SET_PENUMBRA = "LIGHT.SET_PENUMBRA",
1968
+ SET_POSITION = "LIGHT.SET_POSITION",
1969
+ SET_TRACKED_ENTITY = "LIGHT.SET_TRACKED_ENTITY",
1970
+ SET_TRACKED_POSITION = "LIGHT.SET_TRACKED_POSITION",
1971
+ SET_TYPE = "LIGHT.SET_TYPE",
1972
+ SPAWN = "LIGHT.SPAWN"
1973
+ }
1974
+
1975
+ /**
1976
+ * Manages Light instances in a world.
1977
+ *
1978
+ * @remarks
1979
+ * The LightManager is created internally as a singleton
1980
+ * for each {@link World} instance in a game server.
1981
+ * It allows retrieval of all loaded Light instances,
1982
+ * entity attached Light instances, and more.
1983
+ *
1984
+ * @public
1985
+ */
1986
+ export declare class LightManager {
1987
+
1988
+
1989
+
1990
+
1991
+ /** The world the LightManager is for. */
1992
+ get world(): World;
1993
+
1994
+ /**
1995
+ * Retrieves all spawned Light instances for the world.
1996
+ *
1997
+ * @returns An array of Light instances.
1998
+ */
1999
+ getAllLights(): Light[];
2000
+ /**
2001
+ * Retrieves all spawned Light instances attached to a specific entity.
2002
+ *
2003
+ * @param entity - The entity to get attached Light instances for.
2004
+ * @returns An array of Light instances.
2005
+ */
2006
+ getAllEntityAttachedLights(entity: Entity): Light[];
2007
+
2008
+
2009
+ }
2010
+
2011
+ /** Options for creating a Light instance. @public */
2012
+ export declare interface LightOptions {
2013
+ /** If type is spotlight, the angle of the spotlight. */
2014
+ angle?: number;
2015
+ /** If set, the light will be attached to this entity. */
2016
+ attachedToEntity?: Entity;
2017
+ /** The color of the light. Defaults to white. */
2018
+ color?: RgbColor;
2019
+ /** The maximum distance the light will illuminate. 0 does not limit distance. Defaults to 0. */
2020
+ distance?: number;
2021
+ /** The intensity of the light in candela (cd). Defaults to 1 */
2022
+ intensity?: number;
2023
+ /** The offset of the light from the attached entity or position. */
2024
+ offset?: Vector3Like;
2025
+ /** If type is spotlight, the penumbra of the spotlight. Defaults to 0 */
2026
+ penumbra?: number;
2027
+ /** If set, the light will be attached at this position. */
2028
+ position?: Vector3Like;
2029
+ /** If type is spotlight, the entity the spotlight will constantly point at. */
2030
+ trackedEntity?: Entity;
2031
+ /** If type is spotlight, the position the spotlight will constantly point at. */
2032
+ trackedPosition?: Vector3Like;
2033
+ /** The type of light. Defaults to point light. */
2034
+ type?: LightType;
2035
+ }
2036
+
2037
+ /** The types a Light can be. @public */
2038
+ export declare enum LightType {
2039
+ POINTLIGHT = 0,
2040
+ SPOTLIGHT = 1
2041
+ }
2042
+
1766
2043
  /** A bounding box for a model. @public */
1767
2044
  declare type ModelBoundingBox = {
1768
2045
  min: {
@@ -3039,14 +3316,23 @@ export declare class SceneUI implements protocol.Serializable {
3039
3316
  * @param options - The options for the SceneUI instance.
3040
3317
  */
3041
3318
  constructor(options: SceneUIOptions);
3319
+ /** The unique identifier for the SceneUI. */
3042
3320
  get id(): number | undefined;
3321
+ /** The entity to which the SceneUI is attached if explicitly set. */
3043
3322
  get attachedToEntity(): Entity | undefined;
3323
+ /** Whether the SceneUI is loaded into the world. */
3044
3324
  get isLoaded(): boolean;
3325
+ /** The offset of the SceneUI from the attached entity or position. */
3045
3326
  get offset(): Vector3Like | undefined;
3327
+ /** The position of the SceneUI in the world if explicitly set. */
3046
3328
  get position(): Vector3Like | undefined;
3329
+ /** The state of the SceneUI. */
3047
3330
  get state(): Readonly<object>;
3331
+ /** The template ID of the SceneUI. */
3048
3332
  get templateId(): string;
3333
+ /** The maximum view distance the SceneUI will be visible to the player. */
3049
3334
  get viewDistance(): number | undefined;
3335
+ /** The world the SceneUI is loaded into. */
3050
3336
  get world(): World | undefined;
3051
3337
  /**
3052
3338
  * Loads the SceneUI into the world.
@@ -3130,7 +3416,6 @@ export declare class SceneUIManager {
3130
3416
  */
3131
3417
  unloadEntityAttachedSceneUIs(entity: Entity): void;
3132
3418
 
3133
-
3134
3419
  }
3135
3420
 
3136
3421
  /** Options for creating a SceneUI instance. @public */
@@ -3595,6 +3880,7 @@ export declare class World implements protocol.Serializable {
3595
3880
 
3596
3881
 
3597
3882
 
3883
+
3598
3884
  /**
3599
3885
  * @param options - The options for the world.
3600
3886
  */
@@ -3627,6 +3913,8 @@ export declare class World implements protocol.Serializable {
3627
3913
  get entityManager(): EntityManager;
3628
3914
  /** The event router for the world. */
3629
3915
  get eventRouter(): EventRouter;
3916
+ /** The light manager for the world. */
3917
+ get lightManager(): LightManager;
3630
3918
  /** The world loop for the world. */
3631
3919
  get loop(): WorldLoop;
3632
3920
 
@@ -3640,27 +3928,27 @@ export declare class World implements protocol.Serializable {
3640
3928
  */
3641
3929
  loadMap(map: WorldMap): void;
3642
3930
  /**
3643
- * Sets the color of the ambient light.
3931
+ * Sets the color of the world's ambient light.
3644
3932
  * @param color - The color of the light.
3645
3933
  */
3646
3934
  setAmbientLightColor(color: RgbColor): void;
3647
3935
  /**
3648
- * Sets the intensity of the ambient light.
3936
+ * Sets the intensity of the world's ambient light.
3649
3937
  * @param intensity - The intensity.
3650
3938
  */
3651
3939
  setAmbientLightIntensity(intensity: number): void;
3652
3940
  /**
3653
- * Sets the color of the directional light.
3941
+ * Sets the color of the world's directional light.
3654
3942
  * @param color - The color of the light.
3655
3943
  */
3656
3944
  setDirectionalLightColor(color: RgbColor): void;
3657
3945
  /**
3658
- * Sets the intensity of the directional light.
3946
+ * Sets the intensity of the world's directional light.
3659
3947
  * @param intensity - The intensity.
3660
3948
  */
3661
3949
  setDirectionalLightIntensity(intensity: number): void;
3662
3950
  /**
3663
- * Sets the position the directional light originates from.
3951
+ * Sets the position the world's directional light originates from.
3664
3952
  * @param position - The position in the world.
3665
3953
  */
3666
3954
  setDirectionalLightPosition(position: Vector3Like): void;
@@ -3761,15 +4049,15 @@ export declare interface WorldMap {
3761
4049
  export declare interface WorldOptions {
3762
4050
  /** The unique ID of the world. */
3763
4051
  id: number;
3764
- /** The color of the ambient light. */
4052
+ /** The color of the ambient light for the world. */
3765
4053
  ambientLightColor?: RgbColor;
3766
- /** The intensity of the ambient light. 0 to 1+ */
4054
+ /** The intensity of the ambient light for the world. 0 to 1+ */
3767
4055
  ambientLightIntensity?: number;
3768
- /** The color of the directional light. */
4056
+ /** The color of the directional light for the world. */
3769
4057
  directionalLightColor?: RgbColor;
3770
- /** The intensity of the directional light. 0 to 1+ */
4058
+ /** The intensity of the directional light for the world. 0 to 1+ */
3771
4059
  directionalLightIntensity?: number;
3772
- /** The position the directional light originates from. */
4060
+ /** The position the directional light originates from for the world. */
3773
4061
  directionalLightPosition?: Vector3Like;
3774
4062
  /** The name of the world. */
3775
4063
  name: string;