@kingdomsconnected/types 1.5.6 → 1.6.0
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/generated/client-api.d.ts +533 -12
- package/generated/server-api.d.ts +572 -76
- package/package.json +1 -1
- package/shared.d.ts +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Color, EventHandler, KeyHandler, MessageHandler, MessageReply, NativeClipHandler, NativeElementHandler, NativeScreenHandler, PlacementHandler, Quaternion, Unsubscribe, Vector2, Vector3, WebEventHandler } from "../shared.js";
|
|
1
|
+
import type { ActionHintHandler, Color, EventHandler, KeyHandler, MessageHandler, MessageReply, NativeClipHandler, NativeElementHandler, NativeScreenHandler, PlacementHandler, Quaternion, Unsubscribe, Vector2, Vector3, WebEventHandler } from "../shared.js";
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
/**
|
|
@@ -80,7 +80,7 @@ declare global {
|
|
|
80
80
|
/**
|
|
81
81
|
* Dispatched when the flight starts and when it ends, on this machine only. Handler promises are not awaited.
|
|
82
82
|
*
|
|
83
|
-
* `reason` is `script` on the way in. On the way out it is `script` for a resource ending it, `mapEditor` for
|
|
83
|
+
* `reason` is `script` on the way in. On the way out it is `script` for a resource ending it, `mapEditor` for the map editor taking the one camera, `viewLost` for the level going away underneath the camera's anchor, and `sessionOver` for the session ending.
|
|
84
84
|
*/
|
|
85
85
|
noclipChanged: [active: boolean, reason: "script" | "mapEditor" | "viewLost" | "sessionOver"];
|
|
86
86
|
|
|
@@ -94,6 +94,11 @@ declare global {
|
|
|
94
94
|
*/
|
|
95
95
|
bookClosed: [bookId: number, reason: "player" | "script" | "failed" | "sessionOver"];
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Dispatched once for every creator, on this machine only, whatever ended it. `appearance` is the look the player accepted, and null for every other ending. `reason` is `accepted`, `cancelled` for the player backing out, `closed` for `CharacterCreator.close`, `replaced` for another `CharacterCreator.open`, `unavailable` when the stage could not be put up, and `interrupted` when the session or the body went away under it. Nothing is put on the body: send the look wherever it should go -- `Events.emitServer`, then `player.setAppearance` on the server -- or open the next creator straight from the handler.
|
|
99
|
+
*/
|
|
100
|
+
characterCreatorClosed: [appearance: Appearance | null, reason: "accepted" | "cancelled" | "closed" | "replaced" | "unavailable" | "interrupted"];
|
|
101
|
+
|
|
97
102
|
/**
|
|
98
103
|
* Dispatched after a resource entry point has run and immediately before the resource becomes running.
|
|
99
104
|
*/
|
|
@@ -1172,6 +1177,15 @@ declare global {
|
|
|
1172
1177
|
*/
|
|
1173
1178
|
playOnEntity(trigger: string, entityId: number): boolean;
|
|
1174
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* Plays a sound file on an entity, positioned and attenuated like the game's own spoken lines and under the same volume settings. A file streamed by the server plays exactly like one the game ships. An entity takes one file per 0.1 seconds.
|
|
1182
|
+
* @param file Game-root path of an `.ogg`, with or without the extension -- `sounds/kcdc/<resource>/line` for one a server streams.
|
|
1183
|
+
* @param entityId Engine entity to play it on -- what `Player.entityId` reports.
|
|
1184
|
+
* @param purpose Which of the game's voice host events carries it: `inner`, `10`, `20`, `35`, `50`, `100`, `200` (a bark heard up to that many metres), `sfp_dialog`, `sfp_cutscene` or `sfp_music`. Defaults to `50`.
|
|
1185
|
+
* @returns True when the entity was there and took it.
|
|
1186
|
+
*/
|
|
1187
|
+
playFile(file: string, entityId: number, purpose?: string): boolean;
|
|
1188
|
+
|
|
1175
1189
|
/**
|
|
1176
1190
|
* Stops every instance of one trigger on the entity. Triggers that have already finished are not an error.
|
|
1177
1191
|
* @param trigger Name of the trigger to stop.
|
|
@@ -1213,6 +1227,18 @@ declare global {
|
|
|
1213
1227
|
hasTrigger(trigger: string): boolean;
|
|
1214
1228
|
};
|
|
1215
1229
|
|
|
1230
|
+
/**
|
|
1231
|
+
* What the server streams, seen from this machine. Models, materials, textures, sounds and particle libraries a server streams load by path like the game's own -- `objects/kcdc/<resource>/chair.cgf` works wherever a model path does -- so nothing here is needed to use them. Clips play through the server's `playClip`.
|
|
1232
|
+
*/
|
|
1233
|
+
const Assets: {
|
|
1234
|
+
/**
|
|
1235
|
+
* Whether the session's streamed assets carry a file at this path. Only new assets count; a replaced stock file is the game's own path.
|
|
1236
|
+
* @param path Path inside the game's data, as a server streams it -- `objects/kcdc/<resource>/chair.cgf`.
|
|
1237
|
+
* @returns True when a mounted stream-lane pak carries it.
|
|
1238
|
+
*/
|
|
1239
|
+
has(path: string): boolean;
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1216
1242
|
/**
|
|
1217
1243
|
* The game's own particle effects, played on this machine. An effect is a name out of the game's particle libraries -- `WH_Particels.fires.candle`, `collisions.combat.sword_sword`, `cinematics.dust.dust_army_a` -- and `list` is the whole vocabulary. Nothing here is replicated: an effect everyone should see is one the server tells every client to play with `Vfx.burst`, or one the server places with `Vfx.spawn`, which the interest grid then streams to whoever is near it. Almost every effect the game ships is continuous, which means it never ends on its own -- so everything started here is given a duration, and one that is not stopped first is stopped when the session ends.
|
|
1218
1244
|
*/
|
|
@@ -1414,15 +1440,35 @@ declare global {
|
|
|
1414
1440
|
distance: number;
|
|
1415
1441
|
|
|
1416
1442
|
/**
|
|
1417
|
-
* The surface type's own name, spelled the way the game's tables spell it -- `mat_wood`, `
|
|
1443
|
+
* The surface type's own name, spelled the way the game's tables spell it in `Libs/MaterialEffects/SurfaceTypes.xml` -- `mat_wood`, `mat_rock`, `mat_soil`, `mat_water`. It says what the thing is made of, which is how footsteps and blows sound, not what it is: a plank wall is `mat_wood` as much as a trunk is, so tell a tree by `category`. Among the 74 the game defines: `mat_wood`, `mat_wood_soft`, `mat_vegetation`, `mat_bushes`, `mat_rock`, `mat_rock_unwalk`, `mat_rock_horse_ignore`, `mat_stairs_stone`, `mat_gravel`, `mat_soil`, `mat_mud`, `mat_grass`, `mat_road`, `mat_metal`, `mat_glass`, `mat_plaster`, `mat_thatch`, `mat_fabric`, `mat_flesh`. Empty only before the material tables are up.
|
|
1418
1444
|
*/
|
|
1419
1445
|
surface: string;
|
|
1420
1446
|
|
|
1421
1447
|
/**
|
|
1422
|
-
* Whether the ground itself was hit rather than anything placed on it. Nothing lies behind the terrain, so a trace stops there.
|
|
1448
|
+
* Whether the ground itself was hit rather than anything placed on it. Nothing lies behind the terrain, so a trace stops there. The same as `kind` being `terrain`.
|
|
1423
1449
|
*/
|
|
1424
1450
|
terrain: boolean;
|
|
1425
1451
|
|
|
1452
|
+
/**
|
|
1453
|
+
* What sort of thing the ray stopped on. `entity` is anything with an `entityClass` -- doors, props, NPCs, players. `vegetation` is an instance the level paints on: trees, bushes, plants, and boulders painted the same way. `brush` is a static mesh placed one by one: walls, houses, rocks and cliffs. `static` is static geometry that is neither, or whose source the engine does not record. Trees and rocks are not entities, so for them this, `model` and `category` are what say what was hit.
|
|
1454
|
+
*/
|
|
1455
|
+
kind: "terrain" | "entity" | "vegetation" | "brush" | "static";
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* The mesh of a vegetation instance or a brush, as the path the game loads it from -- `objects/natural/vegetation/trees/normal_trees/quercus_robur/quercus_robur_big_a.cgf`. Null for terrain, entities and `static`. A tree or a rock has no GUID, but its `model` and `position` together are the same on every client on the same level, which is what a server keeps a felled tree or a mined rock by.
|
|
1459
|
+
*/
|
|
1460
|
+
model: string | null;
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* Which of the game's own folders of natural objects `model` comes from: `tree` for `objects/natural/vegetation/trees` -- living, dead, fallen and stumps alike, which `model` tells apart -- `bush` for its bushes, `plant` for the rest of its vegetation (grass, ferns, mushrooms, branches), and `rock` for `objects/natural/rocks` and `objects/natural/stones`. Null for anything else, man-made included.
|
|
1464
|
+
*/
|
|
1465
|
+
category: "tree" | "bush" | "plant" | "rock" | null;
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* The material drawn where the ray met it, as the path the material manager keys it by, the sub-material when the mesh has several -- a trunk's bark rather than the tree's whole material. Null for terrain and when nothing names one.
|
|
1469
|
+
*/
|
|
1470
|
+
material: string | null;
|
|
1471
|
+
|
|
1426
1472
|
/**
|
|
1427
1473
|
* The level's own identity for what was hit, as sixteen lowercase hex digits -- the same on every machine, and what `Door.find` and the other GUID lookups take. Null for terrain, for static geometry and for anything the session spawned, none of which the level names.
|
|
1428
1474
|
*/
|
|
@@ -1714,7 +1760,7 @@ declare global {
|
|
|
1714
1760
|
*
|
|
1715
1761
|
* Client-only, and nothing here is an order another machine takes. It is not invisible to the session either: in `body` mode the thing being flown is the entity this client replicates, so the other players watch the flier go. In `camera` mode the body never moves.
|
|
1716
1762
|
*
|
|
1717
|
-
* The game's controls are held for as long as the flight lasts, whichever side is driving.
|
|
1763
|
+
* The game's controls are held for as long as the flight lasts, whichever side is driving. The map editor (`MapEditor`) flies the same one camera: a flight in progress ends when the editor opens, and `enable` refuses while it is open.
|
|
1718
1764
|
*/
|
|
1719
1765
|
const NoClip: {
|
|
1720
1766
|
/**
|
|
@@ -1724,7 +1770,7 @@ declare global {
|
|
|
1724
1770
|
* `input` is whether this machine's keyboard and mouse fly the camera -- on the keys the game's own photo mode is bound to in the controls menu (forward, back, left, right, jump to rise, crouch to sink, fast movement to boost), read through the active keyboard layout so AZERTY and the like work as the game does; Alt to crawl, mouse to turn. On by default; off, drive it with `move`.
|
|
1725
1771
|
*
|
|
1726
1772
|
* `speed` is metres a second at rest, 0.05 to 400 and 12 by default. `fov` is the vertical field of view in degrees, up to 140; omitted, the view keeps the game's.
|
|
1727
|
-
* @returns `enabled` when the flight started. `alreadyActive` when one was already running -- the options are not re-applied. `noCamera` when there is no level to spawn the camera's anchor into. `cameraBusy` when
|
|
1773
|
+
* @returns `enabled` when the flight started. `alreadyActive` when one was already running -- the options are not re-applied. `noCamera` when there is no level to spawn the camera's anchor into. `cameraBusy` when the map editor holds the camera.
|
|
1728
1774
|
*/
|
|
1729
1775
|
enable(options?: { mode?: "body" | "camera"; input?: boolean; speed?: number; fov?: number }): "enabled" | "alreadyActive" | "noCamera" | "cameraBusy";
|
|
1730
1776
|
|
|
@@ -1960,6 +2006,333 @@ declare global {
|
|
|
1960
2006
|
isThirdPerson(): boolean;
|
|
1961
2007
|
};
|
|
1962
2008
|
|
|
2009
|
+
/**
|
|
2010
|
+
* A position or offset in metres. Accepts plain objects and Vector3 instances.
|
|
2011
|
+
*/
|
|
2012
|
+
interface GizmoPoint {
|
|
2013
|
+
/**
|
|
2014
|
+
* X coordinate.
|
|
2015
|
+
*/
|
|
2016
|
+
x: number;
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* Y coordinate.
|
|
2020
|
+
*/
|
|
2021
|
+
y: number;
|
|
2022
|
+
|
|
2023
|
+
/**
|
|
2024
|
+
* Z coordinate.
|
|
2025
|
+
*/
|
|
2026
|
+
z: number;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/**
|
|
2030
|
+
* Appearance and lifetime of a client debug drawing.
|
|
2031
|
+
*/
|
|
2032
|
+
interface GizmoStyle {
|
|
2033
|
+
/**
|
|
2034
|
+
* Unsigned 0xAARRGGBB color. Defaults to 0xFF6EE678 (opaque green).
|
|
2035
|
+
*/
|
|
2036
|
+
color?: number | undefined;
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
* Line width in pixels, 0.5 to 8. Defaults to 1.5; polygon vertical edges use 60% of this width.
|
|
2040
|
+
*/
|
|
2041
|
+
width?: number | undefined;
|
|
2042
|
+
|
|
2043
|
+
/**
|
|
2044
|
+
* Defaults to true: scene geometry occludes the drawing. Set false to show through walls. Drawings never write scene depth.
|
|
2045
|
+
*/
|
|
2046
|
+
depthTest?: boolean | undefined;
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* Unsigned 0xAARRGGBB fill color. Defaults to transparent (outline only). Supports boxes, spheres, circles, cones, cylinders, capsules, arrow heads and meshes. Throws for lines, polylines, grids, axes and polygon areas, which have no faces; fill a polygon with explicit mesh triangles.
|
|
2050
|
+
*/
|
|
2051
|
+
fillColor?: number | undefined;
|
|
2052
|
+
|
|
2053
|
+
/**
|
|
2054
|
+
* Integer lifetime from 0 to 3600000 milliseconds. Zero (default) persists until removed. Replacing the drawing restarts its lifetime.
|
|
2055
|
+
*/
|
|
2056
|
+
durationMs?: number | undefined;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* Geometry from an Area.toJSON() or World Builder area export. Extra fields are ignored; this draws debug geometry and creates no trigger.
|
|
2061
|
+
*/
|
|
2062
|
+
interface GizmoArea {
|
|
2063
|
+
/**
|
|
2064
|
+
* Which area geometry to draw.
|
|
2065
|
+
*/
|
|
2066
|
+
type: 'box' | 'sphere' | 'shape';
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* World origin in metres; defaults to zero.
|
|
2070
|
+
*/
|
|
2071
|
+
position?: GizmoPoint | undefined;
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* Local-to-world quaternion, normalized on input; defaults to identity. Plain {x,y,z,w} objects work.
|
|
2075
|
+
*/
|
|
2076
|
+
rotation?: { x: number; y: number; z: number; w: number } | undefined;
|
|
2077
|
+
|
|
2078
|
+
/**
|
|
2079
|
+
* Box minimum in local space; defaults to {-1,-1,-1}. Each component must be less than max.
|
|
2080
|
+
*/
|
|
2081
|
+
min?: GizmoPoint | undefined;
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* Box maximum in local space; defaults to {1,1,1}.
|
|
2085
|
+
*/
|
|
2086
|
+
max?: GizmoPoint | undefined;
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Required for spheres: radius in metres, greater than zero and less than 16384.
|
|
2090
|
+
*/
|
|
2091
|
+
radius?: number | undefined;
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* Required for shapes: 3 to 256 local points, forming a closed polygon.
|
|
2095
|
+
*/
|
|
2096
|
+
points?: GizmoPoint[] | undefined;
|
|
2097
|
+
|
|
2098
|
+
/**
|
|
2099
|
+
* Shape height above its lowest transformed point, 0 to less than 16384 metres. Zero (default) draws one ring at the points' own heights.
|
|
2100
|
+
*/
|
|
2101
|
+
height?: number | undefined;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* Client debug line geometry.
|
|
2106
|
+
*/
|
|
2107
|
+
interface GizmoLine {
|
|
2108
|
+
/**
|
|
2109
|
+
* Primitive kind.
|
|
2110
|
+
*/
|
|
2111
|
+
type: 'line';
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* World start.
|
|
2115
|
+
*/
|
|
2116
|
+
from: GizmoPoint;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* World end.
|
|
2120
|
+
*/
|
|
2121
|
+
to: GizmoPoint;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* Client debug arrow geometry.
|
|
2126
|
+
*/
|
|
2127
|
+
interface GizmoArrow {
|
|
2128
|
+
/**
|
|
2129
|
+
* Primitive kind.
|
|
2130
|
+
*/
|
|
2131
|
+
type: 'arrow';
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* World start.
|
|
2135
|
+
*/
|
|
2136
|
+
from: GizmoPoint;
|
|
2137
|
+
|
|
2138
|
+
/**
|
|
2139
|
+
* World tip.
|
|
2140
|
+
*/
|
|
2141
|
+
to: GizmoPoint;
|
|
2142
|
+
|
|
2143
|
+
/**
|
|
2144
|
+
* Head length in metres, greater than zero and no longer than the arrow. Defaults to the smaller of 0.5 and a quarter of the arrow length.
|
|
2145
|
+
*/
|
|
2146
|
+
headLength?: number | undefined;
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
/**
|
|
2150
|
+
* Client debug capsule/cone/cylinder geometry.
|
|
2151
|
+
*/
|
|
2152
|
+
interface GizmoRoundVolume {
|
|
2153
|
+
/**
|
|
2154
|
+
* Primitive kind.
|
|
2155
|
+
*/
|
|
2156
|
+
type: 'capsule' | 'cone' | 'cylinder';
|
|
2157
|
+
|
|
2158
|
+
/**
|
|
2159
|
+
* Capsule lower hemisphere center, or cone/cylinder base center.
|
|
2160
|
+
*/
|
|
2161
|
+
from: GizmoPoint;
|
|
2162
|
+
|
|
2163
|
+
/**
|
|
2164
|
+
* Capsule upper hemisphere center, cone tip or cylinder top center. Capsule endpoints may coincide for a sphere.
|
|
2165
|
+
*/
|
|
2166
|
+
to: GizmoPoint;
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Radius in metres, 0.001 to 16384.
|
|
2170
|
+
*/
|
|
2171
|
+
radius: number;
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* Integer radial segments, 8 to 64; default 24.
|
|
2175
|
+
*/
|
|
2176
|
+
segments?: number | undefined;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* Client debug circle geometry.
|
|
2181
|
+
*/
|
|
2182
|
+
interface GizmoCircle {
|
|
2183
|
+
/**
|
|
2184
|
+
* Primitive kind.
|
|
2185
|
+
*/
|
|
2186
|
+
type: 'circle';
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* World center.
|
|
2190
|
+
*/
|
|
2191
|
+
position: GizmoPoint;
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* Non-zero plane normal; default {x:0,y:0,z:1}.
|
|
2195
|
+
*/
|
|
2196
|
+
normal?: GizmoPoint | undefined;
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* Radius in metres, 0.001 to 16384.
|
|
2200
|
+
*/
|
|
2201
|
+
radius: number;
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* Integer radial segments, 8 to 64; default 24.
|
|
2205
|
+
*/
|
|
2206
|
+
segments?: number | undefined;
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
/**
|
|
2210
|
+
* Client debug grid geometry.
|
|
2211
|
+
*/
|
|
2212
|
+
interface GizmoGrid {
|
|
2213
|
+
/**
|
|
2214
|
+
* Primitive kind.
|
|
2215
|
+
*/
|
|
2216
|
+
type: 'grid';
|
|
2217
|
+
|
|
2218
|
+
/**
|
|
2219
|
+
* World center.
|
|
2220
|
+
*/
|
|
2221
|
+
position: GizmoPoint;
|
|
2222
|
+
|
|
2223
|
+
/**
|
|
2224
|
+
* Non-zero plane normal; default {x:0,y:0,z:1}.
|
|
2225
|
+
*/
|
|
2226
|
+
normal?: GizmoPoint | undefined;
|
|
2227
|
+
|
|
2228
|
+
/**
|
|
2229
|
+
* Square side length in metres, 0.001 to 16384; default 10.
|
|
2230
|
+
*/
|
|
2231
|
+
size?: number | undefined;
|
|
2232
|
+
|
|
2233
|
+
/**
|
|
2234
|
+
* Integer subdivisions on each side, 1 to 64; default 10.
|
|
2235
|
+
*/
|
|
2236
|
+
divisions?: number | undefined;
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
/**
|
|
2240
|
+
* Client debug axes geometry.
|
|
2241
|
+
*/
|
|
2242
|
+
interface GizmoAxes {
|
|
2243
|
+
/**
|
|
2244
|
+
* Primitive kind.
|
|
2245
|
+
*/
|
|
2246
|
+
type: 'axes';
|
|
2247
|
+
|
|
2248
|
+
/**
|
|
2249
|
+
* World origin.
|
|
2250
|
+
*/
|
|
2251
|
+
position: GizmoPoint;
|
|
2252
|
+
|
|
2253
|
+
/**
|
|
2254
|
+
* Local-to-world quaternion, normalized on input; default identity.
|
|
2255
|
+
*/
|
|
2256
|
+
rotation?: { x: number; y: number; z: number; w: number } | undefined;
|
|
2257
|
+
|
|
2258
|
+
/**
|
|
2259
|
+
* Axis length in metres, 0.001 to 16384; default 1. X is red, Y green and Z blue; these fixed colors override style.color.
|
|
2260
|
+
*/
|
|
2261
|
+
size?: number | undefined;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Client debug polyline geometry.
|
|
2266
|
+
*/
|
|
2267
|
+
interface GizmoPolyline {
|
|
2268
|
+
/**
|
|
2269
|
+
* Primitive kind.
|
|
2270
|
+
*/
|
|
2271
|
+
type: 'polyline';
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* 2 to 256 world positions.
|
|
2275
|
+
*/
|
|
2276
|
+
points: GizmoPoint[];
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* Join last to first; default false.
|
|
2280
|
+
*/
|
|
2281
|
+
closed?: boolean | undefined;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* Client debug mesh geometry.
|
|
2286
|
+
*/
|
|
2287
|
+
interface GizmoMesh {
|
|
2288
|
+
/**
|
|
2289
|
+
* Primitive kind.
|
|
2290
|
+
*/
|
|
2291
|
+
type: 'mesh';
|
|
2292
|
+
|
|
2293
|
+
/**
|
|
2294
|
+
* 3 to 1024 world positions.
|
|
2295
|
+
*/
|
|
2296
|
+
points: GizmoPoint[];
|
|
2297
|
+
|
|
2298
|
+
/**
|
|
2299
|
+
* 3 to 3072 integer vertex indices in triangle triples, each from 0 to points.length - 1. Both triangle sides render.
|
|
2300
|
+
*/
|
|
2301
|
+
indices: number[];
|
|
2302
|
+
|
|
2303
|
+
/**
|
|
2304
|
+
* Draw triangle edges with style.color and width; default true. Set fillColor to draw faces.
|
|
2305
|
+
*/
|
|
2306
|
+
wireframe?: boolean | undefined;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* Resource-owned native debug geometry visible only on this client, without opening World Builder. Scene depth testing is on by default; depthTest: false opts out. Stop/error, disconnect and moving to another level clear drawings; reloading a save of the same level keeps them. No replication or input capture.
|
|
2311
|
+
*/
|
|
2312
|
+
const Gizmos: {
|
|
2313
|
+
/**
|
|
2314
|
+
* Creates or replaces a named primitive owned by this resource. Finite input coordinates within +/-16384 metres. IDs are 1 to 128 UTF-8 bytes. Limit: 128 IDs per resource, 16384 geometry units across resources (one per line, three per triangle). Throws on invalid input or budget overflow and preserves the previous drawing. Copies geometry and reapplies style defaults; use setTransform to move it.
|
|
2315
|
+
*/
|
|
2316
|
+
set(id: string, primitive: GizmoArea | GizmoLine | GizmoArrow | GizmoRoundVolume | GizmoCircle | GizmoGrid | GizmoAxes | GizmoPolyline | GizmoMesh, style?: GizmoStyle): void;
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* Moves this resource's named drawing without rebuilding it: every authored point p is drawn at position + rotation * p. Author the geometry around the origin to move it as a whole. The rotation is normalized and defaults to identity. set() resets the transform to identity.
|
|
2320
|
+
* @returns True if the drawing exists; false if this resource has no drawing with that ID.
|
|
2321
|
+
*/
|
|
2322
|
+
setTransform(id: string, position: GizmoPoint, rotation?: { x: number; y: number; z: number; w: number }): boolean;
|
|
2323
|
+
|
|
2324
|
+
/**
|
|
2325
|
+
* Removes this resource's named drawing. Throws for an invalid ID or unknown resource.
|
|
2326
|
+
* @returns True if removed; false if this resource has no drawing with that ID.
|
|
2327
|
+
*/
|
|
2328
|
+
remove(id: string): boolean;
|
|
2329
|
+
|
|
2330
|
+
/**
|
|
2331
|
+
* Removes all drawings owned by this resource. Other resources are unaffected. Throws if the caller's resource cannot be identified.
|
|
2332
|
+
*/
|
|
2333
|
+
clear(): void;
|
|
2334
|
+
};
|
|
2335
|
+
|
|
1963
2336
|
/**
|
|
1964
2337
|
* The box a ghost occupies, in world space.
|
|
1965
2338
|
*/
|
|
@@ -2163,6 +2536,37 @@ declare global {
|
|
|
2163
2536
|
on(event: "move" | "confirm" | "rejected" | "cancel" | "end", handler: PlacementHandler<PlacementPose>): Unsubscribe;
|
|
2164
2537
|
};
|
|
2165
2538
|
|
|
2539
|
+
/**
|
|
2540
|
+
* The world builder: a free camera, the game's mesh catalog as an asset library, a placement brush, a gizmo that moves anything, and maps saved to and loaded from files.
|
|
2541
|
+
*
|
|
2542
|
+
* No key opens it. A resource decides when it does, and only on a server whose `server.json` sets `mod.map_editor` to true; anywhere else `open` refuses. While it is open it holds the one free camera, so a `NoClip` flight in progress ends and `NoClip.enable` refuses. The player can still close it from its own window.
|
|
2543
|
+
*/
|
|
2544
|
+
const MapEditor: {
|
|
2545
|
+
/**
|
|
2546
|
+
* Opens the editor.
|
|
2547
|
+
* @returns `opened` when it opened. `alreadyOpen` when it was open already. `disabled` when the server has not turned `mod.map_editor` on, which includes no session at all.
|
|
2548
|
+
*/
|
|
2549
|
+
open(): "opened" | "alreadyOpen" | "disabled";
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Closes the editor and hands the camera back. Doing nothing when it is closed is not an error.
|
|
2553
|
+
* @returns Nothing.
|
|
2554
|
+
*/
|
|
2555
|
+
close(): void;
|
|
2556
|
+
|
|
2557
|
+
/**
|
|
2558
|
+
* Whether the editor is open at this client.
|
|
2559
|
+
* @returns True while it is open.
|
|
2560
|
+
*/
|
|
2561
|
+
isOpen(): boolean;
|
|
2562
|
+
|
|
2563
|
+
/**
|
|
2564
|
+
* Whether the connected server lets the editor open.
|
|
2565
|
+
* @returns True when its `server.json` sets `mod.map_editor` to true.
|
|
2566
|
+
*/
|
|
2567
|
+
isEnabled(): boolean;
|
|
2568
|
+
};
|
|
2569
|
+
|
|
2166
2570
|
/**
|
|
2167
2571
|
* A screen composed inside one of the game's own Scaleform movies.
|
|
2168
2572
|
*/
|
|
@@ -2555,6 +2959,20 @@ declare global {
|
|
|
2555
2959
|
* The game's own Scaleform UI, opened from script. This is the second way to draw a UI at this client, beside `Web`: a web view is a browser and lays out anything, a native screen is composed out of the game's own movies, sits inside the game's own layer stack and is navigable with a controller.
|
|
2556
2960
|
*/
|
|
2557
2961
|
const NativeUI: {
|
|
2962
|
+
/**
|
|
2963
|
+
* Prevents a vanilla menu from opening or being selected through native navigation. An already-open disabled menu closes on the next client tick. Requests are idempotent and resource-owned: a menu stays disabled while any resource disables it. Restrictions clear when the resource stops or the session ends. Key bindings are unchanged. Tab labels remain in the native screen. The custom character creator can still use the player stage.
|
|
2964
|
+
* @param menu The vanilla menu, including its detail pages.
|
|
2965
|
+
* @param enabled False prevents opening the menu; true releases this resource's restriction. All menus are enabled by default.
|
|
2966
|
+
*/
|
|
2967
|
+
setMenuEnabled(menu: "inventory" | "player" | "map" | "codex" | "journal" | "crafting", enabled: boolean): void;
|
|
2968
|
+
|
|
2969
|
+
/**
|
|
2970
|
+
* Whether every resource permits this vanilla menu. Native gameplay rules may still prevent it from opening. Throws for unknown menu names.
|
|
2971
|
+
* @param menu The vanilla menu to query.
|
|
2972
|
+
* @returns True when no resource disables the menu.
|
|
2973
|
+
*/
|
|
2974
|
+
isMenuEnabled(menu: "inventory" | "player" | "map" | "codex" | "journal" | "crafting"): boolean;
|
|
2975
|
+
|
|
2558
2976
|
/**
|
|
2559
2977
|
* Opens a screen. It is composed a few frames later, when its movie reports ready -- listen for `ready` rather than drawing into it straight away.
|
|
2560
2978
|
* @param options `library` names which of the game's movies the screen may attach exported sprites from, empty for the default. `movie` is a path inside this resource to a movie it ships, which opens a screen in that instead. `assets` are further files that movie loads, and `layer` is where it sits in the game's own stack.
|
|
@@ -2717,32 +3135,32 @@ declare global {
|
|
|
2717
3135
|
/**
|
|
2718
3136
|
* The object in the player's hands: a red-covered book (the default), a plain-covered one, or a folded letter.
|
|
2719
3137
|
*/
|
|
2720
|
-
style
|
|
3138
|
+
style?: "book" | "plainBook" | "letter" | undefined;
|
|
2721
3139
|
|
|
2722
3140
|
/**
|
|
2723
3141
|
* The layout the movie uses, by `document_class` id: 1 book (the default), 2 recipe, 3 skill book, 4 map, 5 letter (the default for `letter`), 6 plan.
|
|
2724
3142
|
*/
|
|
2725
|
-
type
|
|
3143
|
+
type?: number | undefined;
|
|
2726
3144
|
|
|
2727
3145
|
/**
|
|
2728
3146
|
* How ornate the pages are, 1 plain to 7 embellished. Defaults to 1.
|
|
2729
3147
|
*/
|
|
2730
|
-
visual
|
|
3148
|
+
visual?: number | undefined;
|
|
2731
3149
|
|
|
2732
3150
|
/**
|
|
2733
3151
|
* How much of the text can be read, 0 to 1; values outside are clamped. Defaults to 1, fully legible. Below 1 the movie swaps letters for look-alike glyphs, the same effect a vanilla book shows a player with low reading skill. It works in tenths: each step brings roughly another tenth of the character classes back, so 0.31 and 0.39 look the same. The substitution is deterministic -- the same text at the same level always reads the same way -- and markup is never touched.
|
|
2734
3152
|
*/
|
|
2735
|
-
legibility
|
|
3153
|
+
legibility?: number | undefined;
|
|
2736
3154
|
|
|
2737
3155
|
/**
|
|
2738
3156
|
* A picture `Book.image` returned, replacing the carrier's own diffuse texture: the paper and the cover together, which the model maps from one atlas. Paint it over the vanilla atlas to keep the UV layout -- `Objects/manmade/task_specific_props/read_and_write/books/book_alchemy_diff.dds` for the two book styles, `.../scrolls/scroll_diff.dds` for `letter`. The material's diffuse colour multiplies it: `book` darkens it to about 78% and `letter` to about 72%, while `plainBook` shows it as painted. It applies to this book's own copy of the material only, and goes with the book.
|
|
2739
3157
|
*/
|
|
2740
|
-
texture
|
|
3158
|
+
texture?: string | undefined;
|
|
2741
3159
|
|
|
2742
3160
|
/**
|
|
2743
3161
|
* Pictures for the skill-book and map layouts. Inline pictures go in the page text as `<img>` instead.
|
|
2744
3162
|
*/
|
|
2745
|
-
images
|
|
3163
|
+
images?: BookPageImage[] | undefined;
|
|
2746
3164
|
}
|
|
2747
3165
|
|
|
2748
3166
|
/**
|
|
@@ -2795,6 +3213,102 @@ declare global {
|
|
|
2795
3213
|
image(path: string): string;
|
|
2796
3214
|
};
|
|
2797
3215
|
|
|
3216
|
+
/**
|
|
3217
|
+
* What `CharacterCreator.open` shows.
|
|
3218
|
+
*/
|
|
3219
|
+
interface CharacterCreatorOptions {
|
|
3220
|
+
/**
|
|
3221
|
+
* The look the stage starts on. Left out, it starts on the first gender offered with every part left to the figure -- the player's own look on the man, the game's default on the woman.
|
|
3222
|
+
*/
|
|
3223
|
+
appearance?: Appearance | undefined;
|
|
3224
|
+
|
|
3225
|
+
/**
|
|
3226
|
+
* Which bodies the player may choose between; `both` (the default) lets them switch.
|
|
3227
|
+
*/
|
|
3228
|
+
genders?: "male" | "female" | "both" | undefined;
|
|
3229
|
+
|
|
3230
|
+
/**
|
|
3231
|
+
* The panel's heading, at most 64 bytes. Defaults to `Character`.
|
|
3232
|
+
*/
|
|
3233
|
+
title?: string | undefined;
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
/**
|
|
3237
|
+
* The game's own character stage, for the local player to choose how they look.
|
|
3238
|
+
*
|
|
3239
|
+
* Opens the pause screen on its character page, hides the page's own panels and stands a panel of tabs -- body, face, hair, beard -- beside a figure the player dresses and turns. The keys are listed on the panel, named as the game names them.
|
|
3240
|
+
*
|
|
3241
|
+
* Client-only and local: it changes nothing anywhere. `characterCreatorClosed` reports what the player accepted, and the resource decides what that means.
|
|
3242
|
+
*/
|
|
3243
|
+
const CharacterCreator: {
|
|
3244
|
+
/**
|
|
3245
|
+
* Opens a creator, ending one already open as `replaced`. The stage goes up on the next ticks; one that cannot ends as `unavailable`.
|
|
3246
|
+
* @param options What to show.
|
|
3247
|
+
* @returns True. Malformed options throw.
|
|
3248
|
+
*/
|
|
3249
|
+
open(options?: CharacterCreatorOptions): boolean;
|
|
3250
|
+
|
|
3251
|
+
/**
|
|
3252
|
+
* Ends the open creator as `closed`.
|
|
3253
|
+
* @returns False when none was open.
|
|
3254
|
+
*/
|
|
3255
|
+
close(): boolean;
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* Whether a creator is open or going up.
|
|
3259
|
+
* @returns True from `open` until its `characterCreatorClosed`.
|
|
3260
|
+
*/
|
|
3261
|
+
isOpen(): boolean;
|
|
3262
|
+
};
|
|
3263
|
+
|
|
3264
|
+
/**
|
|
3265
|
+
* "Press [key] to ..." hints, drawn by the game's own HUD beside its own, with a handler run when the player presses the key.
|
|
3266
|
+
*
|
|
3267
|
+
* A hint names one of the game's keys by its control -- `primary_action`, `jump` and the rest of `keys()` -- and never a physical key: the glyph is whatever the player has bound to that control, keyboard or pad, and follows a rebind. A press hint fires on the press; a hold hint draws the game's ring and fires once it fills.
|
|
3268
|
+
*
|
|
3269
|
+
* Hints are drawn while the player is in control of their character, on foot or in the saddle, and the game takes them down in dialogue, minigames and menus. Two hints on one key stack: the newest is drawn and gets the press, and removing it brings back the one under it. A hint does not stop the game's own action on that key -- put a hint on `primary_action` and the player still interacts with whatever they look at.
|
|
3270
|
+
*
|
|
3271
|
+
* Client-only and local: a hint is shown to the player at this machine. Hints go when the resource that made them stops.
|
|
3272
|
+
*/
|
|
3273
|
+
const ActionHint: {
|
|
3274
|
+
/**
|
|
3275
|
+
* Puts a hint up. It is drawn from the next frame the player is in control.
|
|
3276
|
+
* @param options `key` is one of `keys()`. `text` is what the HUD writes beside the key, as written, at most 256 bytes. `mode` is "press" by default. `holdDuration` is how long a hold hint's ring takes to fill, 0.2 to 10 seconds, 1 by default. `enabled` false draws the hint greyed out and keeps the handler from running.
|
|
3277
|
+
* @param handler Run with the hint's id each time it fires.
|
|
3278
|
+
* @returns The hint's id. Throws when an option is out of range or the key is not one of `keys()`.
|
|
3279
|
+
*/
|
|
3280
|
+
create(options: { key: string; text: string; mode?: "press" | "hold"; holdDuration?: number; enabled?: boolean }, handler: ActionHintHandler): number;
|
|
3281
|
+
|
|
3282
|
+
/**
|
|
3283
|
+
* Rewrites a hint's text in place.
|
|
3284
|
+
* @param hint An id from `create`.
|
|
3285
|
+
* @param text The new text, as written, at most 256 bytes.
|
|
3286
|
+
* @returns False when the hint is gone or the text is too long.
|
|
3287
|
+
*/
|
|
3288
|
+
setText(hint: number, text: string): boolean;
|
|
3289
|
+
|
|
3290
|
+
/**
|
|
3291
|
+
* Greys a hint out, or brings it back.
|
|
3292
|
+
* @param hint An id from `create`.
|
|
3293
|
+
* @param enabled False greys the hint out and its handler stops running.
|
|
3294
|
+
* @returns False when the hint is gone.
|
|
3295
|
+
*/
|
|
3296
|
+
setEnabled(hint: number, enabled: boolean): boolean;
|
|
3297
|
+
|
|
3298
|
+
/**
|
|
3299
|
+
* Takes a hint down for good.
|
|
3300
|
+
* @param hint An id from `create`.
|
|
3301
|
+
* @returns False when it was already gone.
|
|
3302
|
+
*/
|
|
3303
|
+
remove(hint: number): boolean;
|
|
3304
|
+
|
|
3305
|
+
/**
|
|
3306
|
+
* The controls a hint can be put on.
|
|
3307
|
+
* @returns Control names, in a fixed order.
|
|
3308
|
+
*/
|
|
3309
|
+
keys(): string[];
|
|
3310
|
+
};
|
|
3311
|
+
|
|
2798
3312
|
/**
|
|
2799
3313
|
* Mutable two-dimensional vector.
|
|
2800
3314
|
*/
|
|
@@ -4103,6 +4617,13 @@ declare global {
|
|
|
4103
4617
|
* Client-only, resource-owned physical key bindings exposed as the global Key.
|
|
4104
4618
|
*/
|
|
4105
4619
|
const Key: {
|
|
4620
|
+
/**
|
|
4621
|
+
* Returns the current layout's label for a physical key, even while UI owns input. Query again when refreshing prompts. Throws for unknown keys or non-string arguments.
|
|
4622
|
+
* @param key Case-insensitive physical key name, using the same names as bind.
|
|
4623
|
+
* @returns Uppercase printable text, or an English name such as Enter or Mouse 1. Falls back to the uppercase canonical key name when translation is unavailable.
|
|
4624
|
+
*/
|
|
4625
|
+
getLabel(key: string): string;
|
|
4626
|
+
|
|
4106
4627
|
/**
|
|
4107
4628
|
* Binds a resource-owned handler that fires while the game has foreground input and no UI is capturing it.
|
|
4108
4629
|
* @param key Case-insensitive supported keyboard or mouse key name.
|