hm
This commit is contained in:
parent
cefa2ace5a
commit
0e432c62ae
87 changed files with 4282 additions and 3066 deletions
32
js/mechanical_shape_bridge.js
Normal file
32
js/mechanical_shape_bridge.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
// Layer: physics/mechanical-shape-bridge
|
||||
// Single read-only facade for mechanical shape/footprint queries. It keeps
|
||||
// world, placement, and renderer code from binding directly to the body solver.
|
||||
(function (global) {
|
||||
function mech() { return global.TarinaiMechanicalSystem || null; }
|
||||
|
||||
function isMechanicalType(itemOrType) { return Boolean(mech()?.isMechanicalType?.(itemOrType)); }
|
||||
function worldSegments(item) { return mech()?.worldSegments?.(item) || []; }
|
||||
function obstacleRects(item) { return mech()?.obstacleRects?.(item) || []; }
|
||||
function placementRects(item) { return mech()?.placementRects?.(item) || obstacleRects(item); }
|
||||
function poisonHazardRects(item) { return mech()?.poisonHazardRects?.(item) || []; }
|
||||
function boundsAabb(item) { return mech()?.boundsAabb?.(item) || null; }
|
||||
function hazardAabb(item) { return mech()?.hazardAabb?.(item) || null; }
|
||||
function extent(item) { return mech()?.extent?.(item) || 0; }
|
||||
function reach(item) { return mech()?.reach?.(item) || extent(item); }
|
||||
function hitTest(item, x, y, worldRef, opts = {}) { return mech()?.hitTest?.(item, x, y, worldRef, opts) || { hit: false, distance: Infinity }; }
|
||||
|
||||
global.TarinaiMechanicalShapeSystem = Object.freeze({
|
||||
isMechanicalType,
|
||||
worldSegments,
|
||||
obstacleRects,
|
||||
placementRects,
|
||||
poisonHazardRects,
|
||||
boundsAabb,
|
||||
hazardAabb,
|
||||
extent,
|
||||
reach,
|
||||
hitTest,
|
||||
});
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
Loading…
Add table
Add a link
Reference in a new issue