1.6
This commit is contained in:
parent
ee22e1a929
commit
88f618cadf
55 changed files with 1299 additions and 447 deletions
|
|
@ -56,6 +56,7 @@
|
|||
if (d > maxDist) continue;
|
||||
const padding = Math.max(16, (tarinai.radius || 20) * 0.72);
|
||||
if (typeof worldRef.targetBlockedByObstacle === "function" && worldRef.targetBlockedByObstacle(tarinai, item, padding)) continue;
|
||||
if (typeof worldRef.sleepPlaceAvailableFor === "function" && !worldRef.sleepPlaceAvailableFor(tarinai, item)) continue;
|
||||
const occupants = typeof worldRef.nestBoxOccupants === "function" ? worldRef.nestBoxOccupants(item, Infinity) : [];
|
||||
const capacity = typeof worldRef.nestBoxCapacity === "function" ? worldRef.nestBoxCapacity(item) : 5;
|
||||
const fullnessPenalty = Math.max(0, occupants.length - capacity + 1) * 18;
|
||||
|
|
@ -97,7 +98,7 @@
|
|||
avoider.thought = TARINAI_KING_FLEE_REASON;
|
||||
avoider.fearTimer = Math.max(avoider.fearTimer || 0, 1.05 * avoider.personalityProfile().fear);
|
||||
if (nest && distXY(avoider.x, avoider.y, nest.x, nest.y) <= Math.max(50, (avoider.radius || 20) + (nest.r || 24) + 18)) {
|
||||
avoider.enterNestBox?.(nest, dt, { forceDisplace: true, reason: TARINAI_KING_FLEE_REASON });
|
||||
avoider.enterNestBox?.(nest, dt, { forceDisplace: false, reason: TARINAI_KING_FLEE_REASON });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -323,7 +324,7 @@
|
|||
this.energy = clamp(this.energy + dt * (this.target ? 1.8 + bedComfort * 1.35 : 2.1), 0, typeof tarinaiMaxEnergy === "function" ? tarinaiMaxEnergy(this) : (Number(this.maxEnergy) || 100));
|
||||
if (crowdedSleep && typeof applyNeedShock === "function") applyNeedShock(this, { safety: dt * Math.max(1, bedCrowd - 5) });
|
||||
const sleepHungerScale = this.metabolicHungerMultiplier ? this.metabolicHungerMultiplier() : (typeof tarinaiMetabolicHungerScale === "function" ? tarinaiMetabolicHungerScale(this) : 1);
|
||||
this.hunger = clamp(this.hunger + dt * 0.018 * sleepHungerScale, 0, 115);
|
||||
this.hunger = clamp(this.hunger + dt * 0.018 * 0.75 * sleepHungerScale, 0, 115);
|
||||
if (this.target && !this.target.dead && isNestContainerItem(this.target)) {
|
||||
this.updateNestBoxPresence(dt);
|
||||
this.vx = 0;
|
||||
|
|
@ -671,13 +672,20 @@
|
|||
|
||||
checkLife(dt = 0.016) {
|
||||
let reason = "";
|
||||
const activeDiseaseDeathReason = () => {
|
||||
if (this.zunchiDisease) return "ずんち病";
|
||||
if (this.sleepDisease) return "ねむり病";
|
||||
if (this.explosionDisease) return "爆発病";
|
||||
if (this.fightDisease) return "きずつき病";
|
||||
return "";
|
||||
};
|
||||
if (this.energy <= 0) {
|
||||
reason = this.temperatureDeathReason?.() || this.dominantDeathCause("", { lowHealth: true }) || "\u4e8b\u6545";
|
||||
reason = this.temperatureDeathReason?.() || activeDiseaseDeathReason() || this.dominantDeathCause("", { lowHealth: true }) || "事故";
|
||||
}
|
||||
else if (this.hunger >= 108) reason = "\u98e2\u9913";
|
||||
else if (this.age >= this.lifeSpan) reason = "\u5929\u5bff\u3092\u5168\u3046\u3057\u305f";
|
||||
else if (this.hunger >= 108) reason = "飢餓";
|
||||
else if (this.age >= this.lifeSpan) reason = "天寿を全うした";
|
||||
else if (this.stress >= 124) {
|
||||
reason = this.dominantDeathCause("\u30b9\u30c8\u30ec\u30b9\u904e\u591a", { stressDeath: true }) || "\u30b9\u30c8\u30ec\u30b9\u904e\u591a";
|
||||
reason = activeDiseaseDeathReason() || this.dominantDeathCause("ストレス過多", { stressDeath: true }) || "ストレス過多";
|
||||
}
|
||||
if (reason) this.die(reason);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue