@n3rdw1z4rd/core 0.20.0 → 0.22.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/dist/graph/doc.d.ts +141 -0
- package/dist/graph/doc.js +173 -0
- package/dist/graph/evaluate.d.ts +114 -0
- package/dist/graph/evaluate.js +319 -0
- package/dist/graph/index.d.ts +9 -0
- package/dist/graph/index.js +9 -0
- package/dist/graph/node.d.ts +153 -0
- package/dist/graph/node.js +94 -0
- package/dist/graph/nodes.d.ts +11 -0
- package/dist/graph/nodes.js +399 -0
- package/dist/graph/script.d.ts +64 -0
- package/dist/graph/script.js +111 -0
- package/dist/graph/sources.d.ts +11 -0
- package/dist/graph/sources.js +263 -0
- package/dist/graph/subgraph.d.ts +36 -0
- package/dist/graph/subgraph.js +280 -0
- package/dist/graph/types.d.ts +56 -0
- package/dist/graph/types.js +67 -0
- package/dist/graph.cjs +1723 -0
- package/dist/graph.d.cts +576 -0
- package/dist/index.cjs +53 -52
- package/dist/rng-Dhqq7owV.cjs +642 -0
- package/dist/{spatial-partition-3d-Ba-VBveM.cjs → spatial-partition-3d-CmSCL87Z.cjs} +19 -660
- package/dist/three/adaptive-grid.d.ts +43 -0
- package/dist/three/adaptive-grid.js +127 -0
- package/dist/three/ecs.d.ts +5 -3
- package/dist/three/ecs.js +5 -3
- package/dist/three/editor-camera.d.ts +93 -0
- package/dist/three/editor-camera.js +174 -0
- package/dist/three/index.d.ts +6 -1
- package/dist/three/index.js +6 -1
- package/dist/three/picking.d.ts +34 -0
- package/dist/three/picking.js +59 -0
- package/dist/three/schema.d.ts +139 -0
- package/dist/three/schema.js +214 -0
- package/dist/three/world.d.ts +192 -0
- package/dist/three/world.js +363 -0
- package/dist/three.cjs +970 -23
- package/dist/three.d.cts +497 -5
- package/dist/vite.cjs +40 -0
- package/dist/vite.d.cts +35 -0
- package/dist/vite.d.ts +35 -0
- package/dist/vite.js +39 -0
- package/package.json +21 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_rng = require("./rng-Dhqq7owV.cjs");
|
|
3
|
+
const require_spatial_partition_3d = require("./spatial-partition-3d-CmSCL87Z.cjs");
|
|
3
4
|
let heap_js = require("heap-js");
|
|
4
5
|
//#region src/astar.ts
|
|
5
6
|
const DEFAULT_MAX_NODES = 1e4;
|
|
@@ -42,7 +43,7 @@ function findPath(start, goal, cost, options = {}) {
|
|
|
42
43
|
const heuristic = (x, y) => {
|
|
43
44
|
const dx = Math.abs(x - goal.x);
|
|
44
45
|
const dy = Math.abs(y - goal.y);
|
|
45
|
-
return diagonal ? Math.max(dx, dy) + (
|
|
46
|
+
return diagonal ? Math.max(dx, dy) + (require_rng.SQRT2 - 1) * Math.min(dx, dy) : dx + dy;
|
|
46
47
|
};
|
|
47
48
|
const isGoal = (x, y) => {
|
|
48
49
|
if (x === goal.x && y === goal.y) return true;
|
|
@@ -88,7 +89,7 @@ function findPath(start, goal, cost, options = {}) {
|
|
|
88
89
|
if (!(stepCost < Infinity)) continue;
|
|
89
90
|
const isDiagonal = dx !== 0 && dy !== 0;
|
|
90
91
|
if (isDiagonal && !cutCorners && (!passable(current.x + dx, current.y) || !passable(current.x, current.y + dy))) continue;
|
|
91
|
-
const g = current.g + (isDiagonal ? stepCost *
|
|
92
|
+
const g = current.g + (isDiagonal ? stepCost * require_rng.SQRT2 : stepCost);
|
|
92
93
|
const known = best.get(k);
|
|
93
94
|
if (known && known.g <= g) continue;
|
|
94
95
|
const h = known?.h ?? heuristic(x, y);
|
|
@@ -276,7 +277,7 @@ var CanvasRenderer = class {
|
|
|
276
277
|
/** Draws a circle centered on (`x`, `y`). */
|
|
277
278
|
drawCircle(x, y, radius, params = {}) {
|
|
278
279
|
this.drawPath(() => {
|
|
279
|
-
this.context.arc(x, y, radius, 0,
|
|
280
|
+
this.context.arc(x, y, radius, 0, require_rng.TAU);
|
|
280
281
|
}, params);
|
|
281
282
|
}
|
|
282
283
|
/**
|
|
@@ -286,10 +287,10 @@ var CanvasRenderer = class {
|
|
|
286
287
|
* @param sides floored and clamped to 3..36
|
|
287
288
|
*/
|
|
288
289
|
drawPolygon(x, y, radius, sides, params = {}) {
|
|
289
|
-
sides = Math.floor(
|
|
290
|
+
sides = Math.floor(require_rng.clamp(sides, 3, 36));
|
|
290
291
|
this.drawPath(() => {
|
|
291
292
|
for (let i = 0; i < sides; i++) {
|
|
292
|
-
const angle = i / sides *
|
|
293
|
+
const angle = i / sides * require_rng.TAU - require_rng.PI / 2;
|
|
293
294
|
const px = x + Math.cos(angle) * radius;
|
|
294
295
|
const py = y + Math.sin(angle) * radius;
|
|
295
296
|
if (i === 0) this.context.moveTo(px, py);
|
|
@@ -739,7 +740,7 @@ var Vector = class Vector {
|
|
|
739
740
|
}
|
|
740
741
|
/** Euclidean distance to `that`. */
|
|
741
742
|
distanceTo(that) {
|
|
742
|
-
return
|
|
743
|
+
return require_rng.distance2d(this.x, this.y, that.x, that.y);
|
|
743
744
|
}
|
|
744
745
|
/** Euclidean length (magnitude). */
|
|
745
746
|
length() {
|
|
@@ -1002,11 +1003,11 @@ function _generateRooms(params = {}) {
|
|
|
1002
1003
|
const rooms = [];
|
|
1003
1004
|
let iterations = 0;
|
|
1004
1005
|
while (iterations < maxIterations) {
|
|
1005
|
-
const baseSize =
|
|
1006
|
-
const aspectRatio = .75 +
|
|
1006
|
+
const baseSize = require_rng.rng.range(minRoomSize, maxRoomSize);
|
|
1007
|
+
const aspectRatio = .75 + require_rng.rng.gaussian() * .5;
|
|
1007
1008
|
const width = Math.min(maxRoomSize, Math.max(minRoomSize, Math.round(baseSize * aspectRatio)));
|
|
1008
1009
|
const height = Math.min(maxRoomSize, Math.max(minRoomSize, Math.round(baseSize / aspectRatio)));
|
|
1009
|
-
const room = new Rectangle(
|
|
1010
|
+
const room = new Rectangle(require_rng.rng.range(1 + padding, size - width - padding), require_rng.rng.range(1 + padding, size - height - padding), width, height);
|
|
1010
1011
|
if (!rooms.some((existing) => room.intersects(existing, padding * 2))) {
|
|
1011
1012
|
rooms.push(room);
|
|
1012
1013
|
iterations = 0;
|
|
@@ -1029,7 +1030,7 @@ function _generateMST(rooms, params = {}) {
|
|
|
1029
1030
|
heap.push({
|
|
1030
1031
|
from: 0,
|
|
1031
1032
|
to: i,
|
|
1032
|
-
cost:
|
|
1033
|
+
cost: require_rng.squaredDistance(zeroCenter.x, zeroCenter.y, iCenter.x, iCenter.y)
|
|
1033
1034
|
});
|
|
1034
1035
|
}
|
|
1035
1036
|
while (visited.size < rooms.length) {
|
|
@@ -1048,14 +1049,14 @@ function _generateMST(rooms, params = {}) {
|
|
|
1048
1049
|
heap.push({
|
|
1049
1050
|
from: to,
|
|
1050
1051
|
to: i,
|
|
1051
|
-
cost:
|
|
1052
|
+
cost: require_rng.squaredDistance(toCenter.x, toCenter.y, iCenter.x, iCenter.y)
|
|
1052
1053
|
});
|
|
1053
1054
|
}
|
|
1054
1055
|
}
|
|
1055
1056
|
const remainingEdges = heap.toArray().sort((a, b) => a.cost - b.cost);
|
|
1056
1057
|
for (let i = 0; i < extraPathLevels && i < remainingEdges.length; i++) {
|
|
1057
1058
|
const e = remainingEdges[i];
|
|
1058
|
-
if (
|
|
1059
|
+
if (require_rng.rng.nextFloat() < extraPathDensity) extraPaths.push({
|
|
1059
1060
|
a: rooms[e.from],
|
|
1060
1061
|
b: rooms[e.to]
|
|
1061
1062
|
});
|
|
@@ -1097,7 +1098,7 @@ function _getShortestPathBetweenRects(rectA, rectB) {
|
|
|
1097
1098
|
distance: Infinity
|
|
1098
1099
|
};
|
|
1099
1100
|
for (const a of edgeA) for (const b of edgeB) {
|
|
1100
|
-
const d =
|
|
1101
|
+
const d = require_rng.distance2d(a.x, a.y, b.x, b.y);
|
|
1101
1102
|
if (d < paths.distance) paths = {
|
|
1102
1103
|
a,
|
|
1103
1104
|
b,
|
|
@@ -1176,7 +1177,7 @@ function GenerateDoors(map, paths, params = {}) {
|
|
|
1176
1177
|
});
|
|
1177
1178
|
const doors = [];
|
|
1178
1179
|
possibleDoorPoints.forEach((doorPoint) => {
|
|
1179
|
-
if (
|
|
1180
|
+
if (require_rng.rng.nextFloat() < chanceExists && (map.get(doorPoint.x, doorPoint.y - 1) === map.defaultValue && map.get(doorPoint.x, doorPoint.y + 1) === map.defaultValue || map.get(doorPoint.x - 1, doorPoint.y) === map.defaultValue && map.get(doorPoint.x + 1, doorPoint.y) === map.defaultValue)) doors.push(doorPoint);
|
|
1180
1181
|
});
|
|
1181
1182
|
return doors;
|
|
1182
1183
|
}
|
|
@@ -2991,7 +2992,7 @@ const getRedYellowGreenGradientHex = (value, max = 1) => {
|
|
|
2991
2992
|
"#66ff00",
|
|
2992
2993
|
"#33ff00",
|
|
2993
2994
|
"#00ff00"
|
|
2994
|
-
][
|
|
2995
|
+
][require_rng.clamp(Math.floor(percent * 10), 0, 10)];
|
|
2995
2996
|
};
|
|
2996
2997
|
/**
|
|
2997
2998
|
* The current page's query-string parameters as a plain object of strings (the last value wins
|
|
@@ -3996,16 +3997,16 @@ exports.DEFAULT_PIXEL_SIZE = DEFAULT_PIXEL_SIZE;
|
|
|
3996
3997
|
exports.DEFAULT_REPEAT = DEFAULT_REPEAT;
|
|
3997
3998
|
exports.DEFAULT_TEXTALIGN = DEFAULT_TEXTALIGN;
|
|
3998
3999
|
exports.DEFAULT_TEXTBASELINE = DEFAULT_TEXTBASELINE;
|
|
3999
|
-
exports.DEG2RAD =
|
|
4000
|
+
exports.DEG2RAD = require_rng.DEG2RAD;
|
|
4000
4001
|
exports.DeleteProgramInfo = DeleteProgramInfo;
|
|
4001
4002
|
exports.DeleteRenderTarget = DeleteRenderTarget;
|
|
4002
4003
|
exports.DeleteTexture = DeleteTexture;
|
|
4003
4004
|
exports.DeleteVertexArray = DeleteVertexArray;
|
|
4004
4005
|
exports.Disposable = Disposable;
|
|
4005
4006
|
exports.Draw = Draw;
|
|
4006
|
-
exports.E =
|
|
4007
|
+
exports.E = require_rng.E;
|
|
4007
4008
|
exports.ECS = ECS;
|
|
4008
|
-
exports.EPSILON =
|
|
4009
|
+
exports.EPSILON = require_rng.EPSILON;
|
|
4009
4010
|
exports.Emitter = Emitter;
|
|
4010
4011
|
exports.EventQueue = EventQueue;
|
|
4011
4012
|
exports.GAMEPAD_AXES = GAMEPAD_AXES;
|
|
@@ -4017,13 +4018,13 @@ exports.GenerateWalls = GenerateWalls;
|
|
|
4017
4018
|
exports.GestureRecognizer = GestureRecognizer;
|
|
4018
4019
|
exports.GetProgramLocations = GetProgramLocations;
|
|
4019
4020
|
exports.GetUrlParams = GetUrlParams;
|
|
4020
|
-
exports.HALF_PI =
|
|
4021
|
+
exports.HALF_PI = require_rng.HALF_PI;
|
|
4021
4022
|
exports.Input = Input;
|
|
4022
4023
|
exports.InputActionMap = InputActionMap;
|
|
4023
|
-
exports.LN10 =
|
|
4024
|
-
exports.LN2 =
|
|
4025
|
-
exports.LOG10E =
|
|
4026
|
-
exports.LOG2E =
|
|
4024
|
+
exports.LN10 = require_rng.LN10;
|
|
4025
|
+
exports.LN2 = require_rng.LN2;
|
|
4026
|
+
exports.LOG10E = require_rng.LOG10E;
|
|
4027
|
+
exports.LOG2E = require_rng.LOG2E;
|
|
4027
4028
|
exports.LoadWebGlTexture = LoadWebGlTexture;
|
|
4028
4029
|
exports.MAP_2D_MAX_COORD = MAP_2D_MAX_COORD;
|
|
4029
4030
|
exports.MAP_2D_MIN_COORD = MAP_2D_MIN_COORD;
|
|
@@ -4033,24 +4034,24 @@ exports.Map2D = Map2D;
|
|
|
4033
4034
|
exports.Map3D = require_spatial_partition_3d.Map3D;
|
|
4034
4035
|
exports.ONE_SECOND = ONE_SECOND;
|
|
4035
4036
|
exports.Observable = Observable;
|
|
4036
|
-
exports.PI =
|
|
4037
|
+
exports.PI = require_rng.PI;
|
|
4037
4038
|
exports.ParticleRenderer = ParticleRenderer;
|
|
4038
4039
|
exports.ParticleSystem2d = require_spatial_partition_3d.ParticleSystem2d;
|
|
4039
|
-
exports.QUARTER_PI =
|
|
4040
|
-
exports.RAD2DEG =
|
|
4041
|
-
exports.Random =
|
|
4040
|
+
exports.QUARTER_PI = require_rng.QUARTER_PI;
|
|
4041
|
+
exports.RAD2DEG = require_rng.RAD2DEG;
|
|
4042
|
+
exports.Random = require_rng.Random;
|
|
4042
4043
|
exports.Rectangle = Rectangle;
|
|
4043
4044
|
exports.ResizeRenderTarget = ResizeRenderTarget;
|
|
4044
4045
|
exports.ResizeWebGlContext = ResizeWebGlContext;
|
|
4045
|
-
exports.Rng =
|
|
4046
|
-
exports.SQRT1_2 =
|
|
4047
|
-
exports.SQRT2 =
|
|
4046
|
+
exports.Rng = require_rng.Rng;
|
|
4047
|
+
exports.SQRT1_2 = require_rng.SQRT1_2;
|
|
4048
|
+
exports.SQRT2 = require_rng.SQRT2;
|
|
4048
4049
|
exports.SetUniforms = SetUniforms;
|
|
4049
4050
|
exports.ShaderType = ShaderType;
|
|
4050
4051
|
exports.Signal = Signal;
|
|
4051
4052
|
exports.SpatialPartition2d = require_spatial_partition_3d.SpatialPartition2d;
|
|
4052
4053
|
exports.SpatialPartition3d = require_spatial_partition_3d.SpatialPartition3d;
|
|
4053
|
-
exports.TAU =
|
|
4054
|
+
exports.TAU = require_rng.TAU;
|
|
4054
4055
|
exports.TILE_EMPTY = TILE_EMPTY;
|
|
4055
4056
|
exports.TILE_FLOOR = TILE_FLOOR;
|
|
4056
4057
|
exports.TILE_PATH = TILE_PATH;
|
|
@@ -4065,42 +4066,42 @@ exports.XR_BUTTONS = XR_BUTTONS;
|
|
|
4065
4066
|
exports.bindingLabel = bindingLabel;
|
|
4066
4067
|
exports.bindingsEqual = bindingsEqual;
|
|
4067
4068
|
exports.buildColorPalette = buildColorPalette;
|
|
4068
|
-
exports.clamp =
|
|
4069
|
+
exports.clamp = require_rng.clamp;
|
|
4069
4070
|
exports.controlId = controlId;
|
|
4070
|
-
exports.degrees =
|
|
4071
|
-
exports.distance2d =
|
|
4072
|
-
exports.distance3d =
|
|
4071
|
+
exports.degrees = require_rng.degrees;
|
|
4072
|
+
exports.distance2d = require_rng.distance2d;
|
|
4073
|
+
exports.distance3d = require_rng.distance3d;
|
|
4073
4074
|
exports.ecs = ecs;
|
|
4074
4075
|
exports.findPath = findPath;
|
|
4075
|
-
exports.fract =
|
|
4076
|
+
exports.fract = require_rng.fract;
|
|
4076
4077
|
exports.gesture = gesture;
|
|
4077
4078
|
exports.getRedYellowGreenGradientHex = getRedYellowGreenGradientHex;
|
|
4078
|
-
exports.hash32 =
|
|
4079
|
-
exports.hash32mix =
|
|
4080
|
-
exports.inverseLerp =
|
|
4079
|
+
exports.hash32 = require_rng.hash32;
|
|
4080
|
+
exports.hash32mix = require_rng.hash32mix;
|
|
4081
|
+
exports.inverseLerp = require_rng.inverseLerp;
|
|
4081
4082
|
exports.isNullOrUndefined = isNullOrUndefined;
|
|
4082
4083
|
exports.isPositiveString = isPositiveString;
|
|
4083
4084
|
exports.k2xy = k2xy;
|
|
4084
4085
|
exports.k2xyz = k2xyz;
|
|
4085
4086
|
exports.key = key;
|
|
4086
|
-
exports.lerp =
|
|
4087
|
+
exports.lerp = require_rng.lerp;
|
|
4087
4088
|
exports.log = require_spatial_partition_3d.log;
|
|
4088
|
-
exports.manhattanDistance =
|
|
4089
|
-
exports.mod =
|
|
4089
|
+
exports.manhattanDistance = require_rng.manhattanDistance;
|
|
4090
|
+
exports.mod = require_rng.mod;
|
|
4090
4091
|
exports.mouse = mouse;
|
|
4091
|
-
exports.nearlyEqual =
|
|
4092
|
-
exports.normalizeRadians =
|
|
4092
|
+
exports.nearlyEqual = require_rng.nearlyEqual;
|
|
4093
|
+
exports.normalizeRadians = require_rng.normalizeRadians;
|
|
4093
4094
|
exports.pad = pad;
|
|
4094
4095
|
exports.padAxis = padAxis;
|
|
4095
|
-
exports.radians =
|
|
4096
|
+
exports.radians = require_rng.radians;
|
|
4096
4097
|
exports.randomMatrix = require_spatial_partition_3d.randomMatrix;
|
|
4097
|
-
exports.rng =
|
|
4098
|
-
exports.roundTo =
|
|
4099
|
-
exports.saturate =
|
|
4100
|
-
exports.smoothstep =
|
|
4101
|
-
exports.squaredDistance =
|
|
4098
|
+
exports.rng = require_rng.rng;
|
|
4099
|
+
exports.roundTo = require_rng.roundTo;
|
|
4100
|
+
exports.saturate = require_rng.saturate;
|
|
4101
|
+
exports.smoothstep = require_rng.smoothstep;
|
|
4102
|
+
exports.squaredDistance = require_rng.squaredDistance;
|
|
4102
4103
|
exports.wheel = wheel;
|
|
4103
|
-
exports.wrap =
|
|
4104
|
+
exports.wrap = require_rng.wrap;
|
|
4104
4105
|
exports.xr = xr;
|
|
4105
4106
|
exports.xrAxis = xrAxis;
|
|
4106
4107
|
exports.xy2k = xy2k;
|