refactor: improve layout and styling consistency across components
This commit is contained in:
@@ -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)],
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user