Curios and artifacts !
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// curios' slot types, both scripts share them
|
||||
import type { TagApi } from "bworld/server";
|
||||
|
||||
// in curios' order. every player has one of each, at its index here in their curios container, so slots keep their
|
||||
// items when mods come and go
|
||||
export const SLOTS = [
|
||||
"curio",
|
||||
"head",
|
||||
"necklace",
|
||||
"back",
|
||||
"body",
|
||||
"bracelet",
|
||||
"hands",
|
||||
"ring",
|
||||
"belt",
|
||||
"feet",
|
||||
"charm",
|
||||
];
|
||||
|
||||
// like curios, a slot type is only there once some item goes in it: something is in its item tag, #curios:ring for
|
||||
// rings
|
||||
export function active_slots(tags: TagApi): string[] {
|
||||
return SLOTS.filter((slot) => tags.get("items", `curios:${slot}`).length > 0);
|
||||
}
|
||||
|
||||
// curios' tag validator: an item goes in the slot types whose tag it's in, and #curios:curio items go in any
|
||||
export function fits(tags: TagApi, slot: string, id: string): boolean {
|
||||
return tags.has("items", `curios:${slot}`, id) || tags.has("items", "curios:curio", id);
|
||||
}
|
||||
Reference in New Issue
Block a user