refactor: improve layout and styling consistency across components

This commit is contained in:
2026-04-23 21:08:54 -04:00
parent 1df2ae8164
commit c2d12ffcc9
3 changed files with 39 additions and 33 deletions

View File

@@ -127,9 +127,20 @@ const verbHandlers: Record<string, VerbHandler> = {
reason: `'${t.target.id}' cannot be taken`,
};
}
// Item must be in the same location as actor
// Item must be in the same location as actor (unless already in inventory)
const actorLocation = actor.attributes["location"];
const itemLocation = t.target.attributes["location"];
const expectedInventory = `inventory:${actor.id}`;
// If already in inventory, it's a no-op (already holding it)
if (itemLocation === expectedInventory) {
return {
ok: true,
changes: [],
};
}
if (actorLocation !== itemLocation) {
return {
ok: false,
@@ -139,7 +150,7 @@ const verbHandlers: Record<string, VerbHandler> = {
return {
ok: true,
changes: [attributeChange(t.target, "location", `inventory:${actor.id}`)],
changes: [attributeChange(t.target, "location", expectedInventory)],
};
},