BlueGit

timfa questward

Add sheep/goat cookable meat and friends online presence.

Wool animals drop mutton or goat for oven/campfire cooking; the friends list shows online status and the character currently in-world.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
3dcfc07b7d78d3bec9c7a2a656f5511d49e7a375
Parent
c10388e1
8 files changed +278 −7
client/src/play/social.js +16 −1
@@ -201,12 +201,27 @@ export function initSocial ({ socket, MessageType, resolveSpriteUrl = null, reso
201 201 wrap.className = "friend-account";
202 202 const header = document.createElement("div");
203 203 header.className = "social-row friend-account-header";
204 const status = document.createElement("span");
205 status.className = `friend-status-dot ${account.online ? "online" : "offline"}`;
206 status.title = account.online ? "Online" : "Offline";
207 status.setAttribute("aria-label", account.online ? "Online" : "Offline");
208 const nameCol = document.createElement("div");
209 nameCol.className = "friend-account-copy";
204 210 const nameBtn = document.createElement("button");
205 211 nameBtn.type = "button";
206 212 nameBtn.className = "friend-account-name";
207 213 nameBtn.textContent = account.username || `Account ${account.accountId}`;
208 214 nameBtn.addEventListener("click", onToggle);
209 header.append(nameBtn, actionButton("Remove", onRemove));
215 nameCol.append(nameBtn);
216 if (account.online && account.playingAs)
217 {
218 const playing = document.createElement("span");
219 playing.className = "friend-playing-as";
220 const who = `${account.playingAs.firstName ?? ""} ${account.playingAs.lastName ?? ""}`.trim();
221 playing.textContent = who ? `Playing as ${who}` : "Online";
222 nameCol.append(playing);
223 }
224 header.append(status, nameCol, actionButton("Remove", onRemove));
210 225 wrap.append(header);
211 226 if (expanded)
212 227 {
@@ -201,12 +201,27 @@ export function initSocial ({ socket, MessageType, resolveSpriteUrl = null, reso
201 wrap.className = "friend-account";
201 wrap.className = "friend-account";
202 const header = document.createElement("div");
202 const header = document.createElement("div");
203 header.className = "social-row friend-account-header";
203 header.className = "social-row friend-account-header";
204 const status = document.createElement("span");
205 status.className = `friend-status-dot ${account.online ? "online" : "offline"}`;
206 status.title = account.online ? "Online" : "Offline";
207 status.setAttribute("aria-label", account.online ? "Online" : "Offline");
208 const nameCol = document.createElement("div");
209 nameCol.className = "friend-account-copy";
204 const nameBtn = document.createElement("button");
210 const nameBtn = document.createElement("button");
205 nameBtn.type = "button";
211 nameBtn.type = "button";
206 nameBtn.className = "friend-account-name";
212 nameBtn.className = "friend-account-name";
207 nameBtn.textContent = account.username || `Account ${account.accountId}`;
213 nameBtn.textContent = account.username || `Account ${account.accountId}`;
208 nameBtn.addEventListener("click", onToggle);
214 nameBtn.addEventListener("click", onToggle);
209 header.append(nameBtn, actionButton("Remove", onRemove));
215 nameCol.append(nameBtn);
216 if (account.online && account.playingAs)
217 {
218 const playing = document.createElement("span");
219 playing.className = "friend-playing-as";
220 const who = `${account.playingAs.firstName ?? ""} ${account.playingAs.lastName ?? ""}`.trim();
221 playing.textContent = who ? `Playing as ${who}` : "Online";
222 nameCol.append(playing);
223 }
224 header.append(status, nameCol, actionButton("Remove", onRemove));
210 wrap.append(header);
225 wrap.append(header);
211 if (expanded)
226 if (expanded)
212 {
227 {
client/ui/play.css +30 −0
@@ -527,6 +527,30 @@ a {
527 527 align-items: center;
528 528 }
529 529
530 .friend-status-dot {
531 width: 0.55rem;
532 height: 0.55rem;
533 border-radius: 50%;
534 flex: 0 0 auto;
535 box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
536 }
537
538 .friend-status-dot.online {
539 background: #3ecf6a;
540 }
541
542 .friend-status-dot.offline {
543 background: #c44a4a;
544 }
545
546 .friend-account-copy {
547 flex: 1;
548 min-width: 0;
549 display: flex;
550 flex-direction: column;
551 gap: 0.1rem;
552 }
553
530 554 button.friend-account-name {
531 555 flex: 1;
532 556 text-align: left;
@@ -542,6 +566,12 @@ button.friend-account-name:hover {
542 566 color: #e8c84a;
543 567 }
544 568
569 .friend-playing-as {
570 font-size: 0.78rem;
571 opacity: 0.75;
572 line-height: 1.2;
573 }
574
545 575 .friend-character-list {
546 576 display: flex;
547 577 flex-direction: column;
@@ -527,6 +527,30 @@ a {
527 align-items: center;
527 align-items: center;
528}
528}
529
529
530.friend-status-dot {
531 width: 0.55rem;
532 height: 0.55rem;
533 border-radius: 50%;
534 flex: 0 0 auto;
535 box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
536}
537
538.friend-status-dot.online {
539 background: #3ecf6a;
540}
541
542.friend-status-dot.offline {
543 background: #c44a4a;
544}
545
546.friend-account-copy {
547 flex: 1;
548 min-width: 0;
549 display: flex;
550 flex-direction: column;
551 gap: 0.1rem;
552}
553
530button.friend-account-name {
554button.friend-account-name {
531 flex: 1;
555 flex: 1;
532 text-align: left;
556 text-align: left;
@@ -542,6 +566,12 @@ button.friend-account-name:hover {
542 color: #e8c84a;
566 color: #e8c84a;
543}
567}
544
568
569.friend-playing-as {
570 font-size: 0.78rem;
571 opacity: 0.75;
572 line-height: 1.2;
573}
574
545.friend-character-list {
575.friend-character-list {
546 display: flex;
576 display: flex;
547 flex-direction: column;
577 flex-direction: column;
server/src/gateway/websocket.js +56 −2
@@ -1125,6 +1125,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1125 1125 else
1126 1126 { session.entityId = simulation.spawnCharacter(session.id, character); }
1127 1127 sendEnterWorld(session, character);
1128 notifyFriendPresence(session.account?.account_id);
1128 1129 }
1129 1130
1130 1131 function sendEnterWorld (session, character)
@@ -1155,7 +1156,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1155 1156 restartStatus: deploy?.getStatus?.() ?? { scheduled: false }
1156 1157 });
1157 1158 syncSubscriptions(session, true);
1158 send(session, { type: MessageType.friends, ...friends.snapshot(session.characterId) });
1159 send(session, { type: MessageType.friends, ...friendsPayload(session.characterId) });
1159 1160 const bag = simulation.bagOf(session.entityId);
1160 1161 if (bag)
1161 1162 { send(session, { type: MessageType.inventory, ...bag }); }
@@ -1197,6 +1198,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1197 1198 {
1198 1199 send(session, { type: MessageType.forceLogout, reason });
1199 1200 const characterId = session.characterId;
1201 const accountId = session.account?.account_id | 0;
1200 1202 session.characterId = null;
1201 1203 session.entityId = null;
1202 1204 session.entitySubscribed.clear();
@@ -1209,10 +1211,13 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1209 1211 session.suppressLeaveWorldOnClose = true;
1210 1212 if (session.socket.readyState === 1)
1211 1213 { session.socket.close(4000, "Logged in elsewhere"); }
1214 if (accountId)
1215 { notifyFriendPresence(accountId); }
1212 1216 }
1213 1217
1214 1218 function leaveWorld (session)
1215 1219 {
1220 const accountId = session.account?.account_id | 0;
1216 1221 if (session.characterId)
1217 1222 { simulation.despawnCharacter(session.characterId); }
1218 1223 publishReplication(simulation.drainReplication());
@@ -1220,6 +1225,8 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1220 1225 session.entityId = null;
1221 1226 session.entitySubscribed.clear();
1222 1227 session.staticSubscribed.clear();
1228 if (accountId)
1229 { notifyFriendPresence(accountId); }
1223 1230 }
1224 1231
1225 1232 function syncSubscriptions (session, forceSnapshots)
@@ -1356,6 +1363,53 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1356 1363 }
1357 1364 }
1358 1365
1366 function onlinePresenceByAccount ()
1367 {
1368 const byAccount = new Map();
1369 for (const entry of sessions.values())
1370 {
1371 if (!entry.characterId || !entry.entityId)
1372 { continue; }
1373 const accountId = entry.account?.account_id | 0;
1374 if (!accountId)
1375 { continue; }
1376 const row = stateDb.getCharacter(entry.characterId);
1377 if (!row)
1378 { continue; }
1379 byAccount.set(accountId, {
1380 characterId: row.character_id,
1381 firstName: row.first_name,
1382 lastName: row.last_name
1383 });
1384 }
1385 return byAccount;
1386 }
1387
1388 function friendsPayload (characterId)
1389 {
1390 const snap = friends.snapshot(characterId);
1391 const presence = onlinePresenceByAccount();
1392 for (const account of snap.friends ?? [])
1393 {
1394 const playingAs = presence.get(account.accountId | 0) ?? null;
1395 account.online = !!playingAs;
1396 account.playingAs = playingAs;
1397 }
1398 return snap;
1399 }
1400
1401 /** Refresh friends panels for an account and everyone friended with them. */
1402 function notifyFriendPresence (accountId)
1403 {
1404 const id = accountId | 0;
1405 if (!id)
1406 { return; }
1407 const refs = [id];
1408 for (const row of stateDb.listAccountFriendRecords(id))
1409 { refs.push(row.account_id); }
1410 pushFriends(...refs);
1411 }
1412
1359 1413 function pushFriends (...refs)
1360 1414 {
1361 1415 const accountIds = new Set();
@@ -1385,7 +1439,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1385 1439 const accountId = session.account?.account_id | 0;
1386 1440 if (!accountIds.has(accountId))
1387 1441 { continue; }
1388 send(session, { type: MessageType.friends, ...friends.snapshot(session.characterId) });
1442 send(session, { type: MessageType.friends, ...friendsPayload(session.characterId) });
1389 1443 }
1390 1444 }
1391 1445
@@ -1125,6 +1125,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1125 else
1125 else
1126 { session.entityId = simulation.spawnCharacter(session.id, character); }
1126 { session.entityId = simulation.spawnCharacter(session.id, character); }
1127 sendEnterWorld(session, character);
1127 sendEnterWorld(session, character);
1128 notifyFriendPresence(session.account?.account_id);
1128 }
1129 }
1129
1130
1130 function sendEnterWorld (session, character)
1131 function sendEnterWorld (session, character)
@@ -1155,7 +1156,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1155 restartStatus: deploy?.getStatus?.() ?? { scheduled: false }
1156 restartStatus: deploy?.getStatus?.() ?? { scheduled: false }
1156 });
1157 });
1157 syncSubscriptions(session, true);
1158 syncSubscriptions(session, true);
1158 send(session, { type: MessageType.friends, ...friends.snapshot(session.characterId) });
1159 send(session, { type: MessageType.friends, ...friendsPayload(session.characterId) });
1159 const bag = simulation.bagOf(session.entityId);
1160 const bag = simulation.bagOf(session.entityId);
1160 if (bag)
1161 if (bag)
1161 { send(session, { type: MessageType.inventory, ...bag }); }
1162 { send(session, { type: MessageType.inventory, ...bag }); }
@@ -1197,6 +1198,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1197 {
1198 {
1198 send(session, { type: MessageType.forceLogout, reason });
1199 send(session, { type: MessageType.forceLogout, reason });
1199 const characterId = session.characterId;
1200 const characterId = session.characterId;
1201 const accountId = session.account?.account_id | 0;
1200 session.characterId = null;
1202 session.characterId = null;
1201 session.entityId = null;
1203 session.entityId = null;
1202 session.entitySubscribed.clear();
1204 session.entitySubscribed.clear();
@@ -1209,10 +1211,13 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1209 session.suppressLeaveWorldOnClose = true;
1211 session.suppressLeaveWorldOnClose = true;
1210 if (session.socket.readyState === 1)
1212 if (session.socket.readyState === 1)
1211 { session.socket.close(4000, "Logged in elsewhere"); }
1213 { session.socket.close(4000, "Logged in elsewhere"); }
1214 if (accountId)
1215 { notifyFriendPresence(accountId); }
1212 }
1216 }
1213
1217
1214 function leaveWorld (session)
1218 function leaveWorld (session)
1215 {
1219 {
1220 const accountId = session.account?.account_id | 0;
1216 if (session.characterId)
1221 if (session.characterId)
1217 { simulation.despawnCharacter(session.characterId); }
1222 { simulation.despawnCharacter(session.characterId); }
1218 publishReplication(simulation.drainReplication());
1223 publishReplication(simulation.drainReplication());
@@ -1220,6 +1225,8 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1220 session.entityId = null;
1225 session.entityId = null;
1221 session.entitySubscribed.clear();
1226 session.entitySubscribed.clear();
1222 session.staticSubscribed.clear();
1227 session.staticSubscribed.clear();
1228 if (accountId)
1229 { notifyFriendPresence(accountId); }
1223 }
1230 }
1224
1231
1225 function syncSubscriptions (session, forceSnapshots)
1232 function syncSubscriptions (session, forceSnapshots)
@@ -1356,6 +1363,53 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1356 }
1363 }
1357 }
1364 }
1358
1365
1366 function onlinePresenceByAccount ()
1367 {
1368 const byAccount = new Map();
1369 for (const entry of sessions.values())
1370 {
1371 if (!entry.characterId || !entry.entityId)
1372 { continue; }
1373 const accountId = entry.account?.account_id | 0;
1374 if (!accountId)
1375 { continue; }
1376 const row = stateDb.getCharacter(entry.characterId);
1377 if (!row)
1378 { continue; }
1379 byAccount.set(accountId, {
1380 characterId: row.character_id,
1381 firstName: row.first_name,
1382 lastName: row.last_name
1383 });
1384 }
1385 return byAccount;
1386 }
1387
1388 function friendsPayload (characterId)
1389 {
1390 const snap = friends.snapshot(characterId);
1391 const presence = onlinePresenceByAccount();
1392 for (const account of snap.friends ?? [])
1393 {
1394 const playingAs = presence.get(account.accountId | 0) ?? null;
1395 account.online = !!playingAs;
1396 account.playingAs = playingAs;
1397 }
1398 return snap;
1399 }
1400
1401 /** Refresh friends panels for an account and everyone friended with them. */
1402 function notifyFriendPresence (accountId)
1403 {
1404 const id = accountId | 0;
1405 if (!id)
1406 { return; }
1407 const refs = [id];
1408 for (const row of stateDb.listAccountFriendRecords(id))
1409 { refs.push(row.account_id); }
1410 pushFriends(...refs);
1411 }
1412
1359 function pushFriends (...refs)
1413 function pushFriends (...refs)
1360 {
1414 {
1361 const accountIds = new Set();
1415 const accountIds = new Set();
@@ -1385,7 +1439,7 @@ export function attachGateway ({ httpServer, auth, stateDb, characters, friends,
1385 const accountId = session.account?.account_id | 0;
1439 const accountId = session.account?.account_id | 0;
1386 if (!accountIds.has(accountId))
1440 if (!accountIds.has(accountId))
1387 { continue; }
1441 { continue; }
1388 send(session, { type: MessageType.friends, ...friends.snapshot(session.characterId) });
1442 send(session, { type: MessageType.friends, ...friendsPayload(session.characterId) });
1389 }
1443 }
1390 }
1444 }
1391
1445
server/src/spells/tinders.js +3 −1
@@ -121,9 +121,11 @@ function cookedItemIdForRaw (rawDef)
121 121 {
122 122 if (rawDef.fishSpeciesId)
123 123 { return cookedFishItemId(rawDef.fishSpeciesId); }
124 if (rawDef.cookedItemId)
125 { return rawDef.cookedItemId; }
124 126 if (rawDef.itemId === CraftingItemId.rawMeat)
125 127 { return CraftingItemId.cookedMeat; }
126 return rawDef.cookedItemId ?? CraftingItemId.cookedMeat;
128 return CraftingItemId.cookedMeat;
127 129 }
128 130
129 131 function spawnGroundStack (world, tileX, tileY, stack, now, events)
@@ -121,9 +121,11 @@ function cookedItemIdForRaw (rawDef)
121{
121{
122 if (rawDef.fishSpeciesId)
122 if (rawDef.fishSpeciesId)
123 { return cookedFishItemId(rawDef.fishSpeciesId); }
123 { return cookedFishItemId(rawDef.fishSpeciesId); }
124 if (rawDef.cookedItemId)
125 { return rawDef.cookedItemId; }
124 if (rawDef.itemId === CraftingItemId.rawMeat)
126 if (rawDef.itemId === CraftingItemId.rawMeat)
125 { return CraftingItemId.cookedMeat; }
127 { return CraftingItemId.cookedMeat; }
126 return rawDef.cookedItemId ?? CraftingItemId.cookedMeat;
128 return CraftingItemId.cookedMeat;
127}
129}
128
130
129function spawnGroundStack (world, tileX, tileY, stack, now, events)
131function spawnGroundStack (world, tileX, tileY, stack, now, events)
server/tests/firestarting-cooking.test.js +15 −0
@@ -10,6 +10,7 @@ import {
10 10 CRAFT_DURATION_MS
11 11 } from "../../shared/definitions/craftingStations.js";
12 12 import { CraftingItemId, tinderboxItemInstance } from "../../shared/definitions/craftingItems.js";
13 import { MobId, mobDefinition } from "../../shared/definitions/mobs.js";
13 14 import { WoodItemId, ashItemIdForWood } from "../../shared/definitions/woodItems.js";
14 15 import { WoodTier } from "../../shared/definitions/materialTiers.js";
15 16 import { SkillId } from "../../shared/definitions/skills.js";
@@ -130,6 +131,20 @@ test("eggs cook only in an oven and cannot be eaten raw", () =>
130 131 );
131 132 });
132 133
134 test("sheep and goat drop cookable meats for oven and campfire", () =>
135 {
136 const sheep = mobDefinition(MobId.sheep);
137 assert.ok(sheep.drops.some((drop) => drop.itemId === CraftingItemId.rawMutton));
138 const goat = mobDefinition(MobId.cashmereGoat);
139 assert.ok(goat.drops.some((drop) => drop.itemId === CraftingItemId.rawGoat));
140 const mutton = recipeDefinition("cook-mutton");
141 assert.deepEqual(mutton.stationIds, [CraftingStationId.oven, CraftingStationId.fireplace]);
142 assert.equal(mutton.output.itemId, CraftingItemId.cookedMutton);
143 const goatCook = recipeDefinition("cook-goat");
144 assert.deepEqual(goatCook.stationIds, [CraftingStationId.oven, CraftingStationId.fireplace]);
145 assert.equal(goatCook.output.itemId, CraftingItemId.cookedGoat);
146 });
147
133 148 test("fish cook recipes use the species name as craft label", () =>
134 149 {
135 150 const trout = recipeDefinition("cook-trout");
@@ -10,6 +10,7 @@ import {
10 CRAFT_DURATION_MS
10 CRAFT_DURATION_MS
11} from "../../shared/definitions/craftingStations.js";
11} from "../../shared/definitions/craftingStations.js";
12import { CraftingItemId, tinderboxItemInstance } from "../../shared/definitions/craftingItems.js";
12import { CraftingItemId, tinderboxItemInstance } from "../../shared/definitions/craftingItems.js";
13import { MobId, mobDefinition } from "../../shared/definitions/mobs.js";
13import { WoodItemId, ashItemIdForWood } from "../../shared/definitions/woodItems.js";
14import { WoodItemId, ashItemIdForWood } from "../../shared/definitions/woodItems.js";
14import { WoodTier } from "../../shared/definitions/materialTiers.js";
15import { WoodTier } from "../../shared/definitions/materialTiers.js";
15import { SkillId } from "../../shared/definitions/skills.js";
16import { SkillId } from "../../shared/definitions/skills.js";
@@ -130,6 +131,20 @@ test("eggs cook only in an oven and cannot be eaten raw", () =>
130 );
131 );
131});
132});
132
133
134test("sheep and goat drop cookable meats for oven and campfire", () =>
135{
136 const sheep = mobDefinition(MobId.sheep);
137 assert.ok(sheep.drops.some((drop) => drop.itemId === CraftingItemId.rawMutton));
138 const goat = mobDefinition(MobId.cashmereGoat);
139 assert.ok(goat.drops.some((drop) => drop.itemId === CraftingItemId.rawGoat));
140 const mutton = recipeDefinition("cook-mutton");
141 assert.deepEqual(mutton.stationIds, [CraftingStationId.oven, CraftingStationId.fireplace]);
142 assert.equal(mutton.output.itemId, CraftingItemId.cookedMutton);
143 const goatCook = recipeDefinition("cook-goat");
144 assert.deepEqual(goatCook.stationIds, [CraftingStationId.oven, CraftingStationId.fireplace]);
145 assert.equal(goatCook.output.itemId, CraftingItemId.cookedGoat);
146});
147
133test("fish cook recipes use the species name as craft label", () =>
148test("fish cook recipes use the species name as craft label", () =>
134{
149{
135 const trout = recipeDefinition("cook-trout");
150 const trout = recipeDefinition("cook-trout");
shared/crafting/stationRecipes.js +24 −0
@@ -200,6 +200,30 @@ export const CRAFT_RECIPES = Object.freeze([
200 200 burntOutput: { itemId: CraftingItemId.burntMeat, quantity: 1 }
201 201 }),
202 202
203 Object.freeze({
204 recipeId: "cook-mutton",
205 stationIds: [CraftingStationId.oven, CraftingStationId.fireplace],
206 craftGroup: "cook-mutton",
207 craftGroupLabel: "Mutton",
208 output: { itemId: CraftingItemId.cookedMutton, quantity: 1 },
209 inputs: [{ itemId: CraftingItemId.rawMutton, quantity: 1 }],
210 minSkillLevel: 1,
211 skillId: "cooking",
212 burntOutput: { itemId: CraftingItemId.burntMutton, quantity: 1 }
213 }),
214
215 Object.freeze({
216 recipeId: "cook-goat",
217 stationIds: [CraftingStationId.oven, CraftingStationId.fireplace],
218 craftGroup: "cook-goat",
219 craftGroupLabel: "Goat",
220 output: { itemId: CraftingItemId.cookedGoat, quantity: 1 },
221 inputs: [{ itemId: CraftingItemId.rawGoat, quantity: 1 }],
222 minSkillLevel: 1,
223 skillId: "cooking",
224 burntOutput: { itemId: CraftingItemId.burntGoat, quantity: 1 }
225 }),
226
203 227 Object.freeze({
204 228 recipeId: "cook-egg",
205 229 stationIds: [CraftingStationId.oven],
@@ -200,6 +200,30 @@ export const CRAFT_RECIPES = Object.freeze([
200 burntOutput: { itemId: CraftingItemId.burntMeat, quantity: 1 }
200 burntOutput: { itemId: CraftingItemId.burntMeat, quantity: 1 }
201 }),
201 }),
202
202
203 Object.freeze({
204 recipeId: "cook-mutton",
205 stationIds: [CraftingStationId.oven, CraftingStationId.fireplace],
206 craftGroup: "cook-mutton",
207 craftGroupLabel: "Mutton",
208 output: { itemId: CraftingItemId.cookedMutton, quantity: 1 },
209 inputs: [{ itemId: CraftingItemId.rawMutton, quantity: 1 }],
210 minSkillLevel: 1,
211 skillId: "cooking",
212 burntOutput: { itemId: CraftingItemId.burntMutton, quantity: 1 }
213 }),
214
215 Object.freeze({
216 recipeId: "cook-goat",
217 stationIds: [CraftingStationId.oven, CraftingStationId.fireplace],
218 craftGroup: "cook-goat",
219 craftGroupLabel: "Goat",
220 output: { itemId: CraftingItemId.cookedGoat, quantity: 1 },
221 inputs: [{ itemId: CraftingItemId.rawGoat, quantity: 1 }],
222 minSkillLevel: 1,
223 skillId: "cooking",
224 burntOutput: { itemId: CraftingItemId.burntGoat, quantity: 1 }
225 }),
226
203 Object.freeze({
227 Object.freeze({
204 recipeId: "cook-egg",
228 recipeId: "cook-egg",
205 stationIds: [CraftingStationId.oven],
229 stationIds: [CraftingStationId.oven],
shared/definitions/craftingItems.js +132 −1
@@ -27,7 +27,13 @@ export const CraftingItemId = Object.freeze({
27 27 bronzeAxe: 20,
28 28 bronzePickaxe: 21,
29 29 tinOre: 53,
30 burntMeat: 280
30 burntMeat: 280,
31 rawMutton: 506,
32 cookedMutton: 507,
33 burntMutton: 508,
34 rawGoat: 509,
35 cookedGoat: 510,
36 burntGoat: 511
31 37 });
32 38
33 39 /** Magenta cookable base; tinted per cook state. */
@@ -37,6 +43,18 @@ const VENISON_COOK_COLORS = Object.freeze({
37 43 burnt: Object.freeze({ r: 0.18, g: 0.14, b: 0.12 })
38 44 });
39 45
46 const MUTTON_COOK_COLORS = Object.freeze({
47 raw: Object.freeze({ r: 0.78, g: 0.36, b: 0.4 }),
48 cooked: Object.freeze({ r: 0.62, g: 0.36, b: 0.22 }),
49 burnt: Object.freeze({ r: 0.2, g: 0.15, b: 0.12 })
50 });
51
52 const GOAT_COOK_COLORS = Object.freeze({
53 raw: Object.freeze({ r: 0.68, g: 0.34, b: 0.38 }),
54 cooked: Object.freeze({ r: 0.5, g: 0.3, b: 0.2 }),
55 burnt: Object.freeze({ r: 0.16, g: 0.13, b: 0.11 })
56 });
57
40 58 /**
41 59 * Fresh tinderbox instance payload (charges, not potion fill 1–5).
42 60 * @param {number} [charges]
@@ -149,6 +167,7 @@ export const CRAFTING_ITEM_STUBS = Object.freeze({
149 167 defaultState: "raw",
150 168 cookable: true,
151 169 cookState: "raw",
170 cookedItemId: CraftingItemId.cookedMeat,
152 171 burntItemId: CraftingItemId.burntMeat,
153 172 tint: VENISON_COOK_COLORS.raw
154 173 }),
@@ -189,5 +208,117 @@ export const CRAFTING_ITEM_STUBS = Object.freeze({
189 208 cookable: true,
190 209 cookState: "burnt",
191 210 tint: VENISON_COOK_COLORS.burnt
211 }),
212 [CraftingItemId.rawMutton]: Object.freeze({
213 itemId: CraftingItemId.rawMutton,
214 key: "uncooked-mutton",
215 displayName: "Uncooked Mutton",
216 description: "Fresh sheep meat. Cook at an oven or campfire.",
217 seedValue: 3,
218 stackable: true,
219 maxStackSize: DEFAULT_STACK,
220 uniqueInstance: false,
221 category: ItemCategory.ingredient,
222 iconKey: "meat",
223 defaultState: "raw",
224 cookable: true,
225 cookState: "raw",
226 cookedItemId: CraftingItemId.cookedMutton,
227 burntItemId: CraftingItemId.burntMutton,
228 tint: MUTTON_COOK_COLORS.raw
229 }),
230 [CraftingItemId.cookedMutton]: Object.freeze({
231 itemId: CraftingItemId.cookedMutton,
232 key: "cooked-mutton",
233 displayName: "Cooked Mutton",
234 description: "Roasted mutton with a hearty, pastoral flavour.",
235 seedValue: 4,
236 stackable: true,
237 maxStackSize: DEFAULT_STACK,
238 uniqueInstance: false,
239 category: ItemCategory.food,
240 iconKey: "meat",
241 defaultState: "cooked",
242 cookable: true,
243 cookState: "cooked",
244 tint: MUTTON_COOK_COLORS.cooked,
245 healing: 5,
246 eatStatusEffect: Object.freeze({
247 type: StatusEffectType.healthRegen,
248 amountPerSecond: 1,
249 durationMs: 5_000
250 })
251 }),
252 [CraftingItemId.burntMutton]: Object.freeze({
253 itemId: CraftingItemId.burntMutton,
254 key: "burnt-mutton",
255 displayName: "Burnt Mutton",
256 description: "Blackened mutton — tough and bitter.",
257 seedValue: 1,
258 stackable: true,
259 maxStackSize: DEFAULT_STACK,
260 uniqueInstance: false,
261 category: ItemCategory.food,
262 iconKey: "meat",
263 defaultState: "burnt",
264 cookable: true,
265 cookState: "burnt",
266 tint: MUTTON_COOK_COLORS.burnt
267 }),
268 [CraftingItemId.rawGoat]: Object.freeze({
269 itemId: CraftingItemId.rawGoat,
270 key: "uncooked-goat",
271 displayName: "Uncooked Goat",
272 description: "Lean goat meat. Cook at an oven or campfire.",
273 seedValue: 4,
274 stackable: true,
275 maxStackSize: DEFAULT_STACK,
276 uniqueInstance: false,
277 category: ItemCategory.ingredient,
278 iconKey: "meat",
279 defaultState: "raw",
280 cookable: true,
281 cookState: "raw",
282 cookedItemId: CraftingItemId.cookedGoat,
283 burntItemId: CraftingItemId.burntGoat,
284 tint: GOAT_COOK_COLORS.raw
285 }),
286 [CraftingItemId.cookedGoat]: Object.freeze({
287 itemId: CraftingItemId.cookedGoat,
288 key: "cooked-goat",
289 displayName: "Cooked Goat",
290 description: "Roasted goat, lean and savoury.",
291 seedValue: 5,
292 stackable: true,
293 maxStackSize: DEFAULT_STACK,
294 uniqueInstance: false,
295 category: ItemCategory.food,
296 iconKey: "meat",
297 defaultState: "cooked",
298 cookable: true,
299 cookState: "cooked",
300 tint: GOAT_COOK_COLORS.cooked,
301 healing: 6,
302 eatStatusEffect: Object.freeze({
303 type: StatusEffectType.healthRegen,
304 amountPerSecond: 1,
305 durationMs: 5_000
306 })
307 }),
308 [CraftingItemId.burntGoat]: Object.freeze({
309 itemId: CraftingItemId.burntGoat,
310 key: "burnt-goat",
311 displayName: "Burnt Goat",
312 description: "Overcooked goat — dry and charred.",
313 seedValue: 1,
314 stackable: true,
315 maxStackSize: DEFAULT_STACK,
316 uniqueInstance: false,
317 category: ItemCategory.food,
318 iconKey: "meat",
319 defaultState: "burnt",
320 cookable: true,
321 cookState: "burnt",
322 tint: GOAT_COOK_COLORS.burnt
192 323 })
193 324 });
@@ -27,7 +27,13 @@ export const CraftingItemId = Object.freeze({
27 bronzeAxe: 20,
27 bronzeAxe: 20,
28 bronzePickaxe: 21,
28 bronzePickaxe: 21,
29 tinOre: 53,
29 tinOre: 53,
30 burntMeat: 280
30 burntMeat: 280,
31 rawMutton: 506,
32 cookedMutton: 507,
33 burntMutton: 508,
34 rawGoat: 509,
35 cookedGoat: 510,
36 burntGoat: 511
31});
37});
32
38
33/** Magenta cookable base; tinted per cook state. */
39/** Magenta cookable base; tinted per cook state. */
@@ -37,6 +43,18 @@ const VENISON_COOK_COLORS = Object.freeze({
37 burnt: Object.freeze({ r: 0.18, g: 0.14, b: 0.12 })
43 burnt: Object.freeze({ r: 0.18, g: 0.14, b: 0.12 })
38});
44});
39
45
46const MUTTON_COOK_COLORS = Object.freeze({
47 raw: Object.freeze({ r: 0.78, g: 0.36, b: 0.4 }),
48 cooked: Object.freeze({ r: 0.62, g: 0.36, b: 0.22 }),
49 burnt: Object.freeze({ r: 0.2, g: 0.15, b: 0.12 })
50});
51
52const GOAT_COOK_COLORS = Object.freeze({
53 raw: Object.freeze({ r: 0.68, g: 0.34, b: 0.38 }),
54 cooked: Object.freeze({ r: 0.5, g: 0.3, b: 0.2 }),
55 burnt: Object.freeze({ r: 0.16, g: 0.13, b: 0.11 })
56});
57
40/**
58/**
41 * Fresh tinderbox instance payload (charges, not potion fill 1–5).
59 * Fresh tinderbox instance payload (charges, not potion fill 1–5).
42 * @param {number} [charges]
60 * @param {number} [charges]
@@ -149,6 +167,7 @@ export const CRAFTING_ITEM_STUBS = Object.freeze({
149 defaultState: "raw",
167 defaultState: "raw",
150 cookable: true,
168 cookable: true,
151 cookState: "raw",
169 cookState: "raw",
170 cookedItemId: CraftingItemId.cookedMeat,
152 burntItemId: CraftingItemId.burntMeat,
171 burntItemId: CraftingItemId.burntMeat,
153 tint: VENISON_COOK_COLORS.raw
172 tint: VENISON_COOK_COLORS.raw
154 }),
173 }),
@@ -189,5 +208,117 @@ export const CRAFTING_ITEM_STUBS = Object.freeze({
189 cookable: true,
208 cookable: true,
190 cookState: "burnt",
209 cookState: "burnt",
191 tint: VENISON_COOK_COLORS.burnt
210 tint: VENISON_COOK_COLORS.burnt
211 }),
212 [CraftingItemId.rawMutton]: Object.freeze({
213 itemId: CraftingItemId.rawMutton,
214 key: "uncooked-mutton",
215 displayName: "Uncooked Mutton",
216 description: "Fresh sheep meat. Cook at an oven or campfire.",
217 seedValue: 3,
218 stackable: true,
219 maxStackSize: DEFAULT_STACK,
220 uniqueInstance: false,
221 category: ItemCategory.ingredient,
222 iconKey: "meat",
223 defaultState: "raw",
224 cookable: true,
225 cookState: "raw",
226 cookedItemId: CraftingItemId.cookedMutton,
227 burntItemId: CraftingItemId.burntMutton,
228 tint: MUTTON_COOK_COLORS.raw
229 }),
230 [CraftingItemId.cookedMutton]: Object.freeze({
231 itemId: CraftingItemId.cookedMutton,
232 key: "cooked-mutton",
233 displayName: "Cooked Mutton",
234 description: "Roasted mutton with a hearty, pastoral flavour.",
235 seedValue: 4,
236 stackable: true,
237 maxStackSize: DEFAULT_STACK,
238 uniqueInstance: false,
239 category: ItemCategory.food,
240 iconKey: "meat",
241 defaultState: "cooked",
242 cookable: true,
243 cookState: "cooked",
244 tint: MUTTON_COOK_COLORS.cooked,
245 healing: 5,
246 eatStatusEffect: Object.freeze({
247 type: StatusEffectType.healthRegen,
248 amountPerSecond: 1,
249 durationMs: 5_000
250 })
251 }),
252 [CraftingItemId.burntMutton]: Object.freeze({
253 itemId: CraftingItemId.burntMutton,
254 key: "burnt-mutton",
255 displayName: "Burnt Mutton",
256 description: "Blackened mutton — tough and bitter.",
257 seedValue: 1,
258 stackable: true,
259 maxStackSize: DEFAULT_STACK,
260 uniqueInstance: false,
261 category: ItemCategory.food,
262 iconKey: "meat",
263 defaultState: "burnt",
264 cookable: true,
265 cookState: "burnt",
266 tint: MUTTON_COOK_COLORS.burnt
267 }),
268 [CraftingItemId.rawGoat]: Object.freeze({
269 itemId: CraftingItemId.rawGoat,
270 key: "uncooked-goat",
271 displayName: "Uncooked Goat",
272 description: "Lean goat meat. Cook at an oven or campfire.",
273 seedValue: 4,
274 stackable: true,
275 maxStackSize: DEFAULT_STACK,
276 uniqueInstance: false,
277 category: ItemCategory.ingredient,
278 iconKey: "meat",
279 defaultState: "raw",
280 cookable: true,
281 cookState: "raw",
282 cookedItemId: CraftingItemId.cookedGoat,
283 burntItemId: CraftingItemId.burntGoat,
284 tint: GOAT_COOK_COLORS.raw
285 }),
286 [CraftingItemId.cookedGoat]: Object.freeze({
287 itemId: CraftingItemId.cookedGoat,
288 key: "cooked-goat",
289 displayName: "Cooked Goat",
290 description: "Roasted goat, lean and savoury.",
291 seedValue: 5,
292 stackable: true,
293 maxStackSize: DEFAULT_STACK,
294 uniqueInstance: false,
295 category: ItemCategory.food,
296 iconKey: "meat",
297 defaultState: "cooked",
298 cookable: true,
299 cookState: "cooked",
300 tint: GOAT_COOK_COLORS.cooked,
301 healing: 6,
302 eatStatusEffect: Object.freeze({
303 type: StatusEffectType.healthRegen,
304 amountPerSecond: 1,
305 durationMs: 5_000
306 })
307 }),
308 [CraftingItemId.burntGoat]: Object.freeze({
309 itemId: CraftingItemId.burntGoat,
310 key: "burnt-goat",
311 displayName: "Burnt Goat",
312 description: "Overcooked goat — dry and charred.",
313 seedValue: 1,
314 stackable: true,
315 maxStackSize: DEFAULT_STACK,
316 uniqueInstance: false,
317 category: ItemCategory.food,
318 iconKey: "meat",
319 defaultState: "burnt",
320 cookable: true,
321 cookState: "burnt",
322 tint: GOAT_COOK_COLORS.burnt
192 })
323 })
193});
324});
shared/definitions/mobs.js +2 −2
@@ -163,7 +163,7 @@ export const MOB_DEFINITIONS = Object.freeze({
163 163 attackCooldownMs: 1200,
164 164 drops: Object.freeze([
165 165 { itemId: LeatherItemId.softLeather, chance: 0.5 },
166 { itemId: CraftingItemId.rawMeat, chance: 1 }
166 { itemId: CraftingItemId.rawMutton, chance: 1 }
167 167 ]),
168 168 sells: Object.freeze([]),
169 169 dialogue: Object.freeze([]),
@@ -197,7 +197,7 @@ export const MOB_DEFINITIONS = Object.freeze({
197 197 attackCooldownMs: 1100,
198 198 drops: Object.freeze([
199 199 { itemId: LeatherItemId.softLeather, chance: 0.6 },
200 { itemId: CraftingItemId.rawMeat, chance: 1 }
200 { itemId: CraftingItemId.rawGoat, chance: 1 }
201 201 ]),
202 202 sells: Object.freeze([]),
203 203 dialogue: Object.freeze([]),
@@ -163,7 +163,7 @@ export const MOB_DEFINITIONS = Object.freeze({
163 attackCooldownMs: 1200,
163 attackCooldownMs: 1200,
164 drops: Object.freeze([
164 drops: Object.freeze([
165 { itemId: LeatherItemId.softLeather, chance: 0.5 },
165 { itemId: LeatherItemId.softLeather, chance: 0.5 },
166 { itemId: CraftingItemId.rawMeat, chance: 1 }
166 { itemId: CraftingItemId.rawMutton, chance: 1 }
167 ]),
167 ]),
168 sells: Object.freeze([]),
168 sells: Object.freeze([]),
169 dialogue: Object.freeze([]),
169 dialogue: Object.freeze([]),
@@ -197,7 +197,7 @@ export const MOB_DEFINITIONS = Object.freeze({
197 attackCooldownMs: 1100,
197 attackCooldownMs: 1100,
198 drops: Object.freeze([
198 drops: Object.freeze([
199 { itemId: LeatherItemId.softLeather, chance: 0.6 },
199 { itemId: LeatherItemId.softLeather, chance: 0.6 },
200 { itemId: CraftingItemId.rawMeat, chance: 1 }
200 { itemId: CraftingItemId.rawGoat, chance: 1 }
201 ]),
201 ]),
202 sells: Object.freeze([]),
202 sells: Object.freeze([]),
203 dialogue: Object.freeze([]),
203 dialogue: Object.freeze([]),