h
This commit is contained in:
parent
e00bfd8879
commit
f941200504
70 changed files with 1856 additions and 429 deletions
|
|
@ -186,6 +186,11 @@
|
|||
const intimidateShake = this.intimidateTimer > 0.04 ? Math.sin(t * 44 + this.age) * this.radius * 0.09 : 0;
|
||||
const fearShakeY = this.intimidatedTimer > 0.04 ? Math.sin(t * 52 + this.age * 0.7) * this.radius * 0.11 : 0;
|
||||
const birthShake = this.birthRitualTimer > 0.04 ? Math.sin(t * 34 + this.age) * this.radius * 0.07 : 0;
|
||||
const coldStatus = this.temperatureStatus || this.world?.temperatureStatusFor?.(this.feltTemperature ?? this.tempComfort ?? (CONFIG.standardTemperature ?? 15)) || null;
|
||||
const coldShakeActive = Boolean(coldStatus && coldStatus.direction === "cold" && (coldStatus.discomfort || 0) > 0.5 && this.state !== "sunbath");
|
||||
const coldShakeStrength = coldShakeActive ? clamp((coldStatus.discomfort || 0) / 12, 0.25, 1.25) : 0;
|
||||
const coldShakeX = coldShakeActive ? (Math.sin(t * 46 + this.age * 0.9) + Math.sin(t * 71 + this.age * 0.31) * 0.55) * this.radius * 0.035 * coldShakeStrength : 0;
|
||||
const coldShakeY = coldShakeActive ? Math.sin(t * 58 + this.age * 0.47) * this.radius * 0.012 * coldShakeStrength : 0;
|
||||
const bob = breathing * (this.state === "sleep" ? 0.9 : 1.2 + gait * 1.6) + headbuttPulse * 0.9 + fallLift + birthShake * 0.25;
|
||||
const blastSpin = this.blastSpinTimer > 0.04 ? this.fallDir * ((this.blastSpinMax || 1) - this.blastSpinTimer) * Math.PI * 70.0 : 0;
|
||||
const fallSpin = this.blastSpinTimer > 0.04 ? blastSpin : (fallPose > 0 ? this.fallDir * (1 - fallPose) * Math.PI * 2 : 0);
|
||||
|
|
@ -279,7 +284,7 @@
|
|||
}
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(this.x + intimidateShake, this.y + bob + fearShakeY);
|
||||
ctx.translate(this.x + intimidateShake + coldShakeX, this.y + bob + fearShakeY + coldShakeY);
|
||||
const observeKind = this.world.observeHighlightKind ? this.world.observeHighlightKind(this) : "";
|
||||
if (observeKind && this.world.selected !== this) {
|
||||
const style = {
|
||||
|
|
@ -323,6 +328,29 @@
|
|||
ctx.restore();
|
||||
}
|
||||
|
||||
if (showDecor && coldShakeActive) {
|
||||
ctx.save();
|
||||
ctx.globalAlpha = 0.22 * nestHideAlpha * clamp(coldShakeStrength, 0.25, 1.15);
|
||||
ctx.strokeStyle = "rgba(108, 166, 220, 0.86)";
|
||||
ctx.lineWidth = Math.max(1.0, this.radius * 0.045);
|
||||
ctx.lineCap = "round";
|
||||
const side = Math.max(10, drawW * 0.36);
|
||||
const top = -drawH * 0.28;
|
||||
const amp = Math.max(2, this.radius * 0.08);
|
||||
for (const dir of [-1, 1]) {
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const ox = dir * (side + i * drawW * 0.055);
|
||||
const oy = top + i * drawH * 0.22 + Math.sin(t * 24 + i + this.age) * amp * 0.35;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(ox, oy - amp);
|
||||
ctx.lineTo(ox + dir * amp * 0.55, oy);
|
||||
ctx.lineTo(ox, oy + amp);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
if (this.world.selected === this) {
|
||||
ctx.save();
|
||||
const pulse = 0.5 + 0.5 * Math.sin(this.world.time * 7.5);
|
||||
|
|
@ -420,8 +448,6 @@
|
|||
if (faceRight) ctx.scale(-1, 1);
|
||||
const dw = drawW * squish;
|
||||
const dh = drawH / squish;
|
||||
const brightness = clamp(0.82 + lightState.light * 0.30 + lightState.dawnStrength * 0.08 + lightState.goldenStrength * 0.06 + lightState.noonStrength * 0.04, 0.80, 1.17);
|
||||
const saturation = clamp(0.86 + lightState.light * 0.22 + lightState.goldenStrength * 0.10 - lightState.nightStrength * 0.04, 0.82, 1.14);
|
||||
const renderScale = SPRITE_CACHE_SCALE;
|
||||
const cacheW = Math.max(1, Math.round((dw * renderScale) / 8) * 8);
|
||||
const cacheH = Math.max(1, Math.round((dh * renderScale) / 8) * 8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue