p
This commit is contained in:
parent
d14550dad6
commit
63e10af865
86 changed files with 5400 additions and 1209 deletions
|
|
@ -187,6 +187,7 @@
|
|||
target.pinchThoughtTimer = Math.max(target.pinchThoughtTimer || 0, 1.2);
|
||||
} else {
|
||||
if (isPinType(target.type) && target.pinState === "lodged") global.TarinaiItemDynamicPinSystem.detach(target, world, "pinch");
|
||||
if (target.achievementBurstOwnerId) target.achievementBurstNeverStopped = false;
|
||||
target.dropTimer = 0;
|
||||
target.dropMax = 0;
|
||||
target.dropImpactDone = true;
|
||||
|
|
@ -199,6 +200,7 @@
|
|||
if (options.notifyNoTarget) showToast("\u3064\u307e\u3081\u308b\u5bfe\u8c61\u304c\u3042\u308a\u307e\u305b\u3093\u3002");
|
||||
return false;
|
||||
}
|
||||
global.TarinaiAchievements?.recordIntervention?.({ world, tool: "pinch", target });
|
||||
global.TarinaiHistory.capture(world, "pinch");
|
||||
audio.grab?.();
|
||||
uiCache.grabbing = true;
|
||||
|
|
@ -249,14 +251,12 @@
|
|||
const beforeX = Number(target.x || 0) || 0;
|
||||
const beforeY = Number(target.y || 0) || 0;
|
||||
const pad = target.radius || target.r || 16;
|
||||
if (uiCache.grabKind === "tarinai" && !p.inside) {
|
||||
const raw = clientToWorldRaw(clientX, clientY);
|
||||
target.x = raw.x;
|
||||
target.y = raw.y;
|
||||
} else {
|
||||
target.x = clamp(p.x, CONFIG.worldPadding + pad * 0.15, world.w - CONFIG.worldPadding - pad * 0.15);
|
||||
target.y = clamp(p.y, CONFIG.worldPadding + pad * 0.15, world.h - CONFIG.worldPadding - pad * 0.15);
|
||||
let desired = (uiCache.grabKind === "tarinai" && !p.inside) ? clientToWorldRaw(clientX, clientY) : { x: p.x, y: p.y };
|
||||
if (String(world.toolPickMode || "free") !== "free") {
|
||||
desired = global.TarinaiPlacementPreviewSystem?.snapPoint?.(world, desired.x, desired.y) || desired;
|
||||
}
|
||||
target.x = clamp(desired.x, CONFIG.worldPadding + pad * 0.15, world.w - CONFIG.worldPadding - pad * 0.15);
|
||||
target.y = clamp(desired.y, CONFIG.worldPadding + pad * 0.15, world.h - CONFIG.worldPadding - pad * 0.15);
|
||||
const movedX = (Number(target.x || 0) || 0) - beforeX;
|
||||
const movedY = (Number(target.y || 0) || 0) - beforeY;
|
||||
if (uiCache.grabKind === "item" && target.type === "reciprocator") {
|
||||
|
|
@ -278,6 +278,11 @@
|
|||
target._lastHeldByPlayerAt = world.time || 0;
|
||||
target.goIdle?.("\u3064\u307e\u307e\u308c\u3066\u3044\u308b");
|
||||
if (options.touch) target.pinchThoughtTimer = Math.max(target.pinchThoughtTimer || 0, 0.8);
|
||||
} else if (String(world.toolPickMode || "free") !== "free") {
|
||||
target.vx = 0;
|
||||
target.vy = 0;
|
||||
uiCache.grabVelocityX = 0;
|
||||
uiCache.grabVelocityY = 0;
|
||||
} else {
|
||||
target.vx = clamp(uiCache.grabVelocityX || dx * 16, -820, 820);
|
||||
target.vy = clamp(uiCache.grabVelocityY || dy * 16, -820, 820);
|
||||
|
|
@ -317,8 +322,9 @@
|
|||
: null;
|
||||
directlyGiven = Boolean(result);
|
||||
if (!directlyGiven) {
|
||||
const releaseVx = clamp(Number(uiCache.grabVelocityX || target.vx || 0) || 0, -900, 900);
|
||||
const releaseVy = clamp(Number(uiCache.grabVelocityY || target.vy || 0) || 0, -900, 900);
|
||||
const gridRelease = String(world.toolPickMode || "free") !== "free";
|
||||
const releaseVx = gridRelease ? 0 : clamp(Number(uiCache.grabVelocityX || target.vx || 0) || 0, -900, 900);
|
||||
const releaseVy = gridRelease ? 0 : clamp(Number(uiCache.grabVelocityY || target.vy || 0) || 0, -900, 900);
|
||||
const releaseSpeed = Math.hypot(releaseVx, releaseVy);
|
||||
if (target.type === "plushie" && typeof target.fling === "function") {
|
||||
const sourceX = Number(uiCache.grabLastWorldX ?? target.x) || target.x;
|
||||
|
|
@ -589,7 +595,18 @@
|
|||
setGiveHover(giveTarget);
|
||||
if (world.hoverGrabTarget) { world.hoverGrabTarget = null; world.drawListDirty = true; }
|
||||
if (world.hoverDeleteTarget) { world.hoverDeleteTarget = null; world.drawListDirty = true; }
|
||||
if (world.hoverPokeTarget) { world.hoverPokeTarget = null; world.drawListDirty = true; }
|
||||
canvas.style.cursor = "pointer";
|
||||
} else if (world.tool === "poke" && p.inside && inactivePointerAction) {
|
||||
setGiveHover(null);
|
||||
const target = world.findPokeTargetAt ? world.findPokeTargetAt(p.x, p.y) : null;
|
||||
if (world.hoverPokeTarget !== target) {
|
||||
world.hoverPokeTarget = target || null;
|
||||
world.drawListDirty = true;
|
||||
}
|
||||
if (world.hoverGrabTarget) { world.hoverGrabTarget = null; world.drawListDirty = true; }
|
||||
if (world.hoverDeleteTarget) { world.hoverDeleteTarget = null; world.drawListDirty = true; }
|
||||
canvas.style.cursor = target ? "pointer" : "default";
|
||||
} else if (world.tool === "pinch" && p.inside && inactivePointerAction) {
|
||||
setGiveHover(null);
|
||||
const target = world.findGrabTargetAt ? world.findGrabTargetAt(p.x, p.y) : null;
|
||||
|
|
@ -598,6 +615,7 @@
|
|||
world.drawListDirty = true;
|
||||
}
|
||||
if (world.hoverDeleteTarget) { world.hoverDeleteTarget = null; world.drawListDirty = true; }
|
||||
if (world.hoverPokeTarget) { world.hoverPokeTarget = null; world.drawListDirty = true; }
|
||||
canvas.style.cursor = target ? "grab" : "default";
|
||||
} else if (world.tool === "delete" && p.inside && inactivePointerAction) {
|
||||
setGiveHover(null);
|
||||
|
|
@ -607,6 +625,7 @@
|
|||
world.drawListDirty = true;
|
||||
}
|
||||
if (world.hoverGrabTarget) { world.hoverGrabTarget = null; world.drawListDirty = true; }
|
||||
if (world.hoverPokeTarget) { world.hoverPokeTarget = null; world.drawListDirty = true; }
|
||||
canvas.style.cursor = target ? "pointer" : "default";
|
||||
} else {
|
||||
setGiveHover(null);
|
||||
|
|
@ -618,6 +637,10 @@
|
|||
world.hoverDeleteTarget = null;
|
||||
world.drawListDirty = true;
|
||||
}
|
||||
if (world.hoverPokeTarget) {
|
||||
world.hoverPokeTarget = null;
|
||||
world.drawListDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -640,6 +663,7 @@
|
|||
world.hoverGrabTarget = null;
|
||||
world.hoverDeleteTarget = null;
|
||||
world.hoverGiveTarget = null;
|
||||
world.hoverPokeTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue