This commit is contained in:
33333-33333 2026-07-11 21:13:39 +09:00
commit d14550dad6
78 changed files with 2827 additions and 563 deletions

View file

@ -15,7 +15,7 @@ const NORMAL_POOP_MEAL_THRESHOLD = 4;
function normalPoopUnitsFor(foodType = "", amount = 0, options = {}) {
const type = String(foodType || "");
if (type === "laxative" || options.laxative === true) return 0;
if (type === "laxative" || type === "first_aid" || options.laxative === true) return 0;
if (isServingFoodType(type)) return 1;
const value = Math.max(0, Number(amount) || 0);
return value / 18;
@ -171,9 +171,9 @@ function findNearestItemWithRole(world, tarinai, role, maxDist = 520) {
};
if (Array.isArray(primary)) for (const it of primary) addCandidate(it);
// 食料・水・薬は、生成直後/移動直後の spatial cache 漏れにも耐える。
// item type buckets が使える場合は role ごとの型だけを見ることで、
// crowded world で毎回 world.items 全体を足す経路を避ける。
// \u98df\u6599\u30fb\u6c34\u30fb\u85ac\u306f\u3001\u751f\u6210\u76f4\u5f8c/\u79fb\u52d5\u76f4\u5f8c\u306e spatial cache \u6f0f\u308c\u306b\u3082\u8010\u3048\u308b\u3002
// item type buckets \u304c\u4f7f\u3048\u308b\u5834\u5408\u306f role \u3054\u3068\u306e\u578b\u3060\u3051\u3092\u898b\u308b\u3053\u3068\u3067\u3001
// crowded world \u3067\u6bce\u56de world.items \u5168\u4f53\u3092\u8db3\u3059\u7d4c\u8def\u3092\u907f\u3051\u308b\u3002
if (foodLikeRole) {
if (world?.itemsOfType) {
for (const type of foodRoleSearchTypes(role)) for (const it of world.itemsOfType(type) || []) addCandidate(it);