removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -53,7 +53,7 @@
|
|||
root.dataset.lastActivateAt = String(now);
|
||||
e.preventDefault?.();
|
||||
e.stopPropagation?.();
|
||||
window.TarinaiTooltips?.hide?.();
|
||||
window.TarinaiTooltips.hide();
|
||||
audio.uiClick?.();
|
||||
setMobileInputMode(btn.dataset.mobileMode || "auto");
|
||||
showToast(`\u30b9\u30de\u30db\u64cd\u4f5c: ${btn.textContent || btn.dataset.mobileMode}`);
|
||||
|
|
@ -92,7 +92,6 @@
|
|||
}
|
||||
|
||||
function screenToWorldEvent(e) {
|
||||
if (typeof screenToWorld === "function") return screenToWorld(e);
|
||||
return screenToWorldClient(e.clientX, e.clientY);
|
||||
}
|
||||
|
||||
|
|
@ -148,26 +147,26 @@
|
|||
|
||||
function syncGrabbedPhysicsItem(target, reason = "pinch-move") {
|
||||
if (!target || target.dead) return false;
|
||||
const pb = (typeof window !== "undefined" ? window : globalThis).TarinaiPhysicsBodySystem;
|
||||
if (!pb?.isBodyType?.(target.type)) return false;
|
||||
pb.syncPoseFromItem?.(target);
|
||||
pb.setScalar?.(target, "awakeUntil", Math.max(Number(pb.scalar?.(target, "awakeUntil", 0) || 0), (world.time || 0) + 0.65), reason);
|
||||
pb.markBodyChanged?.(target, reason);
|
||||
(typeof window !== "undefined" ? window : globalThis).TarinaiMechanicalSystem?.invalidateGeometry?.(target);
|
||||
const pb = global.TarinaiPhysicsBodySystem;
|
||||
if (!pb.isBodyType(target.type)) return false;
|
||||
pb.syncPoseFromItem(target);
|
||||
pb.setScalar(target, "awakeUntil", Math.max(Number(pb.scalar(target, "awakeUntil", 0) || 0), (world.time || 0) + 0.65), reason);
|
||||
pb.markBodyChanged(target, reason);
|
||||
global.TarinaiMechanicalSystem.invalidateGeometry(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
function prepareGrabTarget(target) {
|
||||
if (uiCache.grabKind === "tarinai") {
|
||||
const lodged = target.currentLodgedPin?.() || (world.items || []).find(it => it && isPinType(it.type) && it.pinState === "lodged" && it.pinTargetId === target.id);
|
||||
if (lodged?.detachPushpin) lodged.detachPushpin(world, "pinch");
|
||||
if (lodged) global.TarinaiItemDynamicPinSystem.detach(lodged, world, "pinch");
|
||||
target.sleeping = false;
|
||||
if (target.state === "sleep" || target.state === "seek_bed") target.goIdle?.("\u3064\u307e\u307e\u308c\u3066\u3044\u308b");
|
||||
target.surpriseTimer = Math.max(target.surpriseTimer || 0, 0.18);
|
||||
target.thought = "\u3064\u307e\u307e\u308c\u3066\u3044\u308b";
|
||||
target.pinchThoughtTimer = Math.max(target.pinchThoughtTimer || 0, 1.2);
|
||||
} else {
|
||||
if (isPinType(target.type) && target.pinState === "lodged" && target.detachPushpin) target.detachPushpin(world, "pinch");
|
||||
if (isPinType(target.type) && target.pinState === "lodged") global.TarinaiItemDynamicPinSystem.detach(target, world, "pinch");
|
||||
target.dropTimer = 0;
|
||||
target.dropMax = 0;
|
||||
target.dropImpactDone = true;
|
||||
|
|
@ -180,7 +179,7 @@
|
|||
if (options.notifyNoTarget) showToast("\u3064\u307e\u3081\u308b\u5bfe\u8c61\u304c\u3042\u308a\u307e\u305b\u3093\u3002");
|
||||
return false;
|
||||
}
|
||||
global.TarinaiHistory?.capture?.(world, "pinch");
|
||||
global.TarinaiHistory.capture(world, "pinch");
|
||||
audio.grab?.();
|
||||
uiCache.grabbing = true;
|
||||
uiCache.grabMoved = false;
|
||||
|
|
@ -196,12 +195,9 @@
|
|||
uiCache.grabStartY = clientY || 0;
|
||||
target.playerHeld = true;
|
||||
target._heldByPlayer = true;
|
||||
target._playerGrabStartedAt = world.time || 0;
|
||||
if (uiCache.grabKind === "item") syncGrabbedPhysicsItem(target, "pinch-start");
|
||||
if (target.type === "duplicator") {
|
||||
target.duplicatorLoadSuppressedUntil = Math.max(target.duplicatorLoadSuppressedUntil || 0, (world.time || 0) + 1.0);
|
||||
target._duplicatorCandidateKey = "";
|
||||
target._duplicatorCandidateSince = 0;
|
||||
}
|
||||
prepareGrabTarget(target);
|
||||
if (options.touchMode) uiCache.touchMode = options.touchMode;
|
||||
|
|
@ -297,11 +293,8 @@
|
|||
if (uiCache.grabKind === "item") syncGrabbedPhysicsItem(target, "pinch-release");
|
||||
target.playerHeld = false;
|
||||
target._heldByPlayer = false;
|
||||
target._lastPlayerReleasedAt = world.time || 0;
|
||||
if (target.type === "duplicator") {
|
||||
target.duplicatorLoadSuppressedUntil = Math.max(target.duplicatorLoadSuppressedUntil || 0, (world.time || 0) + 1.2);
|
||||
target._duplicatorCandidateKey = "";
|
||||
target._duplicatorCandidateSince = 0;
|
||||
}
|
||||
}
|
||||
audio.drop?.();
|
||||
|
|
@ -319,7 +312,7 @@
|
|||
}
|
||||
|
||||
function beginHose(p, clientX, clientY, options = {}) {
|
||||
global.TarinaiHistory?.capture?.(world, "water-hose");
|
||||
global.TarinaiHistory.capture(world, "water-hose");
|
||||
audio.waterHose?.();
|
||||
uiCache.hosing = true;
|
||||
uiCache.hoseMoved = false;
|
||||
|
|
@ -366,22 +359,11 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
function shootAimPoint() {
|
||||
return world.shootAimPoint?.() || { x: world.pointer?.x || 0, y: world.pointer?.y || 0, inside: Boolean(world.pointer?.inside) };
|
||||
}
|
||||
|
||||
function updateShootHoverTarget(point = null) {
|
||||
// \u5c04\u6483\u30c4\u30fc\u30eb\u306f\u7167\u6e96\u3060\u3051\u3092\u8868\u793a\u3057\u3001\u5bfe\u8c61\u30cf\u30a4\u30e9\u30a4\u30c8\u306f\u51fa\u3055\u306a\u3044\u3002
|
||||
if (world.hoverShootTarget) {
|
||||
world.hoverShootTarget = null;
|
||||
world.drawListDirty = true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function beginShoot(p, clientX, clientY, options = {}) {
|
||||
if (!p?.inside) return false;
|
||||
global.TarinaiHistory?.capture?.(world, "shoot");
|
||||
global.TarinaiHistory.capture(world, "shoot");
|
||||
uiCache.shooting = true;
|
||||
uiCache.shootMoved = false;
|
||||
uiCache.shootSuppressClick = true;
|
||||
|
|
@ -396,7 +378,6 @@
|
|||
world.setShootCursorFromPointer?.(p);
|
||||
uiCache.shootLastRawWorldX = p.x;
|
||||
uiCache.shootLastRawWorldY = p.y;
|
||||
updateShootHoverTarget();
|
||||
uiCache.shootFired = Boolean(world.fireShootTool?.()) || Boolean(uiCache.shootFired);
|
||||
if (options.touchMode) uiCache.touchMode = options.touchMode;
|
||||
if (uiCache.shootHoldTimer) clearInterval(uiCache.shootHoldTimer);
|
||||
|
|
@ -429,7 +410,6 @@
|
|||
uiCache.shootMoved = true;
|
||||
if (options.touch) uiCache.touchMoved = true;
|
||||
}
|
||||
updateShootHoverTarget();
|
||||
canvas.style.cursor = "none";
|
||||
render();
|
||||
return true;
|
||||
|
|
@ -444,7 +424,6 @@
|
|||
}
|
||||
if (uiCache.shootFired) audio.boltAction?.();
|
||||
uiCache.shootFired = false;
|
||||
updateShootHoverTarget();
|
||||
canvas.style.cursor = cursorForTool(world.tool);
|
||||
renderStats();
|
||||
return true;
|
||||
|
|
@ -452,13 +431,11 @@
|
|||
|
||||
|
||||
function beginAreaDelete(p, clientX, clientY, options = {}) {
|
||||
global.TarinaiHistory?.capture?.(world, "area-delete");
|
||||
global.TarinaiHistory.capture(world, "area-delete");
|
||||
uiCache.areaDeleting = true;
|
||||
uiCache.areaDeleteMoved = false;
|
||||
uiCache.areaDeleteStartX = clientX;
|
||||
uiCache.areaDeleteStartY = clientY;
|
||||
uiCache.areaDeleteLastWorldX = p.x;
|
||||
uiCache.areaDeleteLastWorldY = p.y;
|
||||
world._areaDeleteDragRemoved = 0;
|
||||
if (p.inside) world.deleteItemsInArea?.(p.x, p.y, { silentEmpty: true, silentLog: true, drag: true });
|
||||
if (options.touchMode) uiCache.touchMode = options.touchMode;
|
||||
|
|
@ -550,8 +527,7 @@
|
|||
world.shootPointerRawX = p.x;
|
||||
world.shootPointerRawY = p.y;
|
||||
}
|
||||
updateShootHoverTarget();
|
||||
canvas.style.cursor = "none";
|
||||
canvas.style.cursor = "none";
|
||||
} else if (world.tool === "pinch" && p.inside && !uiCache.grabbing && !uiCache.panning && !uiCache.hosing && !uiCache.areaDeleting && !uiCache.shooting) {
|
||||
const target = world.findGrabTargetAt ? world.findGrabTargetAt(p.x, p.y) : null;
|
||||
if (world.hoverGrabTarget !== target) {
|
||||
|
|
@ -577,10 +553,6 @@
|
|||
world.hoverDeleteTarget = null;
|
||||
world.drawListDirty = true;
|
||||
}
|
||||
if (world.hoverShootTarget) {
|
||||
world.hoverShootTarget = null;
|
||||
world.drawListDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -602,7 +574,6 @@
|
|||
if (world) {
|
||||
world.hoverGrabTarget = null;
|
||||
world.hoverDeleteTarget = null;
|
||||
world.hoverShootTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue