Delivered by Hermies Qwen, gated and deployed by Relay. - Board tip/topple: full continuous rotation when a board's center of mass passes its support edge (Q1: smooth pivot swing, no discrete snap). Falling boards deal impact damage and can kill enemies in their fall path. - Falling-object impact damage: blocks and birds can now kill enemies from vertical drops and side plows (velocity-aware crush gate), chain momentum transfers correctly through stacks (mass-weighted contact), repeated impacts finish tougher enemies. - Landed-bird physics: a bird resting on a board remains a real physical body under continuous gravity (Q2: no lifetime timer). If its platform is destroyed it falls, damages what it lands on (chain reaction), and can kill enemies. - Repo modularized: folders = modules, subfolders = submodules, architecture.md + MODULES.md at root, an agents.md card in every module and submodule (17 total). - Test suite grown from 27 to 47 (20 new RED-watched tests for the above behaviors), all green. Golden differential against the original core confirmed the only behavioral changes are the intended ones. Live at http://10.244.136.121:8093/, independently re-verified by Relay (full suite re-run, module structure check, headless Chromium smoke) before this push. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
72 lines
2.6 KiB
JavaScript
72 lines
2.6 KiB
JavaScript
/* ISLE SLINGERS -- physics/index.js (module: physics -- aggregator / public API)
|
|
* RC-375D84 S-2 modularization. This is the THIN AGGREGATOR for the physics
|
|
* module. The original js/core.js monolith is now split into submodules
|
|
* (physics/constants, -/state, -/aim, -/abilities, -/damage, -/step,
|
|
* -/collision, -/rules, -/camera); each installs its units into ONE shared
|
|
* scope `P`, preserving the monolith's single-closure semantics exactly.
|
|
*
|
|
* Load contract:
|
|
* browser -- every physics/<unit>/index.js <script> must load BEFORE this
|
|
* file (it reads the ordered parts off globalThis.ISLE_PHYSICS_PARTS);
|
|
* node -- this file requires the submodules in dependency order itself.
|
|
*
|
|
* Public API (ISLE_CORE) is key-for-key identical to the pre-modularization
|
|
* core.js return object -- same 20 keys, same values. No DOM, deterministic.
|
|
*/
|
|
(function (root, factory) {
|
|
var api = factory();
|
|
if (typeof module !== 'undefined' && module.exports) module.exports = api;
|
|
else root.ISLE_CORE = api;
|
|
})(typeof globalThis !== 'undefined' ? globalThis : this, function () {
|
|
'use strict';
|
|
|
|
var P = {}; // the single shared physics scope (== the old monolith closure)
|
|
|
|
var parts;
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
// Node: load submodules in dependency order (constants first, camera last)
|
|
parts = [
|
|
require('./constants/index.js'),
|
|
require('./state/index.js'),
|
|
require('./aim/index.js'),
|
|
require('./abilities/index.js'),
|
|
require('./damage/index.js'),
|
|
require('./step/index.js'),
|
|
require('./collision/index.js'),
|
|
require('./topple/index.js'),
|
|
require('./rules/index.js'),
|
|
require('./camera/index.js')
|
|
];
|
|
} else {
|
|
// browser: submodules already pushed their installers, in <script> order
|
|
parts = (typeof globalThis !== 'undefined' && globalThis.ISLE_PHYSICS_PARTS) || [];
|
|
}
|
|
|
|
for (var i = 0; i < parts.length; i++) parts[i](P);
|
|
|
|
// ------------------------------------------------------------------ API
|
|
// (kept key-for-key identical to the pre-S-2 core.js public surface)
|
|
|
|
return {
|
|
WORLD: P.WORLD,
|
|
VIEW: P.VIEW,
|
|
MATERIALS: P.MATERIALS,
|
|
BIRD_TYPES: P.BIRD_TYPES,
|
|
ENEMY_TYPES: P.ENEMY_TYPES,
|
|
GRAVITY: P.GRAVITY,
|
|
MAX_PULL: P.MAX_PULL,
|
|
MIN_PULL: P.MIN_PULL,
|
|
LAUNCH_POWER: P.LAUNCH_POWER,
|
|
BIRD_BONUS: P.BIRD_BONUS,
|
|
createGame: P.createGame,
|
|
activeBird: P.activeBird,
|
|
aimVector: P.aimVector,
|
|
trajectory: P.trajectory,
|
|
launch: P.launch,
|
|
triggerAbility: P.triggerAbility,
|
|
step: P.step,
|
|
starsFor: P.starsFor,
|
|
birdsRemaining: P.birdsRemaining,
|
|
AIR_DRAG: P.AIR_DRAG
|
|
};
|
|
});
|