This commit is contained in:
33333-33333 2026-06-28 13:40:41 +09:00
commit f500279abd
93 changed files with 1893 additions and 1198 deletions

View file

@ -167,7 +167,7 @@ function setBehavior(tarinai, fields = {}) {
const actionId = fields.actionId || fields.id || previousActionId || tarinai.state || "idle";
const action = fields.action || actionById(actionId) || null;
const need = fields.need || action?.need || previous.need || "fulfill";
const label = fields.label || fields.actionLabel || action?.label || previous.label || "行動している";
const label = fields.label || fields.actionLabel || action?.label || previous.label || "\u884c\u52d5\u3057\u3066\u3044\u308b";
const reason = fields.reason || fields.text || label;
const startedAt = Number.isFinite(fields.startedAt) ? fields.startedAt : (Number.isFinite(previous.startedAt) && previousActionId === actionId ? previous.startedAt : now);
const lockSeconds = Number(fields.lockSeconds ?? previous.lockSeconds ?? (action ? actionLockSeconds(action, tarinai) : 1.0)) || 1.0;
@ -219,7 +219,7 @@ function setBehaviorFromAction(tarinai, action, choice = {}, reasonText = "", op
action: action,
need: choice.need || action.need,
subNeed: options.subNeed || action.subNeed || "",
label: action.label || options.actionLabel || "行動している",
label: action.label || options.actionLabel || "\u884c\u52d5\u3057\u3066\u3044\u308b",
text: reasonText || action.label,
reason: reasonText || action.label,
target: options.target !== undefined ? options.target : tarinai?.target,
@ -387,7 +387,7 @@ function setBehaviorText(tarinai, { need = null, actionId = null, actionLabel =
const nextNeed = need || previousBehavior.need || "social";
const nextActionId = actionId || previousActionId || tarinai.state || "idle";
const displayReason = reasonText ?? reason;
const nextActionLabel = actionLabel || displayReason || previousBehavior.label || tarinai.state || "行動している";
const nextActionLabel = actionLabel || displayReason || previousBehavior.label || tarinai.state || "\u884c\u52d5\u3057\u3066\u3044\u308b";
const action = actionById(nextActionId);
const previousForced = behaviorIsForced(previousBehavior);
const preserveForced = Boolean(previousForced && source === "state" && (!actionId || previousActionId === nextActionId));
@ -395,7 +395,7 @@ function setBehaviorText(tarinai, { need = null, actionId = null, actionLabel =
const rawNeedsForText = tarinai.needRaw || tarinai.needs || {};
const existingTiedNeeds = (Array.isArray(previousBehavior.tiedNeeds) && previousBehavior.tiedNeeds.length ? [...previousBehavior.tiedNeeds] : [nextNeed])
.filter((key, idx) => idx === 0 || Number(rawNeedsForText?.[key] || 0) > 0.5);
if (existingTiedNeeds.some(key => key && key !== nextNeed) && !String(nextReasonText).includes("けど、")) {
if (existingTiedNeeds.some(key => key && key !== nextNeed) && !String(nextReasonText).includes("\u3051\u3069\u3001")) {
nextReasonText = buildReasonText(nextNeed, existingTiedNeeds, { ...(action || {}), id: nextActionId, label: nextActionLabel, subNeed: subNeed || action?.subNeed || "" }, tarinai, tarinai.world || null);
}
const nextForced = forced ?? preserveForced;
@ -440,8 +440,8 @@ function synchronizeActionTextFromState(tarinai) {
const catalogText = typeof window !== "undefined" && window.TEXT_CATALOG?.reasonLabel ? window.TEXT_CATALOG.reasonLabel(tarinai) : "";
if (state === "birth_ritual" || (tarinai.birthRitualTimer || 0) > 0.04) {
const partner = tarinai.world?.tarinai?.find?.(o => o && !o.dead && o.id === tarinai.birthPartnerId) || tarinai.target || null;
const label = partner?.name ? `${partner.name}\u3068へこへこしている` : "へこへこしている";
setBehaviorText(tarinai, { need: "social", actionId: "birth_ritual", actionLabel: "へこへこしている", reason: label, target: partner });
const label = partner?.name ? `${partner.name}\u3068\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b` : "\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b";
setBehaviorText(tarinai, { need: "social", actionId: "birth_ritual", actionLabel: "\u3078\u3053\u3078\u3053\u3057\u3066\u3044\u308b", reason: label, target: partner });
return;
}
if (state === "eat" || (tarinai.eatTimer || 0) > 0.04 || (tarinai.grassEatTimer || 0) > 0.04) {