stable
This commit is contained in:
parent
86226ccc94
commit
077d4ab9ac
71 changed files with 2905 additions and 1063 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Layer: entity-runtime/items/dynamic-system
|
||||
// Owns ball item motion and obstacle bounce behavior. Item.prototype ball
|
||||
// methods are compatibility facades that delegate to this system.
|
||||
// methods delegate to this system.
|
||||
(function (global) {
|
||||
function update(item, dt, worldRef) {
|
||||
if (!item || item.dead || item.type !== "ball") return false;
|
||||
|
|
@ -36,12 +36,12 @@
|
|||
const searchRadius = Math.max(150, (item.r || 18) + speed * Math.max(dt || 0.016, 0.016) + 120);
|
||||
const items = worldRef.nearbyItems(item.x, item.y, searchRadius) || [];
|
||||
const seen = new Set(items);
|
||||
// 回転体は大きな輪郭を設計できるため、中心が近傍セル外でも当たる可能性がある。
|
||||
// 中心ではなく外接半径で追加走査して、長い棒・大きな円形にも衝突させる。
|
||||
// 大きな機構は中心が近傍セル外でも当たる可能性がある。
|
||||
// 中心ではなく外接半径で追加走査して、長い棒・往復幅にも衝突させる。
|
||||
if (Array.isArray(worldRef.items)) {
|
||||
for (const it of worldRef.items) {
|
||||
if (!it || it.dead || it === item || it.type !== "rotator" || seen.has(it)) continue;
|
||||
const reach = worldRef.rotatorExtent?.(it) || Math.max(64, it.r || 64);
|
||||
if (!it || it.dead || it === item || !global.TarinaiMechanicalSystem?.isMechanicalType?.(it.type) || seen.has(it)) continue;
|
||||
const reach = global.TarinaiMechanicalSystem?.reach?.(it) || worldRef.rotatorExtent?.(it) || Math.max(64, it.r || 64);
|
||||
if (distXY(item.x, item.y, it.x, it.y) <= searchRadius + reach + 36) {
|
||||
items.push(it);
|
||||
seen.add(it);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue