removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -15,7 +15,7 @@ function behaviorTargetId(target = null) {
|
|||
|
||||
function currentBehaviorTarget(tarinai, behavior = null) {
|
||||
if (!tarinai) return null;
|
||||
const b = behavior || (typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai.behavior) || null;
|
||||
const b = behavior || (currentTarinaiBehavior(tarinai)) || null;
|
||||
if (!b) return tarinai.target || null;
|
||||
const ref = b.target || null;
|
||||
const id = ref?.id || b.targetId || null;
|
||||
|
|
@ -128,12 +128,12 @@ function behaviorIsForced(behavior = null) {
|
|||
}
|
||||
|
||||
function isCurrentBehaviorForced(tarinai) {
|
||||
return behaviorIsForced(typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai?.behavior);
|
||||
return behaviorIsForced(currentTarinaiBehavior(tarinai));
|
||||
}
|
||||
|
||||
function currentForcedBehaviorRequest(tarinai) {
|
||||
if (typeof getTarinaiForcedBehavior === "function") return getTarinaiForcedBehavior(tarinai);
|
||||
const b = typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai?.behavior;
|
||||
const b = currentTarinaiBehavior(tarinai);
|
||||
return behaviorIsForced(b) ? (b.forcedRequest || { uid: b.forcedId || "", id: b.actionId || "", source: b.data?.forcedSource || b.source || "external", priority: Number(b.priority || 0) || 0 }) : null;
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ function clearForcedBehaviorQueue(tarinai, predicate = null) {
|
|||
}
|
||||
|
||||
function behaviorText(tarinai) {
|
||||
const b = typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai?.behavior;
|
||||
const b = currentTarinaiBehavior(tarinai);
|
||||
if (!b) return "";
|
||||
const state = String(tarinai.state || "");
|
||||
const timerActive = (tarinai.birthRitualTimer || 0) > 0.04 || (tarinai.fightTimer || 0) > 0.04 || (tarinai.eatTimer || 0) > 0.04 || (tarinai.intimidateTimer || 0) > 0.04 || (tarinai.fearTimer || 0) > 0.04;
|
||||
|
|
@ -162,7 +162,7 @@ function behaviorText(tarinai) {
|
|||
function setBehavior(tarinai, fields = {}) {
|
||||
if (!tarinai || tarinai.dead) return null;
|
||||
const now = tarinai.world?.time || 0;
|
||||
const previous = (typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai.behavior) || {};
|
||||
const previous = (currentTarinaiBehavior(tarinai)) || {};
|
||||
const previousActionId = previous.actionId || "";
|
||||
const actionId = fields.actionId || fields.id || previousActionId || tarinai.state || "idle";
|
||||
const action = fields.action || actionById(actionId) || null;
|
||||
|
|
@ -241,8 +241,7 @@ function setBehaviorFromAction(tarinai, action, choice = {}, reasonText = "", op
|
|||
|
||||
function clearBehavior(tarinai, reason = "") {
|
||||
if (!tarinai) return;
|
||||
if (typeof clearTarinaiBehavior === "function") clearTarinaiBehavior(tarinai, { reason });
|
||||
else tarinai.behavior = null;
|
||||
clearTarinaiBehavior(tarinai, { reason });
|
||||
if (reason) tarinai.thought = reason;
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +261,7 @@ function queueForcedTarinaiBehavior(tarinai, actionId, opts = {}) {
|
|||
|
||||
function completeForcedBehavior(tarinai, behavior = null, status = "completed") {
|
||||
if (!tarinai) return false;
|
||||
const b = behavior || (typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai.behavior) || {};
|
||||
const b = behavior || (currentTarinaiBehavior(tarinai)) || {};
|
||||
const forcedId = b.forcedId || "";
|
||||
if (!forcedId) return false;
|
||||
const queue = forcedBehaviorQueueOf(tarinai);
|
||||
|
|
@ -275,7 +274,7 @@ function completeForcedBehavior(tarinai, behavior = null, status = "completed")
|
|||
|
||||
function retryForcedBehavior(tarinai, behavior = null, reason = "retry") {
|
||||
if (!tarinai) return false;
|
||||
const b = behavior || (typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai.behavior) || {};
|
||||
const b = behavior || (currentTarinaiBehavior(tarinai)) || {};
|
||||
const forcedId = b.forcedId || "";
|
||||
if (!forcedId) return false;
|
||||
const now = tarinai.world?.time || 0;
|
||||
|
|
@ -300,7 +299,7 @@ function processForcedBehaviorQueue(tarinai, world, needs) {
|
|||
}
|
||||
|
||||
// \u5b9f\u884c\u4e2d\u306e\u5f37\u5236\u884c\u52d5\u306f\u30ad\u30e5\u30fc\u306b\u6b8b\u3057\u3001\u5b8c\u4e86/\u5931\u6557/\u671f\u9650\u5207\u308c\u307e\u3067\u52b9\u679c\u3092\u4fdd\u6301\u3059\u308b\u3002
|
||||
const activeQueueBehavior = typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai.behavior;
|
||||
const activeQueueBehavior = currentTarinaiBehavior(tarinai);
|
||||
const activeForcedId = activeQueueBehavior?.forcedId || "";
|
||||
for (const entry of queue) {
|
||||
if (!entry.uid) entry.uid = `${entry.id}:${entry.source || "external"}:${entry.createdAt || now}:${Math.random().toString(36).slice(2, 8)}`;
|
||||
|
|
@ -386,7 +385,7 @@ function effectCauseTextLooksStale(text = "") {
|
|||
function setBehaviorText(tarinai, { need = null, actionId = null, actionLabel = null, reasonText = null, reason = null, target = undefined, subNeed = "", phase = "active", source = "state", forced = null, forcedId = "", sourceReasonText = "", forcedReasonText = "", causeText = "" } = {}) {
|
||||
if (!tarinai) return;
|
||||
const now = tarinai.world?.time || 0;
|
||||
const previousBehavior = (typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai.behavior) || {};
|
||||
const previousBehavior = (currentTarinaiBehavior(tarinai)) || {};
|
||||
const previousActionId = previousBehavior.actionId || "";
|
||||
const nextNeed = need || previousBehavior.need || "social";
|
||||
const nextActionId = actionId || previousActionId || tarinai.state || "idle";
|
||||
|
|
@ -467,6 +466,6 @@ function synchronizeActionTextFromState(tarinai) {
|
|||
return;
|
||||
}
|
||||
if (state === "sleep" || tarinai.sleeping) {
|
||||
setBehaviorText(tarinai, { need: "sleep", actionId: (typeof getTarinaiBehaviorId === "function" ? getTarinaiBehaviorId(tarinai) : tarinai.behavior?.actionId) || "sleep_anywhere", actionLabel: "\u7720\u3063\u3066\u3044\u308b", reason: catalogText || "\u7720\u3063\u3066\u3044\u308b" });
|
||||
setBehaviorText(tarinai, { need: "sleep", actionId: (getTarinaiBehaviorId(tarinai)) || "sleep_anywhere", actionLabel: "\u7720\u3063\u3066\u3044\u308b", reason: catalogText || "\u7720\u3063\u3066\u3044\u308b" });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue