hytopia 0.1.68 → 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 (118) 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.ambientlightcolor.md +13 -0
  94. package/docs/server.world.ambientlightintensity.md +13 -0
  95. package/docs/server.world.directionallightcolor.md +13 -0
  96. package/docs/server.world.directionallightintensity.md +13 -0
  97. package/docs/server.world.directionallightposition.md +13 -0
  98. package/docs/server.world.lightmanager.md +13 -0
  99. package/docs/server.world.md +196 -0
  100. package/docs/server.world.setambientlightcolor.md +53 -0
  101. package/docs/server.world.setambientlightintensity.md +53 -0
  102. package/docs/server.world.setdirectionallightcolor.md +53 -0
  103. package/docs/server.world.setdirectionallightintensity.md +53 -0
  104. package/docs/server.world.setdirectionallightposition.md +53 -0
  105. package/docs/server.worldoptions.ambientlightcolor.md +13 -0
  106. package/docs/server.worldoptions.ambientlightintensity.md +13 -0
  107. package/docs/server.worldoptions.directionallightcolor.md +13 -0
  108. package/docs/server.worldoptions.directionallightintensity.md +13 -0
  109. package/docs/server.worldoptions.directionallightposition.md +13 -0
  110. package/docs/server.worldoptions.md +95 -0
  111. package/examples/lighting/README.md +3 -0
  112. package/examples/lighting/assets/map.json +13153 -0
  113. package/examples/lighting/index.ts +120 -0
  114. package/examples/lighting/package.json +16 -0
  115. package/package.json +1 -1
  116. package/server.api.json +3382 -89
  117. package/server.d.ts +339 -1
  118. package/server.js +84 -84
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 */
@@ -3590,12 +3875,28 @@ export declare class World implements protocol.Serializable {
3590
3875
 
3591
3876
 
3592
3877
 
3878
+
3879
+
3880
+
3881
+
3882
+
3883
+
3593
3884
  /**
3594
3885
  * @param options - The options for the world.
3595
3886
  */
3596
3887
  constructor(options: WorldOptions);
3597
3888
  /** The unique ID of the world. */
3598
3889
  get id(): number;
3890
+ /** The color of the ambient light. */
3891
+ get ambientLightColor(): RgbColor;
3892
+ /** The intensity of the ambient light. */
3893
+ get ambientLightIntensity(): number;
3894
+ /** The color of the directional light. */
3895
+ get directionalLightColor(): RgbColor;
3896
+ /** The intensity of the directional light. */
3897
+ get directionalLightIntensity(): number;
3898
+ /** The position the directional light originates from. */
3899
+ get directionalLightPosition(): Vector3Like;
3599
3900
  /** The name of the world. */
3600
3901
  get name(): string;
3601
3902
  /** The URI of the skybox cubemap for the world. */
@@ -3612,6 +3913,8 @@ export declare class World implements protocol.Serializable {
3612
3913
  get entityManager(): EntityManager;
3613
3914
  /** The event router for the world. */
3614
3915
  get eventRouter(): EventRouter;
3916
+ /** The light manager for the world. */
3917
+ get lightManager(): LightManager;
3615
3918
  /** The world loop for the world. */
3616
3919
  get loop(): WorldLoop;
3617
3920
 
@@ -3624,6 +3927,31 @@ export declare class World implements protocol.Serializable {
3624
3927
  * @param map - The map to load.
3625
3928
  */
3626
3929
  loadMap(map: WorldMap): void;
3930
+ /**
3931
+ * Sets the color of the world's ambient light.
3932
+ * @param color - The color of the light.
3933
+ */
3934
+ setAmbientLightColor(color: RgbColor): void;
3935
+ /**
3936
+ * Sets the intensity of the world's ambient light.
3937
+ * @param intensity - The intensity.
3938
+ */
3939
+ setAmbientLightIntensity(intensity: number): void;
3940
+ /**
3941
+ * Sets the color of the world's directional light.
3942
+ * @param color - The color of the light.
3943
+ */
3944
+ setDirectionalLightColor(color: RgbColor): void;
3945
+ /**
3946
+ * Sets the intensity of the world's directional light.
3947
+ * @param intensity - The intensity.
3948
+ */
3949
+ setDirectionalLightIntensity(intensity: number): void;
3950
+ /**
3951
+ * Sets the position the world's directional light originates from.
3952
+ * @param position - The position in the world.
3953
+ */
3954
+ setDirectionalLightPosition(position: Vector3Like): void;
3627
3955
  /**
3628
3956
  * Starts the world loop, which begins ticking physics, entities, etc.
3629
3957
  */
@@ -3721,6 +4049,16 @@ export declare interface WorldMap {
3721
4049
  export declare interface WorldOptions {
3722
4050
  /** The unique ID of the world. */
3723
4051
  id: number;
4052
+ /** The color of the ambient light for the world. */
4053
+ ambientLightColor?: RgbColor;
4054
+ /** The intensity of the ambient light for the world. 0 to 1+ */
4055
+ ambientLightIntensity?: number;
4056
+ /** The color of the directional light for the world. */
4057
+ directionalLightColor?: RgbColor;
4058
+ /** The intensity of the directional light for the world. 0 to 1+ */
4059
+ directionalLightIntensity?: number;
4060
+ /** The position the directional light originates from for the world. */
4061
+ directionalLightPosition?: Vector3Like;
3724
4062
  /** The name of the world. */
3725
4063
  name: string;
3726
4064
  /** The URI of the skybox cubemap for the world. */