removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -16,16 +16,16 @@ const NORMAL_POOP_MEAL_THRESHOLD = 3;
|
|||
function normalPoopUnitsFor(foodType = "", amount = 0, options = {}) {
|
||||
const type = String(foodType || "");
|
||||
if (type === "laxative" || options.laxative === true) return 0;
|
||||
if (typeof isServingFoodType === "function" && isServingFoodType(type)) return 1;
|
||||
if (isServingFoodType(type)) return 1;
|
||||
const value = Math.max(0, Number(amount) || 0);
|
||||
return value / 18;
|
||||
}
|
||||
function effectiveFoodRoleMatches(item, role) {
|
||||
const type = effectiveFoodTypeForItem(item);
|
||||
if (!type) return false;
|
||||
if (role === "food") return ["sweet", "food", "grass", "ant_corpse", "zunchi"].includes(type) || (typeof isServingFoodType === "function" && isServingFoodType(type));
|
||||
if (role === "food") return ["sweet", "food", "grass", "ant_corpse", "zunchi"].includes(type) || (isServingFoodType(type));
|
||||
if (role === "drink") return type === "water" || type === "zunda_juice";
|
||||
if (role === "medicine") return type === "sweet" || type === "water" || type === "zunda_juice" || type === "sleep_drug" || (typeof isParamEffectItemType === "function" && isParamEffectItemType(type));
|
||||
if (role === "medicine") return type === "sweet" || type === "water" || type === "zunda_juice" || type === "sleep_drug" || (isParamEffectItemType(type));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ function foodInteractionReach(tarinai, item, role = "food") {
|
|||
function foodPriorityRank(tarinai, item) {
|
||||
const type = effectiveFoodTypeForItem(item);
|
||||
if (!type) return -1;
|
||||
const need = typeof getTarinaiBehaviorNeed === "function" ? getTarinaiBehaviorNeed(tarinai) : tarinai?.behavior?.need;
|
||||
const need = getTarinaiBehaviorNeed(tarinai);
|
||||
const socialNeed = Number(tarinai?.needRaw?.social ?? tarinai?.needs?.social ?? 0) || 0;
|
||||
const healthNeed = Number(tarinai?.needRaw?.health ?? tarinai?.needs?.health ?? 0) || 0;
|
||||
if (type === "sweet") return 4300 + Math.min(120, Math.max(0, healthNeed - 40) * 3);
|
||||
|
|
@ -71,9 +71,9 @@ function foodPriorityRank(tarinai, item) {
|
|||
if (type === "love_mochi") return 3340 + Math.min(120, Math.max(0, socialNeed - 45) * 3);
|
||||
if (type === "fight_mochi") return 3280 + Math.min(90, Math.max(0, Number(tarinai?.fightMochiTimer || 0)) * 3);
|
||||
if (type === "sleep_drug") return need === "sleep" ? 3380 : 3220;
|
||||
if (typeof isParamEffectItemType === "function" && isParamEffectItemType(type)) return 3260 + Math.min(120, Math.max(0, healthNeed - 45) * 3);
|
||||
if (isParamEffectItemType(type)) return 3260 + Math.min(120, Math.max(0, healthNeed - 45) * 3);
|
||||
if (type === "food" || type === "ant_corpse") return 3300;
|
||||
if (typeof isServingFoodType === "function" && isServingFoodType(type)) return 3300;
|
||||
if (isServingFoodType(type)) return 3300;
|
||||
if (type === "grass") {
|
||||
const hunger = Number(tarinai?.hunger || 0) || 0;
|
||||
const foodNeed = Number(tarinai?.needRaw?.food ?? tarinai?.needs?.food ?? 0) || 0;
|
||||
|
|
@ -103,7 +103,7 @@ function hasBetterFoodThanZunchiNearby(tarinai, world, maxDist = 180) {
|
|||
if (tarinai.shouldAvoidTarget?.(it)) continue;
|
||||
const type = effectiveFoodTypeForItem(it);
|
||||
if (!type) continue;
|
||||
if (["sweet", "food", "grass", "water", "zunda_juice", "ant_corpse"].includes(type) || (typeof isServingFoodType === "function" && isServingFoodType(type))) {
|
||||
if (["sweet", "food", "grass", "water", "zunda_juice", "ant_corpse"].includes(type) || (isServingFoodType(type))) {
|
||||
if (it.type === "grass" && (it.amount || 0) <= 0) continue;
|
||||
if (typeof tarinai.foodItemHasServingLeft === "function" && ["sweet", "food", "zunda_juice"].includes(type) && !tarinai.foodItemHasServingLeft(it)) continue;
|
||||
return true;
|
||||
|
|
@ -153,7 +153,7 @@ function findNearestItemWithRole(world, tarinai, role, maxDist = 520) {
|
|||
if (!roleMatches(item, role)) continue;
|
||||
if (role === "food" && typeof tarinai?.foodItemHasServingLeft === "function") {
|
||||
const type = effectiveFoodTypeForItem(item);
|
||||
if ((item.type === "duplicator" || (typeof isServingFoodType === "function" && isServingFoodType(type))) && !tarinai.foodItemHasServingLeft(item)) continue;
|
||||
if ((item.type === "duplicator" || (isServingFoodType(type))) && !tarinai.foodItemHasServingLeft(item)) continue;
|
||||
if (item.type === "grass" && (Number(item.amount || 0) || 0) <= 0) continue;
|
||||
if (item.type === "zunchi" && (Number(item.amount || 0) || 0) <= 0) continue;
|
||||
}
|
||||
|
|
@ -172,19 +172,19 @@ function findNearestItemWithRole(world, tarinai, role, maxDist = 520) {
|
|||
}
|
||||
|
||||
function sleepPlaceAvailableFor(world, tarinai, item) {
|
||||
return globalThis.TarinaiNestSleepSystem?.sleepPlaceAvailableFor?.(world, tarinai, item) || false;
|
||||
return globalThis.TarinaiNestSleepSystem.sleepPlaceAvailableFor(world, tarinai, item) || false;
|
||||
}
|
||||
|
||||
function nearestSleepPlaceOfType(world, tarinai, type, maxDist = 520) {
|
||||
return globalThis.TarinaiNestSleepSystem?.nearestSleepPlaceOfType?.(world, tarinai, type, maxDist) || null;
|
||||
return globalThis.TarinaiNestSleepSystem.nearestSleepPlaceOfType(world, tarinai, type, maxDist) || null;
|
||||
}
|
||||
|
||||
function findPrioritySleepPlaceBeforeGrassBedBuild(world, tarinai, maxDist = 520) {
|
||||
return globalThis.TarinaiNestSleepSystem?.findPrioritySleepPlaceBeforeGrassBedBuild?.(world, tarinai, maxDist) || null;
|
||||
return globalThis.TarinaiNestSleepSystem.findPrioritySleepPlaceBeforeGrassBedBuild(world, tarinai, maxDist) || null;
|
||||
}
|
||||
|
||||
function findNearestSleepPlace(world, tarinai, maxDist = 520) {
|
||||
return globalThis.TarinaiNestSleepSystem?.findNearestSleepPlace?.(world, tarinai, maxDist) || null;
|
||||
return globalThis.TarinaiNestSleepSystem.findNearestSleepPlace(world, tarinai, maxDist) || null;
|
||||
}
|
||||
|
||||
function findNearbyDanger(world, tarinai, maxDist = 150) {
|
||||
|
|
@ -316,7 +316,7 @@ function findUnownedStructure(world, tarinai, type = "", maxDist = Infinity) {
|
|||
function consumeGrassMaterial(material, stages = 1) {
|
||||
if (!material) return false;
|
||||
const steps = Math.max(1, Math.floor(Number(stages) || 1));
|
||||
const consumed = window.TarinaiGrass?.regress?.(material, steps) ?? 0;
|
||||
const consumed = window.TarinaiGrass.regress(material, steps) ?? 0;
|
||||
if (!(consumed > 0)) return false;
|
||||
material.eatenAmount = (material.eatenAmount || 0) + consumed;
|
||||
material.world?.markTerrainDirty?.("grass-material-consumed");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue