stable
This commit is contained in:
parent
8bd4405fe8
commit
d5c661bc22
53 changed files with 4264 additions and 950 deletions
|
|
@ -78,7 +78,7 @@
|
|||
ctx.translate(this.x, this.y);
|
||||
const night = (lighting?.light || 1) < 0.42;
|
||||
if (this.type === "grass_bed") {
|
||||
// かんたんベッド: 緑色の小さい干草寝床。通常の干草寝床より一回り小さく、草束感を強める。
|
||||
// \u304b\u3093\u305f\u3093\u30d9\u30c3\u30c9: \u7dd1\u8272\u306e\u5c0f\u3055\u3044\u5e72\u8349\u5bdd\u5e8a\u3002\u901a\u5e38\u306e\u5e72\u8349\u5bdd\u5e8a\u3088\u308a\u4e00\u56de\u308a\u5c0f\u3055\u304f\u3001\u8349\u675f\u611f\u3092\u5f37\u3081\u308b\u3002
|
||||
const grassFill = night ? "rgba(78,132,67,0.90)" : "rgba(84,177,72,0.93)";
|
||||
const grassStroke = night ? "rgba(39,78,43,0.76)" : "rgba(45,112,48,0.78)";
|
||||
const strawStroke = night ? "rgba(168,207,119,0.42)" : "rgba(205,234,128,0.66)";
|
||||
|
|
@ -106,13 +106,13 @@
|
|||
ctx.ellipse(0, this.r * 0.22, this.r * 1.28, this.r * 0.28, -0.06, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
} else if (this.type === "plushie") {
|
||||
const img = typeof getRenderableImage === "function" ? getRenderableImage("smile", "smile") : global.images?.get?.("smile");
|
||||
const img = typeof getRenderableImage === "function" ? getRenderableImage("plushie", "plushie") : global.images?.get?.("plushie");
|
||||
ctx.rotate(Math.sin(time * 2 + this.seed) * 0.05);
|
||||
if (img) {
|
||||
const w = this.r * 2.2;
|
||||
const metrics = typeof getImageMetrics === "function" ? getImageMetrics("smile") : null;
|
||||
const h = w * (metrics?.ratio || 0.92);
|
||||
ctx.drawImage(img, -w * 0.5, -h * 0.58, w, h);
|
||||
const metrics = typeof getImageMetrics === "function" ? getImageMetrics("plushie") : null;
|
||||
const w = this.r * 3.0;
|
||||
const h = w * (metrics?.ratio || 0.74);
|
||||
ctx.drawImage(img, -w * 0.58, -h * 0.60, w, h);
|
||||
} else {
|
||||
ctx.fillStyle = "#f7dfc0";
|
||||
ctx.strokeStyle = "rgba(86,62,48,0.70)";
|
||||
|
|
@ -178,16 +178,18 @@
|
|||
roles: { sleepPlace: true, ownedStructure: true },
|
||||
needEffects: { food: 0, sleep: 60, health: 5, safety: 25, social: 0, fulfill: 40 },
|
||||
create(owner, x, y, world) { return new TarinaiStructure(this, owner, x, y, world); },
|
||||
onUse(user, structure) {
|
||||
onUse(user, structure, worldRef) {
|
||||
if (user?.id && !structure.ownerId) {
|
||||
structure.ownerId = user.id;
|
||||
structure.ownerName = user.name || "";
|
||||
structure.attachment = Math.max(structure.attachment || 0, 24);
|
||||
worldRef?.markItemBucketsDirty?.("grass-bed-owner-adopted");
|
||||
worldRef?.markTerrainDirty?.("grass-bed-owner-adopted");
|
||||
worldRef?.emit?.("structure:ownerAdopted", { structure, owner: user });
|
||||
}
|
||||
const ownerUse = user?.id && user.id === structure.ownerId;
|
||||
if (ownerUse) structure.attachment = Math.min(100, (structure.attachment || 0) + 2);
|
||||
structure.usedCount = (structure.usedCount || 0) + 1;
|
||||
if (user) {
|
||||
user.needShock = user.needShock || {};
|
||||
user.needShock.sleep = Math.min(0, (user.needShock.sleep || 0) - (ownerUse ? 18 : 8));
|
||||
user.needShock.safety = Math.min(0, (user.needShock.safety || 0) - (ownerUse ? 12 : 4));
|
||||
user.needShock.fulfill = Math.min(0, (user.needShock.fulfill || 0) - (ownerUse ? 18 : 6));
|
||||
}
|
||||
return true;
|
||||
},
|
||||
onDestroyed(structure, world, breaker) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue