qqq
This commit is contained in:
parent
acf93ec6df
commit
ee22e1a929
49 changed files with 1380 additions and 338 deletions
|
|
@ -22,6 +22,14 @@
|
|||
|
||||
const TARINAI_KING_FLEE_REASON = "\u305F\u308A\u306A\u3044\u738B\u304C\u6016\u304F\u3066\u9003\u3052\u3066\u3044\u308B\u3002";
|
||||
|
||||
function isNestContainerItem(item) {
|
||||
return Boolean(item && !item.dead && (typeof global.isNestContainerType === "function" ? global.isNestContainerType(item.type) : (item.type === "nest_box" || item.type === "pipe")));
|
||||
}
|
||||
|
||||
function sleepContainerText(item, verb = "\u4f11\u3093\u3067\u3044\u308b") {
|
||||
return item?.type === "pipe" ? `\u571f\u7ba1\u306e\u4e2d\u3067${verb}` : `\u5de3\u7bb1\u306e\u4e2d\u3067${verb}`;
|
||||
}
|
||||
|
||||
function tarinaiIsChampionBreedingPartner(champion, candidate) {
|
||||
if (!champion || !candidate || champion === candidate) return false;
|
||||
if (champion.birthPartnerId && champion.birthPartnerId === candidate.id) return true;
|
||||
|
|
@ -316,7 +324,7 @@
|
|||
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);
|
||||
if (this.target && !this.target.dead && this.target.type === "nest_box") {
|
||||
if (this.target && !this.target.dead && isNestContainerItem(this.target)) {
|
||||
this.updateNestBoxPresence(dt);
|
||||
this.vx = 0;
|
||||
this.vy = 0;
|
||||
|
|
@ -504,19 +512,20 @@
|
|||
const bedDx = this.target.x - this.x;
|
||||
const bedDy = this.target.y - this.y;
|
||||
const bedDist = Math.hypot(bedDx, bedDy);
|
||||
const reachedSleepFurniture = this.target.type === "nest_box"
|
||||
const reachedSleepFurniture = isNestContainerItem(this.target)
|
||||
? (this.insideNestBoxId === this.target.id || d <= Math.max(this.radius + 34, this.target.r * 1.08) || bedDist <= Math.max(this.target.r * 1.05, 62))
|
||||
: (d <= Math.max(this.radius + 8, 26) || bedDist <= Math.max(this.target.r * 0.58, 20));
|
||||
if (reachedSleepFurniture) {
|
||||
const sleepTarget = this.target;
|
||||
const isEasyBed = sleepTarget?.type === "grass_bed";
|
||||
sleepTarget?.use?.(this, this.world, isEasyBed ? { purpose: "sleep" } : undefined);
|
||||
this.startSleeping?.(sleepTarget, sleepTarget?.type === "nest_box" ? "\u5de3\u7bb1\u306e\u4e2d\u3067\u4f11\u3093\u3067\u3044\u308b" : (isEasyBed ? "\u304b\u3093\u305f\u3093\u30d9\u30c3\u30c9\u3067\u5bdd\u3066\u3044\u308b" : "\u30d9\u30c3\u30c9\u3067\u4f11\u3093\u3067\u3044\u308b"));
|
||||
if (sleepTarget?.type === "nest_box") this.enterNestBox(sleepTarget, dt);
|
||||
const sleepText = isNestContainerItem(sleepTarget) ? sleepContainerText(sleepTarget, "\u4f11\u3093\u3067\u3044\u308b") : (isEasyBed ? "\u304b\u3093\u305f\u3093\u30d9\u30c3\u30c9\u3067\u5bdd\u3066\u3044\u308b" : "\u30d9\u30c3\u30c9\u3067\u4f11\u3093\u3067\u3044\u308b");
|
||||
this.startSleeping?.(sleepTarget, sleepText);
|
||||
if (isNestContainerItem(sleepTarget)) this.enterNestBox(sleepTarget, dt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.state === "panic" && this.lastPanicCause === "tarinai_champion" && this.target?.type === "nest_box") {
|
||||
if (this.state === "panic" && this.lastPanicCause === "tarinai_champion" && isNestContainerItem(this.target)) {
|
||||
const nestDist = distXY(this.x, this.y, this.target.x, this.target.y);
|
||||
if (nestDist <= Math.max(50, (this.radius || 20) + (this.target.r || 24) + 18)) {
|
||||
this.enterNestBox?.(this.target, dt, { forceDisplace: true, reason: TARINAI_KING_FLEE_REASON });
|
||||
|
|
@ -524,7 +533,7 @@
|
|||
}
|
||||
}
|
||||
let sign = (this.state === "panic" || this.state === "cursor_enemy") ? -1 : 1;
|
||||
if (this.state === "panic" && this.lastPanicCause === "tarinai_champion" && this.target?.type === "nest_box") sign = 1;
|
||||
if (this.state === "panic" && this.lastPanicCause === "tarinai_champion" && isNestContainerItem(this.target)) sign = 1;
|
||||
if (this.target?.detour) sign = 1;
|
||||
let strength = 1;
|
||||
if (this.state === "follow_parent") {
|
||||
|
|
@ -685,7 +694,6 @@
|
|||
if (this.world.recentDeathTimes.length > 24) this.world.recentDeathTimes = this.world.recentDeathTimes.slice(-24);
|
||||
for (const item of this.world.items || []) {
|
||||
if (!item || item.dead || !item.isStructure || item.type !== "plushie" || item.ownerId !== this.id) continue;
|
||||
item.dead = true;
|
||||
item.hp = 0;
|
||||
item.amount = 0;
|
||||
item.carriedById = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue