pelican-engine 0.3.7 → 0.3.9

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.
@@ -111,6 +111,13 @@ exhaustion returns `TC_NAVIGATION_CAPACITY`, not an unreachable result. Owners
111
111
  are explicit strings, not entities. This is a development-stage grid service,
112
112
  not continuous-world, flying or underwater navigation.
113
113
 
114
+ Use `ctx.navigation.setBlockedBatch(id, updates)` to change multiple cells in
115
+ one grid. Each update has `{ cell: { x, y }, blocked: boolean }`. The service
116
+ validates every entry before changing the grid; a bad entry rejects the whole
117
+ batch, and the last update wins if a cell appears more than once. Entity and
118
+ transform changes are separate from this grid-only batch. This API is new and
119
+ has not been runtime or browser validated under the current project policy.
120
+
114
121
  Keyboard bindings use the browser's `KeyboardEvent.key` values, not physical
115
122
  `KeyboardEvent.code` values. For example, use `input: { up: ["w", "W", "ArrowUp"],
116
123
  restart: ["r", "R"] }`, not `"KeyW"` or `"KeyR"`. Letter case depends on the
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pelican-engine",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "milestone": "M3",
5
5
  "stage": "advanced-rendering-development",
6
6
  "license": "MIT",
@@ -91,6 +91,28 @@ export const createNavigationPlugin = () => {
91
91
  else if (!blocked && exists)
92
92
  grid.blocked.splice(lower, 1);
93
93
  },
94
+ setBlockedBatch(id, updates) {
95
+ const grid = get(id);
96
+ if (!Array.isArray(updates))
97
+ fail("BLOCKED", `Updates for grid '${id}' must be an array of cells and boolean blocked values.`);
98
+ if (updates.length === 0)
99
+ return;
100
+ // Validate every entry before modifying the grid. Repeated cells use the last value.
101
+ const changes = new Map();
102
+ for (const update of updates) {
103
+ if (!update || typeof update !== "object" || typeof update.blocked !== "boolean")
104
+ fail("BLOCKED", `Each update for grid '${id}' requires a cell and a boolean blocked value.`);
105
+ changes.set(cell(grid, update.cell), update.blocked);
106
+ }
107
+ const blocked = new Set(grid.blocked);
108
+ for (const [index, value] of changes) {
109
+ if (value)
110
+ blocked.add(index);
111
+ else
112
+ blocked.delete(index);
113
+ }
114
+ grid.blocked = [...blocked].sort((a, b) => a - b);
115
+ },
94
116
  findPath(id, start, end) {
95
117
  const grid = get(id), from = cell(grid, start), to = cell(grid, end);
96
118
  const blocked = new Set(grid.blocked);
@@ -1,5 +1,5 @@
1
1
  /** Pelican Engine public API. No renderer or GPU implementation types escape this module. */
2
- export declare const SDK_VERSION = "0.3.7";
2
+ export declare const SDK_VERSION = "0.3.9";
3
3
  export type Vec2 = readonly [number, number];
4
4
  export type Vec3 = readonly [number, number, number];
5
5
  export type Vec4 = readonly [number, number, number, number];
@@ -109,6 +109,11 @@ export interface NavigationCell {
109
109
  readonly x: number;
110
110
  readonly y: number;
111
111
  }
112
+ /** One obstacle change for an orthogonal navigation grid. */
113
+ export interface NavigationObstacleUpdate {
114
+ readonly cell: NavigationCell;
115
+ readonly blocked: boolean;
116
+ }
112
117
  export interface NavigationGrid {
113
118
  readonly id: string;
114
119
  readonly owner: string;
@@ -124,6 +129,8 @@ export interface NavigationService {
124
129
  getGrid(id: string): NavigationGrid;
125
130
  isBlocked(id: string, cell: NavigationCell): boolean;
126
131
  setBlocked(id: string, cell: NavigationCell, blocked: boolean): void;
132
+ /** Validates the entire batch before committing; the last change for a repeated cell wins. */
133
+ setBlockedBatch(id: string, updates: readonly NavigationObstacleUpdate[]): void;
127
134
  findPath(id: string, start: NavigationCell, end: NavigationCell): readonly NavigationCell[];
128
135
  destroyGrid(id: string): void;
129
136
  destroyOwner(owner: string): void;
package/lib/sdk/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Pelican Engine public API. No renderer or GPU implementation types escape this module. */
2
- export const SDK_VERSION = "0.3.7";
2
+ export const SDK_VERSION = "0.3.9";
3
3
  export const SYSTEM_PHASES = [
4
4
  "input",
5
5
  "prePhysics",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pelican-engine",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Pelican Engine public SDK and offline development CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",